aboutsummaryrefslogtreecommitdiffstats
path: root/weaver
diff options
context:
space:
mode:
authorAndy Clement <aclement@pivotal.io>2019-01-25 15:14:30 -0800
committerAndy Clement <aclement@pivotal.io>2019-01-25 15:14:30 -0800
commitd3da67c03dc7d19782d60d82fdf8fc7c7895280e (patch)
treeb8c82793fa0b6843e022a126f942dc132133b3fd /weaver
parent7758d629f9bc6818709d5ae97bbb98a27c908f75 (diff)
downloadaspectj-d3da67c03dc7d19782d60d82fdf8fc7c7895280e.tar.gz
aspectj-d3da67c03dc7d19782d60d82fdf8fc7c7895280e.zip
mavenizing weaver - wip
Diffstat (limited to 'weaver')
-rw-r--r--weaver/.classpath61
-rw-r--r--weaver/.cvsignore6
-rw-r--r--weaver/.isJava51
-rw-r--r--weaver/.project11
-rw-r--r--weaver/.settings/org.eclipse.core.resources.prefs5
-rw-r--r--weaver/.settings/org.eclipse.jdt.apt.core.prefs2
-rw-r--r--weaver/.settings/org.eclipse.jdt.core.prefs16
-rw-r--r--weaver/.settings/org.eclipse.jdt.ui.prefs3
-rw-r--r--weaver/.settings/org.eclipse.m2e.core.prefs4
-rw-r--r--weaver/build.xml6
-rw-r--r--weaver/pom.xml85
-rw-r--r--weaver/src/main/java/org/aspectj/weaver/IClassFileProvider.java (renamed from weaver/src/org/aspectj/weaver/IClassFileProvider.java)0
-rw-r--r--weaver/src/main/java/org/aspectj/weaver/bcel/AnnotationAccessFieldVar.java (renamed from weaver/src/org/aspectj/weaver/bcel/AnnotationAccessFieldVar.java)0
-rw-r--r--weaver/src/main/java/org/aspectj/weaver/bcel/AnnotationAccessVar.java (renamed from weaver/src/org/aspectj/weaver/bcel/AnnotationAccessVar.java)0
-rw-r--r--weaver/src/main/java/org/aspectj/weaver/bcel/AspectInstanceVar.java (renamed from weaver/src/org/aspectj/weaver/bcel/AspectInstanceVar.java)0
-rw-r--r--weaver/src/main/java/org/aspectj/weaver/bcel/AtAjAttributes.java (renamed from weaver/src/org/aspectj/weaver/bcel/AtAjAttributes.java)0
-rw-r--r--weaver/src/main/java/org/aspectj/weaver/bcel/BcelAccessForInlineMunger.java (renamed from weaver/src/org/aspectj/weaver/bcel/BcelAccessForInlineMunger.java)0
-rw-r--r--weaver/src/main/java/org/aspectj/weaver/bcel/BcelAdvice.java (renamed from weaver/src/org/aspectj/weaver/bcel/BcelAdvice.java)0
-rw-r--r--weaver/src/main/java/org/aspectj/weaver/bcel/BcelAnnotation.java (renamed from weaver/src/org/aspectj/weaver/bcel/BcelAnnotation.java)0
-rw-r--r--weaver/src/main/java/org/aspectj/weaver/bcel/BcelCflowAccessVar.java (renamed from weaver/src/org/aspectj/weaver/bcel/BcelCflowAccessVar.java)0
-rw-r--r--weaver/src/main/java/org/aspectj/weaver/bcel/BcelCflowCounterFieldAdder.java (renamed from weaver/src/org/aspectj/weaver/bcel/BcelCflowCounterFieldAdder.java)0
-rw-r--r--weaver/src/main/java/org/aspectj/weaver/bcel/BcelCflowStackFieldAdder.java (renamed from weaver/src/org/aspectj/weaver/bcel/BcelCflowStackFieldAdder.java)0
-rw-r--r--weaver/src/main/java/org/aspectj/weaver/bcel/BcelClassWeaver.java (renamed from weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java)0
-rw-r--r--weaver/src/main/java/org/aspectj/weaver/bcel/BcelConstantPoolReader.java (renamed from weaver/src/org/aspectj/weaver/bcel/BcelConstantPoolReader.java)0
-rw-r--r--weaver/src/main/java/org/aspectj/weaver/bcel/BcelConstantPoolWriter.java (renamed from weaver/src/org/aspectj/weaver/bcel/BcelConstantPoolWriter.java)0
-rw-r--r--weaver/src/main/java/org/aspectj/weaver/bcel/BcelField.java (renamed from weaver/src/org/aspectj/weaver/bcel/BcelField.java)0
-rw-r--r--weaver/src/main/java/org/aspectj/weaver/bcel/BcelFieldRef.java (renamed from weaver/src/org/aspectj/weaver/bcel/BcelFieldRef.java)0
-rw-r--r--weaver/src/main/java/org/aspectj/weaver/bcel/BcelGenericSignatureToTypeXConverter.java (renamed from weaver/src/org/aspectj/weaver/bcel/BcelGenericSignatureToTypeXConverter.java)0
-rw-r--r--weaver/src/main/java/org/aspectj/weaver/bcel/BcelMethod.java (renamed from weaver/src/org/aspectj/weaver/bcel/BcelMethod.java)0
-rw-r--r--weaver/src/main/java/org/aspectj/weaver/bcel/BcelObjectType.java (renamed from weaver/src/org/aspectj/weaver/bcel/BcelObjectType.java)0
-rw-r--r--weaver/src/main/java/org/aspectj/weaver/bcel/BcelPerClauseAspectAdder.java (renamed from weaver/src/org/aspectj/weaver/bcel/BcelPerClauseAspectAdder.java)0
-rw-r--r--weaver/src/main/java/org/aspectj/weaver/bcel/BcelRenderer.java (renamed from weaver/src/org/aspectj/weaver/bcel/BcelRenderer.java)0
-rw-r--r--weaver/src/main/java/org/aspectj/weaver/bcel/BcelShadow.java (renamed from weaver/src/org/aspectj/weaver/bcel/BcelShadow.java)0
-rw-r--r--weaver/src/main/java/org/aspectj/weaver/bcel/BcelTypeMunger.java (renamed from weaver/src/org/aspectj/weaver/bcel/BcelTypeMunger.java)0
-rw-r--r--weaver/src/main/java/org/aspectj/weaver/bcel/BcelVar.java (renamed from weaver/src/org/aspectj/weaver/bcel/BcelVar.java)0
-rw-r--r--weaver/src/main/java/org/aspectj/weaver/bcel/BcelWeakClassLoaderReference.java (renamed from weaver/src/org/aspectj/weaver/bcel/BcelWeakClassLoaderReference.java)0
-rw-r--r--weaver/src/main/java/org/aspectj/weaver/bcel/BcelWeaver.java (renamed from weaver/src/org/aspectj/weaver/bcel/BcelWeaver.java)0
-rw-r--r--weaver/src/main/java/org/aspectj/weaver/bcel/BcelWeavingSupport.java (renamed from weaver/src/org/aspectj/weaver/bcel/BcelWeavingSupport.java)0
-rw-r--r--weaver/src/main/java/org/aspectj/weaver/bcel/BcelWorld.java (renamed from weaver/src/org/aspectj/weaver/bcel/BcelWorld.java)0
-rw-r--r--weaver/src/main/java/org/aspectj/weaver/bcel/ClassPathManager.java (renamed from weaver/src/org/aspectj/weaver/bcel/ClassPathManager.java)3
-rw-r--r--weaver/src/main/java/org/aspectj/weaver/bcel/ExceptionRange.java (renamed from weaver/src/org/aspectj/weaver/bcel/ExceptionRange.java)0
-rw-r--r--weaver/src/main/java/org/aspectj/weaver/bcel/ExtensibleURLClassLoader.java (renamed from weaver/src/org/aspectj/weaver/bcel/ExtensibleURLClassLoader.java)0
-rw-r--r--weaver/src/main/java/org/aspectj/weaver/bcel/FakeAnnotation.java (renamed from weaver/src/org/aspectj/weaver/bcel/FakeAnnotation.java)0
-rw-r--r--weaver/src/main/java/org/aspectj/weaver/bcel/IfFinder.java (renamed from weaver/src/org/aspectj/weaver/bcel/IfFinder.java)0
-rw-r--r--weaver/src/main/java/org/aspectj/weaver/bcel/LazyClassGen.java (renamed from weaver/src/org/aspectj/weaver/bcel/LazyClassGen.java)0
-rw-r--r--weaver/src/main/java/org/aspectj/weaver/bcel/LazyMethodGen.java (renamed from weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java)0
-rw-r--r--weaver/src/main/java/org/aspectj/weaver/bcel/Range.java (renamed from weaver/src/org/aspectj/weaver/bcel/Range.java)0
-rw-r--r--weaver/src/main/java/org/aspectj/weaver/bcel/ShadowRange.java (renamed from weaver/src/org/aspectj/weaver/bcel/ShadowRange.java)0
-rw-r--r--weaver/src/main/java/org/aspectj/weaver/bcel/TypeAnnotationAccessVar.java (renamed from weaver/src/org/aspectj/weaver/bcel/TypeAnnotationAccessVar.java)0
-rw-r--r--weaver/src/main/java/org/aspectj/weaver/bcel/TypeDelegateResolver.java (renamed from weaver/src/org/aspectj/weaver/bcel/TypeDelegateResolver.java)0
-rw-r--r--weaver/src/main/java/org/aspectj/weaver/bcel/UnwovenClassFile.java (renamed from weaver/src/org/aspectj/weaver/bcel/UnwovenClassFile.java)0
-rw-r--r--weaver/src/main/java/org/aspectj/weaver/bcel/UnwovenClassFileWithThirdPartyManagedBytecode.java (renamed from weaver/src/org/aspectj/weaver/bcel/UnwovenClassFileWithThirdPartyManagedBytecode.java)0
-rw-r--r--weaver/src/main/java/org/aspectj/weaver/bcel/Utility.java (renamed from weaver/src/org/aspectj/weaver/bcel/Utility.java)0
-rw-r--r--weaver/src/main/java/org/aspectj/weaver/bcel/asm/AsmDetector.java (renamed from weaver/src/org/aspectj/weaver/bcel/asm/AsmDetector.java)0
-rw-r--r--weaver/src/main/java/org/aspectj/weaver/bcel/asm/StackMapAdder.java (renamed from weaver/src/org/aspectj/weaver/bcel/asm/StackMapAdder.java)0
-rw-r--r--weaver/src/main/java/org/aspectj/weaver/loadtime/IWeavingContext.java (renamed from weaver/src/org/aspectj/weaver/loadtime/IWeavingContext.java)0
-rw-r--r--weaver/src/main/java/org/aspectj/weaver/loadtime/definition/Definition.java (renamed from weaver/src/org/aspectj/weaver/loadtime/definition/Definition.java)0
-rw-r--r--weaver/src/main/java/org/aspectj/weaver/loadtime/definition/DocumentParser.java (renamed from weaver/src/org/aspectj/weaver/loadtime/definition/DocumentParser.java)0
-rw-r--r--weaver/src/main/java/org/aspectj/weaver/loadtime/definition/LightXMLParser.java (renamed from weaver/src/org/aspectj/weaver/loadtime/definition/LightXMLParser.java)0
-rw-r--r--weaver/src/main/java/org/aspectj/weaver/loadtime/definition/SimpleAOPParser.java (renamed from weaver/src/org/aspectj/weaver/loadtime/definition/SimpleAOPParser.java)0
-rw-r--r--weaver/src/main/java/org/aspectj/weaver/ltw/LTWWorld.java (renamed from weaver/src/org/aspectj/weaver/ltw/LTWWorld.java)0
-rw-r--r--weaver/src/main/java/org/aspectj/weaver/model/AsmRelationshipProvider.java (renamed from weaver/src/org/aspectj/weaver/model/AsmRelationshipProvider.java)0
-rw-r--r--weaver/src/main/java/org/aspectj/weaver/model/AsmRelationshipUtils.java (renamed from weaver/src/org/aspectj/weaver/model/AsmRelationshipUtils.java)0
-rw-r--r--weaver/src/main/java/org/aspectj/weaver/reflect/ArgNameFinder.java26
-rw-r--r--weaver/src/main/java/org/aspectj/weaver/reflect/DeferredResolvedPointcutDefinition.java35
-rw-r--r--weaver/src/main/java/org/aspectj/weaver/reflect/InternalUseOnlyPointcutParser.java43
-rw-r--r--weaver/src/main/java/org/aspectj/weaver/reflect/Java15AnnotationFinder.java386
-rw-r--r--weaver/src/main/java/org/aspectj/weaver/reflect/Java15GenericSignatureInformationProvider.java103
-rw-r--r--weaver/src/main/java/org/aspectj/weaver/reflect/Java15ReflectionBasedReferenceTypeDelegate.java389
-rw-r--r--weaver/src/main/java/org/aspectj/weaver/reflect/JavaLangTypeToResolvedTypeConverter.java134
-rw-r--r--weaver/src/main/java/org/aspectj/weaver/tools/Jdk14Trace.java127
-rw-r--r--weaver/src/main/java/org/aspectj/weaver/tools/Jdk14TraceFactory.java20
-rw-r--r--weaver/src/main/java/org/aspectj/weaver/tools/WeavingAdaptor.java (renamed from weaver/src/org/aspectj/weaver/tools/WeavingAdaptor.java)0
-rw-r--r--weaver/src/main/java/org/aspectj/weaver/tools/cache/AbstractCacheBacking.java (renamed from weaver/src/org/aspectj/weaver/tools/cache/AbstractCacheBacking.java)0
-rw-r--r--weaver/src/main/java/org/aspectj/weaver/tools/cache/AbstractFileCacheBacking.java (renamed from weaver/src/org/aspectj/weaver/tools/cache/AbstractFileCacheBacking.java)0
-rw-r--r--weaver/src/main/java/org/aspectj/weaver/tools/cache/AbstractIndexedFileCacheBacking.java (renamed from weaver/src/org/aspectj/weaver/tools/cache/AbstractIndexedFileCacheBacking.java)0
-rw-r--r--weaver/src/main/java/org/aspectj/weaver/tools/cache/AsynchronousFileCacheBacking.java (renamed from weaver/src/org/aspectj/weaver/tools/cache/AsynchronousFileCacheBacking.java)0
-rw-r--r--weaver/src/main/java/org/aspectj/weaver/tools/cache/CacheBacking.java (renamed from weaver/src/org/aspectj/weaver/tools/cache/CacheBacking.java)0
-rw-r--r--weaver/src/main/java/org/aspectj/weaver/tools/cache/CacheFactory.java (renamed from weaver/src/org/aspectj/weaver/tools/cache/CacheFactory.java)0
-rw-r--r--weaver/src/main/java/org/aspectj/weaver/tools/cache/CacheKeyResolver.java (renamed from weaver/src/org/aspectj/weaver/tools/cache/CacheKeyResolver.java)0
-rw-r--r--weaver/src/main/java/org/aspectj/weaver/tools/cache/CacheStatistics.java (renamed from weaver/src/org/aspectj/weaver/tools/cache/CacheStatistics.java)0
-rw-r--r--weaver/src/main/java/org/aspectj/weaver/tools/cache/CachedClassEntry.java (renamed from weaver/src/org/aspectj/weaver/tools/cache/CachedClassEntry.java)0
-rw-r--r--weaver/src/main/java/org/aspectj/weaver/tools/cache/CachedClassReference.java (renamed from weaver/src/org/aspectj/weaver/tools/cache/CachedClassReference.java)0
-rw-r--r--weaver/src/main/java/org/aspectj/weaver/tools/cache/DefaultCacheFactory.java (renamed from weaver/src/org/aspectj/weaver/tools/cache/DefaultCacheFactory.java)0
-rw-r--r--weaver/src/main/java/org/aspectj/weaver/tools/cache/DefaultCacheKeyResolver.java (renamed from weaver/src/org/aspectj/weaver/tools/cache/DefaultCacheKeyResolver.java)0
-rw-r--r--weaver/src/main/java/org/aspectj/weaver/tools/cache/DefaultFileCacheBacking.java (renamed from weaver/src/org/aspectj/weaver/tools/cache/DefaultFileCacheBacking.java)0
-rw-r--r--weaver/src/main/java/org/aspectj/weaver/tools/cache/FlatFileCacheBacking.java (renamed from weaver/src/org/aspectj/weaver/tools/cache/FlatFileCacheBacking.java)0
-rw-r--r--weaver/src/main/java/org/aspectj/weaver/tools/cache/GeneratedCachedClassHandler.java (renamed from weaver/src/org/aspectj/weaver/tools/cache/GeneratedCachedClassHandler.java)0
-rw-r--r--weaver/src/main/java/org/aspectj/weaver/tools/cache/SimpleCache.java (renamed from weaver/src/org/aspectj/weaver/tools/cache/SimpleCache.java)0
-rw-r--r--weaver/src/main/java/org/aspectj/weaver/tools/cache/SimpleCacheFactory.java (renamed from weaver/src/org/aspectj/weaver/tools/cache/SimpleCacheFactory.java)0
-rw-r--r--weaver/src/main/java/org/aspectj/weaver/tools/cache/WeavedClassCache.java (renamed from weaver/src/org/aspectj/weaver/tools/cache/WeavedClassCache.java)0
-rw-r--r--weaver/src/main/java/org/aspectj/weaver/tools/cache/ZippedFileCacheBacking.java (renamed from weaver/src/org/aspectj/weaver/tools/cache/ZippedFileCacheBacking.java)0
-rw-r--r--weaver/src/main/resources/aspectj_1_5_0.dtd (renamed from weaver/src/aspectj_1_5_0.dtd)0
-rw-r--r--weaver/src/test/java/$Proxy1.java28
-rw-r--r--weaver/src/test/java/CounterAspect.java52
-rw-r--r--weaver/src/test/java/GenericService.java17
-rw-r--r--weaver/src/test/java/MA.java15
-rw-r--r--weaver/src/test/java/MB.java15
-rw-r--r--weaver/src/test/java/MC.java15
-rw-r--r--weaver/src/test/java/MD.java15
-rw-r--r--weaver/src/test/java/MessageService.java13
-rw-r--r--weaver/src/test/java/fluffy/Aspect.java (renamed from weaver/testsrc/fluffy/Aspect.java)0
-rw-r--r--weaver/src/test/java/fluffy/Base.java (renamed from weaver/testsrc/fluffy/Base.java)0
-rw-r--r--weaver/src/test/java/fluffy/Derived.java (renamed from weaver/testsrc/fluffy/Derived.java)2
-rw-r--r--weaver/src/test/java/org/aspectj/matcher/tools/ReflectionWorldAdvancedPointcutExpressionTest.java30
-rw-r--r--weaver/src/test/java/org/aspectj/weaver/AbstractTraceTest.java (renamed from weaver/testsrc/org/aspectj/weaver/AbstractTraceTest.java)0
-rw-r--r--weaver/src/test/java/org/aspectj/weaver/AllWeaver5Tests.java40
-rw-r--r--weaver/src/test/java/org/aspectj/weaver/BcweaverModule15Test.java41
-rw-r--r--weaver/src/test/java/org/aspectj/weaver/BoundedReferenceTypeTestCase.java (renamed from weaver/testsrc/org/aspectj/weaver/BoundedReferenceTypeTestCase.java)0
-rw-r--r--weaver/src/test/java/org/aspectj/weaver/CommonReferenceTypeTests.java91
-rw-r--r--weaver/src/test/java/org/aspectj/weaver/CommonsTraceFactoryTest.java (renamed from weaver/testsrc/org/aspectj/weaver/CommonsTraceFactoryTest.java)0
-rw-r--r--weaver/src/test/java/org/aspectj/weaver/CommonsTraceTest.java (renamed from weaver/testsrc/org/aspectj/weaver/CommonsTraceTest.java)0
-rw-r--r--weaver/src/test/java/org/aspectj/weaver/DefaultTraceFactoryTest.java (renamed from weaver/testsrc/org/aspectj/weaver/DefaultTraceFactoryTest.java)0
-rw-r--r--weaver/src/test/java/org/aspectj/weaver/DefaultTraceTest.java (renamed from weaver/testsrc/org/aspectj/weaver/DefaultTraceTest.java)0
-rw-r--r--weaver/src/test/java/org/aspectj/weaver/DumpTestCase.java (renamed from weaver/testsrc/org/aspectj/weaver/DumpTestCase.java)0
-rw-r--r--weaver/src/test/java/org/aspectj/weaver/GenericSignatureParserTest.java (renamed from weaver/testsrc/org/aspectj/weaver/GenericSignatureParserTest.java)0
-rw-r--r--weaver/src/test/java/org/aspectj/weaver/Java5ReflectionBasedReferenceTypeDelegateTest.java154
-rw-r--r--weaver/src/test/java/org/aspectj/weaver/Jdk14TraceFactoryTest.java (renamed from weaver/testsrc/org/aspectj/weaver/AllTracingTests.java)26
-rw-r--r--weaver/src/test/java/org/aspectj/weaver/Jdk14TraceTest.java34
-rw-r--r--weaver/src/test/java/org/aspectj/weaver/JoinPointSignatureIteratorTest.java107
-rw-r--r--weaver/src/test/java/org/aspectj/weaver/LocaleTest.java (renamed from weaver/testsrc/org/aspectj/weaver/LocaleTest.java)0
-rw-r--r--weaver/src/test/java/org/aspectj/weaver/Member15Test.java155
-rw-r--r--weaver/src/test/java/org/aspectj/weaver/Member15TestCase.java (renamed from weaver/testsrc/org/aspectj/weaver/MemberTestCase15.java)2
-rw-r--r--weaver/src/test/java/org/aspectj/weaver/MemberTestCase.java (renamed from weaver/testsrc/org/aspectj/weaver/MemberTestCase.java)0
-rw-r--r--weaver/src/test/java/org/aspectj/weaver/ParameterizedReferenceTypeTestCase.java (renamed from weaver/testsrc/org/aspectj/weaver/ParameterizedReferenceTypeTestCase.java)5
-rw-r--r--weaver/src/test/java/org/aspectj/weaver/ReferenceTypeTestCase.java854
-rw-r--r--weaver/src/test/java/org/aspectj/weaver/ResolvedMemberSignatures15TestCase.java (renamed from weaver/testsrc/org/aspectj/weaver/ResolvedMemberSignaturesTestCase15.java)35
-rw-r--r--weaver/src/test/java/org/aspectj/weaver/TestShadow.java (renamed from weaver/testsrc/org/aspectj/weaver/TestShadow.java)0
-rw-r--r--weaver/src/test/java/org/aspectj/weaver/TraceFactoryTest.java (renamed from weaver/testsrc/org/aspectj/weaver/TraceFactoryTest.java)0
-rw-r--r--weaver/src/test/java/org/aspectj/weaver/TypeVariableReferenceTypeTestCase.java (renamed from weaver/testsrc/org/aspectj/weaver/TypeVariableReferenceTypeTestCase.java)47
-rw-r--r--weaver/src/test/java/org/aspectj/weaver/TypeVariableTestCase.java (renamed from weaver/testsrc/org/aspectj/weaver/TypeVariableTestCase.java)20
-rw-r--r--weaver/src/test/java/org/aspectj/weaver/TypeXTestCase.java (renamed from weaver/testsrc/org/aspectj/weaver/TypeXTestCase.java)0
-rw-r--r--weaver/src/test/java/org/aspectj/weaver/Weaver5ModuleTests.java37
-rw-r--r--weaver/src/test/java/org/aspectj/weaver/WeaverMessagesTestCase.java (renamed from weaver/testsrc/org/aspectj/weaver/WeaverMessagesTestCase.java)0
-rw-r--r--weaver/src/test/java/org/aspectj/weaver/WeaverTestCase.java (renamed from weaver/testsrc/org/aspectj/weaver/BcweaverTests.java)18
-rw-r--r--weaver/src/test/java/org/aspectj/weaver/bcel/AfterReturningWeaveTestCase.java (renamed from weaver/testsrc/org/aspectj/weaver/bcel/AfterReturningWeaveTestCase.java)0
-rw-r--r--weaver/src/test/java/org/aspectj/weaver/bcel/AfterThrowingWeaveTestCase.java (renamed from weaver/testsrc/org/aspectj/weaver/bcel/AfterThrowingWeaveTestCase.java)0
-rw-r--r--weaver/src/test/java/org/aspectj/weaver/bcel/AfterWeaveTestCase.java (renamed from weaver/testsrc/org/aspectj/weaver/bcel/AfterWeaveTestCase.java)0
-rw-r--r--weaver/src/test/java/org/aspectj/weaver/bcel/ArgsWeaveTestCase.java (renamed from weaver/testsrc/org/aspectj/weaver/bcel/ArgsWeaveTestCase.java)0
-rw-r--r--weaver/src/test/java/org/aspectj/weaver/bcel/AroundArgsWeaveTestCase.java (renamed from weaver/testsrc/org/aspectj/weaver/bcel/AroundArgsWeaveTestCase.java)0
-rw-r--r--weaver/src/test/java/org/aspectj/weaver/bcel/AroundWeaveTestCase.java (renamed from weaver/testsrc/org/aspectj/weaver/bcel/AroundWeaveTestCase.java)0
-rw-r--r--weaver/src/test/java/org/aspectj/weaver/bcel/BcelGenericSignatureToTypeXTestCase.java (renamed from weaver/testsrc/org/aspectj/weaver/bcel/BcelGenericSignatureToTypeXTestCase.java)19
-rw-r--r--weaver/src/test/java/org/aspectj/weaver/bcel/BcelTestUtils.java (renamed from weaver/testsrc/org/aspectj/weaver/bcel/BcelTestUtils.java)0
-rw-r--r--weaver/src/test/java/org/aspectj/weaver/bcel/BcelWorldReferenceTypeTest.java23
-rw-r--r--weaver/src/test/java/org/aspectj/weaver/bcel/BeforeWeaveTestCase.java (renamed from weaver/testsrc/org/aspectj/weaver/bcel/BeforeWeaveTestCase.java)0
-rw-r--r--weaver/src/test/java/org/aspectj/weaver/bcel/CheckerTestCase.java (renamed from weaver/testsrc/org/aspectj/weaver/bcel/CheckerTestCase.java)0
-rw-r--r--weaver/src/test/java/org/aspectj/weaver/bcel/ClassLoaderRepositoryTest.java (renamed from weaver/testsrc/org/aspectj/weaver/bcel/ClassLoaderRepositoryTests.java)2
-rw-r--r--weaver/src/test/java/org/aspectj/weaver/bcel/FieldSetTestCase.java (renamed from weaver/testsrc/org/aspectj/weaver/bcel/FieldSetTestCase.java)0
-rw-r--r--weaver/src/test/java/org/aspectj/weaver/bcel/HierarchyDependsTestCase.java (renamed from weaver/testsrc/org/aspectj/weaver/bcel/HierarchyDependsTestCase.java)0
-rw-r--r--weaver/src/test/java/org/aspectj/weaver/bcel/IdWeaveTestCase.java (renamed from weaver/testsrc/org/aspectj/weaver/bcel/IdWeaveTestCase.java)0
-rw-r--r--weaver/src/test/java/org/aspectj/weaver/bcel/JImageTestCase.java (renamed from weaver/testsrc/org/aspectj/weaver/bcel/JImageTestCase.java)8
-rw-r--r--weaver/src/test/java/org/aspectj/weaver/bcel/MegaZipTestCase.java (renamed from weaver/testsrc/org/aspectj/weaver/bcel/MegaZipTestCase.java)8
-rw-r--r--weaver/src/test/java/org/aspectj/weaver/bcel/MoveInstructionsWeaveTestCase.java (renamed from weaver/testsrc/org/aspectj/weaver/bcel/MoveInstructionsWeaveTestCase.java)0
-rw-r--r--weaver/src/test/java/org/aspectj/weaver/bcel/NonstaticWeaveTestCase.java (renamed from weaver/testsrc/org/aspectj/weaver/bcel/NonstaticWeaveTestCase.java)0
-rw-r--r--weaver/src/test/java/org/aspectj/weaver/bcel/PatternWeaveTestCase.java (renamed from weaver/testsrc/org/aspectj/weaver/bcel/PatternWeaveTestCase.java)0
-rw-r--r--weaver/src/test/java/org/aspectj/weaver/bcel/PointcutResidueTestCase.java (renamed from weaver/testsrc/org/aspectj/weaver/bcel/PointcutResidueTestCase.java)0
-rw-r--r--weaver/src/test/java/org/aspectj/weaver/bcel/TjpWeaveTestCase.java (renamed from weaver/testsrc/org/aspectj/weaver/bcel/TjpWeaveTestCase.java)0
-rw-r--r--weaver/src/test/java/org/aspectj/weaver/bcel/TraceJarWeaveTestCase.java (renamed from weaver/testsrc/org/aspectj/weaver/bcel/TraceJarWeaveTestCase.java)0
-rw-r--r--weaver/src/test/java/org/aspectj/weaver/bcel/UtilityTestCase.java (renamed from weaver/testsrc/org/aspectj/weaver/bcel/UtilityTestCase.java)0
-rw-r--r--weaver/src/test/java/org/aspectj/weaver/bcel/WeaveOrderTestCase.java (renamed from weaver/testsrc/org/aspectj/weaver/bcel/WeaveOrderTestCase.java)0
-rw-r--r--weaver/src/test/java/org/aspectj/weaver/bcel/WeaveTestCase.java (renamed from weaver/testsrc/org/aspectj/weaver/bcel/WeaveTestCase.java)12
-rw-r--r--weaver/src/test/java/org/aspectj/weaver/bcel/WorldTestCase.java (renamed from weaver/testsrc/org/aspectj/weaver/bcel/WorldTestCase.java)4
-rw-r--r--weaver/src/test/java/org/aspectj/weaver/bcel/ZipFileWeaver.java (renamed from weaver/testsrc/org/aspectj/weaver/bcel/ZipFileWeaver.java)0
-rw-r--r--weaver/src/test/java/org/aspectj/weaver/bcel/ZipTestCase.java (renamed from weaver/testsrc/org/aspectj/weaver/bcel/ZipTestCase.java)22
-rw-r--r--weaver/src/test/java/org/aspectj/weaver/patterns/AnnotationPatternMatchingTestCase.java (renamed from weaver/testsrc/org/aspectj/weaver/patterns/AnnotationPatternMatchingTestCase.java)4
-rw-r--r--weaver/src/test/java/org/aspectj/weaver/patterns/AnnotationPatternTestCase.java (renamed from weaver/testsrc/org/aspectj/weaver/patterns/AnnotationPatternTestCase.java)4
-rw-r--r--weaver/src/test/java/org/aspectj/weaver/patterns/ConcretizationTestCase.java (renamed from weaver/testsrc/org/aspectj/weaver/patterns/ConcretizationTestCase.java)0
-rw-r--r--weaver/src/test/java/org/aspectj/weaver/patterns/WildTypePatternResolutionTestCase.java (renamed from weaver/testsrc/org/aspectj/weaver/patterns/WildTypePatternResolutionTestCase.java)7
-rw-r--r--weaver/src/test/java/org/aspectj/weaver/patterns/bcel/BcelAndOrNotTestCase.java (renamed from weaver/testsrc/org/aspectj/weaver/patterns/bcel/BcelAndOrNotTestCase.java)0
-rw-r--r--weaver/src/test/java/org/aspectj/weaver/patterns/bcel/BcelBindingTestCase.java (renamed from weaver/testsrc/org/aspectj/weaver/patterns/bcel/BcelBindingTestCase.java)0
-rw-r--r--weaver/src/test/java/org/aspectj/weaver/patterns/bcel/BcelModifiersPatternTestCase.java (renamed from weaver/testsrc/org/aspectj/weaver/patterns/bcel/BcelModifiersPatternTestCase.java)0
-rw-r--r--weaver/src/test/java/org/aspectj/weaver/patterns/bcel/BcelParserTestCase.java (renamed from weaver/testsrc/org/aspectj/weaver/patterns/bcel/BcelParserTestCase.java)4
-rw-r--r--weaver/src/test/java/org/aspectj/weaver/patterns/bcel/BcelSignaturePatternTestCase.java (renamed from weaver/testsrc/org/aspectj/weaver/patterns/bcel/BcelSignaturePatternTestCase.java)0
-rw-r--r--weaver/src/test/java/org/aspectj/weaver/patterns/bcel/BcelTypePatternListTestCase.java (renamed from weaver/testsrc/org/aspectj/weaver/patterns/bcel/BcelTypePatternListTestCase.java)0
-rw-r--r--weaver/src/test/java/org/aspectj/weaver/patterns/bcel/BcelTypePatternTestCase.java (renamed from weaver/testsrc/org/aspectj/weaver/patterns/bcel/BcelTypePatternTestCase.java)0
-rw-r--r--weaver/src/test/java/org/aspectj/weaver/patterns/bcel/BcelWithinTestCase.java (renamed from weaver/testsrc/org/aspectj/weaver/patterns/bcel/BcelWithinTestCase.java)0
-rw-r--r--weaver/src/test/java/org/aspectj/weaver/reflect/ReflectionBasedReferenceTypeDelegateTest.java (renamed from weaver/testsrc/org/aspectj/weaver/reflect/ReflectionBasedReferenceTypeDelegateTest.java)18
-rw-r--r--weaver/src/test/java/org/aspectj/weaver/reflect/ReflectionWorldReferenceTypeTest.java27
-rw-r--r--weaver/src/test/java/org/aspectj/weaver/reflect/ReflectionWorldTest.java290
-rw-r--r--weaver/src/test/java/org/aspectj/weaver/tools/Java15PointcutExpressionTest.java746
-rw-r--r--weaver/src/test/java/org/aspectj/weaver/tools/PointcutDesignatorHandlerTest.java (renamed from weaver/testsrc/org/aspectj/weaver/tools/PointcutDesignatorHandlerTests.java)2
-rw-r--r--weaver/src/test/java/org/aspectj/weaver/tools/PointcutExpressionTest.java (renamed from weaver/testsrc/org/aspectj/weaver/tools/PointcutExpressionTest.java)0
-rw-r--r--weaver/src/test/java/org/aspectj/weaver/tools/PointcutParserTest.java (renamed from weaver/testsrc/org/aspectj/weaver/tools/PointcutParserTest.java)0
-rw-r--r--weaver/src/test/java/org/aspectj/weaver/tools/ReadingAttributesTest.java (renamed from weaver/testsrc/org/aspectj/weaver/tools/ReadingAttributes.java)6
-rw-r--r--weaver/src/test/java/org/aspectj/weaver/tools/TypePatternMatcherTest.java (renamed from weaver/testsrc/org/aspectj/weaver/tools/TypePatternMatcherTest.java)0
-rw-r--r--weaver/src/test/java/org/aspectj/weaver/tools/cache/AbstractCacheBackingTestSupport.java (renamed from weaver/testsrc/org/aspectj/weaver/tools/cache/AbstractCacheBackingTestSupport.java)4
-rw-r--r--weaver/src/test/java/org/aspectj/weaver/tools/cache/AsynchronousFileCacheBackingTestSupport.java (renamed from weaver/testsrc/org/aspectj/weaver/tools/cache/AsynchronousFileCacheBackingTestSupport.java)0
-rw-r--r--weaver/src/test/java/org/aspectj/weaver/tools/cache/DefaultCacheKeyResolverTest.java (renamed from weaver/testsrc/org/aspectj/weaver/tools/cache/DefaultCacheKeyResolverTest.java)0
-rw-r--r--weaver/src/test/java/org/aspectj/weaver/tools/cache/DefaultFileCacheBackingTest.java (renamed from weaver/testsrc/org/aspectj/weaver/tools/cache/DefaultFileCacheBackingTest.java)0
-rw-r--r--weaver/src/test/java/org/aspectj/weaver/tools/cache/FlatFileCacheBackingTest.java147
-rw-r--r--weaver/src/test/java/org/aspectj/weaver/tools/cache/SimpleClassCacheTest.java (renamed from weaver/testsrc/org/aspectj/weaver/tools/cache/SimpleClassCacheTest.java)0
-rw-r--r--weaver/src/test/java/org/aspectj/weaver/tools/cache/WeavedClassCacheTest.java (renamed from weaver/testsrc/org/aspectj/weaver/tools/cache/WeavedClassCacheTest.java)0
-rw-r--r--weaver/src/test/java/org/aspectj/weaver/tools/cache/ZippedFileCacheBackingTest.java (renamed from weaver/testsrc/org/aspectj/weaver/tools/cache/ZippedFileCacheBackingTest.java)0
-rw-r--r--weaver/src/test/java/reflect/tests/C.java (renamed from weaver/testsrc/reflect/tests/C.java)0
-rw-r--r--weaver/src/test/java/test/A.java27
-rw-r--r--weaver/src/test/java/test/A1.java20
-rw-r--r--weaver/src/test/java/test/A1AnnotatedType.java17
-rw-r--r--weaver/src/test/java/test/A2.java20
-rw-r--r--weaver/src/test/java/test/A2AnnotatedType.java17
-rw-r--r--weaver/src/test/java/test/A3.java19
-rw-r--r--weaver/src/test/java/test/AnnoValues.java20
-rw-r--r--weaver/src/test/java/test/Color.java14
-rw-r--r--weaver/testdata/logging.properties60
-rw-r--r--weaver/testsrc/org/aspectj/weaver/BcweaverModuleTests.java41
-rw-r--r--weaver/testsrc/org/aspectj/weaver/bcel/BcelTests.java57
-rw-r--r--weaver/testsrc/org/aspectj/weaver/patterns/bcel/BcelPatternsTests.java46
-rw-r--r--weaver/testsrc/org/aspectj/weaver/tools/ToolsTests.java34
-rw-r--r--weaver/testsrc/org/aspectj/weaver/tools/cache/CacheTests.java31
-rw-r--r--weaver/testsrc/org/aspectj/weaver/tools/cache/FlatFileCacheBackingTest.java154
209 files changed, 4720 insertions, 548 deletions
diff --git a/weaver/.classpath b/weaver/.classpath
index f57afd876..39abf1c5e 100644
--- a/weaver/.classpath
+++ b/weaver/.classpath
@@ -1,18 +1,49 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="src" path="testsrc"/>
- <classpathentry kind="src" path="/runtime"/>
- <classpathentry kind="lib" path="/lib/junit/junit.jar" sourcepath="/lib/junit/src.jar"/>
- <classpathentry kind="src" path="/util"/>
- <classpathentry kind="src" path="/testing-util"/>
- <classpathentry kind="src" path="/bridge"/>
- <classpathentry kind="src" path="/asm"/>
- <classpathentry combineaccessrules="false" kind="src" path="/aspectj5rt"/>
- <classpathentry kind="lib" path="/lib/commons/commons.jar" sourcepath="/lib/commons/commons-src.zip"/>
- <classpathentry kind="lib" path="/lib/bcel/bcel.jar" sourcepath="/lib/bcel/bcel-src.zip"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
- <classpathentry combineaccessrules="false" kind="src" path="/org.aspectj.matcher"/>
- <classpathentry kind="lib" path="/lib/asm/asm-7.0-beta.renamed.jar"/>
- <classpathentry kind="output" path="bin"/>
+ <classpathentry kind="src" output="target/classes" path="src/main/java">
+ <attributes>
+ <attribute name="optional" value="true"/>
+ <attribute name="maven.pomderived" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
+ <attributes>
+ <attribute name="maven.pomderived" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="src" output="target/test-classes" path="src/test/java">
+ <attributes>
+ <attribute name="optional" value="true"/>
+ <attribute name="maven.pomderived" value="true"/>
+ <attribute name="test" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
+ <attributes>
+ <attribute name="maven.pomderived" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
+ <attributes>
+ <attribute name="maven.pomderived" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="src" path="target/generated-sources/annotations">
+ <attributes>
+ <attribute name="optional" value="true"/>
+ <attribute name="maven.pomderived" value="true"/>
+ <attribute name="ignore_optional_problems" value="true"/>
+ <attribute name="m2e-apt" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="src" output="target/test-classes" path="target/generated-test-sources/test-annotations">
+ <attributes>
+ <attribute name="optional" value="true"/>
+ <attribute name="maven.pomderived" value="true"/>
+ <attribute name="ignore_optional_problems" value="true"/>
+ <attribute name="m2e-apt" value="true"/>
+ <attribute name="test" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="output" path="target/classes"/>
</classpath>
diff --git a/weaver/.cvsignore b/weaver/.cvsignore
deleted file mode 100644
index e1b17a04f..000000000
--- a/weaver/.cvsignore
+++ /dev/null
@@ -1,6 +0,0 @@
-out
-bin
-default.lst
-default.ajsym
-.clover
-bintest
diff --git a/weaver/.isJava5 b/weaver/.isJava5
deleted file mode 100644
index 136d06384..000000000
--- a/weaver/.isJava5
+++ /dev/null
@@ -1 +0,0 @@
- \ No newline at end of file
diff --git a/weaver/.project b/weaver/.project
index 940c812a5..06733878f 100644
--- a/weaver/.project
+++ b/weaver/.project
@@ -3,11 +3,6 @@
<name>weaver</name>
<comment></comment>
<projects>
- <project>asm</project>
- <project>bridge</project>
- <project>runtime</project>
- <project>testing-util</project>
- <project>util</project>
</projects>
<buildSpec>
<buildCommand>
@@ -15,8 +10,14 @@
<arguments>
</arguments>
</buildCommand>
+ <buildCommand>
+ <name>org.eclipse.m2e.core.maven2Builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.eclipse.m2e.core.maven2Nature</nature>
</natures>
</projectDescription>
diff --git a/weaver/.settings/org.eclipse.core.resources.prefs b/weaver/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 000000000..839d647ee
--- /dev/null
+++ b/weaver/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,5 @@
+eclipse.preferences.version=1
+encoding//src/main/java=UTF-8
+encoding//src/main/resources=UTF-8
+encoding//src/test/java=UTF-8
+encoding/<project>=UTF-8
diff --git a/weaver/.settings/org.eclipse.jdt.apt.core.prefs b/weaver/.settings/org.eclipse.jdt.apt.core.prefs
new file mode 100644
index 000000000..d4313d4b2
--- /dev/null
+++ b/weaver/.settings/org.eclipse.jdt.apt.core.prefs
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.apt.aptEnabled=false
diff --git a/weaver/.settings/org.eclipse.jdt.core.prefs b/weaver/.settings/org.eclipse.jdt.core.prefs
index 7341ab168..5592a0a1c 100644
--- a/weaver/.settings/org.eclipse.jdt.core.prefs
+++ b/weaver/.settings/org.eclipse.jdt.core.prefs
@@ -1,11 +1,7 @@
eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
-org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.7
-org.eclipse.jdt.core.compiler.debug.lineNumber=generate
-org.eclipse.jdt.core.compiler.debug.localVariable=generate
-org.eclipse.jdt.core.compiler.debug.sourceFile=generate
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.source=1.7
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
+org.eclipse.jdt.core.compiler.compliance=1.8
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
+org.eclipse.jdt.core.compiler.processAnnotations=disabled
+org.eclipse.jdt.core.compiler.release=disabled
+org.eclipse.jdt.core.compiler.source=1.8
diff --git a/weaver/.settings/org.eclipse.jdt.ui.prefs b/weaver/.settings/org.eclipse.jdt.ui.prefs
deleted file mode 100644
index e591fe798..000000000
--- a/weaver/.settings/org.eclipse.jdt.ui.prefs
+++ /dev/null
@@ -1,3 +0,0 @@
-#Thu Sep 22 08:32:30 PDT 2005
-eclipse.preferences.version=1
-internal.default.compliance=default
diff --git a/weaver/.settings/org.eclipse.m2e.core.prefs b/weaver/.settings/org.eclipse.m2e.core.prefs
new file mode 100644
index 000000000..f897a7f1c
--- /dev/null
+++ b/weaver/.settings/org.eclipse.m2e.core.prefs
@@ -0,0 +1,4 @@
+activeProfiles=
+eclipse.preferences.version=1
+resolveWorkspaceProjects=true
+version=1
diff --git a/weaver/build.xml b/weaver/build.xml
deleted file mode 100644
index 90934da23..000000000
--- a/weaver/build.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-<?xml version="1.0"?>
-<!-- see ../build/*.html for explanation -->
-<project name="weaver" default="test" basedir=".">
- <import file="${basedir}/../build/build.xml"/>
-</project>
-
diff --git a/weaver/pom.xml b/weaver/pom.xml
new file mode 100644
index 000000000..930fcfa5e
--- /dev/null
+++ b/weaver/pom.xml
@@ -0,0 +1,85 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.aspectj</groupId>
+ <artifactId>aspectj-parent</artifactId>
+ <version>1.9.3.BUILD-SNAPSHOT</version>
+ <relativePath>..</relativePath>
+ </parent>
+
+ <artifactId>weaver</artifactId>
+ <packaging>jar</packaging>
+ <name>weaver</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.aspectj</groupId>
+ <artifactId>util</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.aspectj</groupId>
+ <artifactId>runtime</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.aspectj</groupId>
+ <artifactId>util</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.aspectj</groupId>
+ <artifactId>testing-util</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.aspectj</groupId>
+ <artifactId>bridge</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.aspectj</groupId>
+ <artifactId>asm</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.aspectj</groupId>
+ <artifactId>org.aspectj.matcher</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.aspectj</groupId>
+ <artifactId>runtime</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.aspectj</groupId>
+ <artifactId>org.aspectj.matcher</artifactId>
+ <version>${project.version}</version>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.aspectj</groupId>
+ <artifactId>bcel-builder</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>commons</groupId>
+ <artifactId>commons</artifactId>
+ <version>1.0</version>
+ <scope>system</scope>
+ <systemPath>${project.basedir}/../lib/commons/commons.jar</systemPath>
+ </dependency>
+ <dependency>
+ <groupId>asm</groupId>
+ <artifactId>asm</artifactId>
+ <version>1.0</version>
+ <scope>system</scope>
+ <systemPath>${project.basedir}/../lib/asm/asm-7.0-beta.renamed.jar</systemPath>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/weaver/src/org/aspectj/weaver/IClassFileProvider.java b/weaver/src/main/java/org/aspectj/weaver/IClassFileProvider.java
index 029bba7c6..029bba7c6 100644
--- a/weaver/src/org/aspectj/weaver/IClassFileProvider.java
+++ b/weaver/src/main/java/org/aspectj/weaver/IClassFileProvider.java
diff --git a/weaver/src/org/aspectj/weaver/bcel/AnnotationAccessFieldVar.java b/weaver/src/main/java/org/aspectj/weaver/bcel/AnnotationAccessFieldVar.java
index 60aa84125..60aa84125 100644
--- a/weaver/src/org/aspectj/weaver/bcel/AnnotationAccessFieldVar.java
+++ b/weaver/src/main/java/org/aspectj/weaver/bcel/AnnotationAccessFieldVar.java
diff --git a/weaver/src/org/aspectj/weaver/bcel/AnnotationAccessVar.java b/weaver/src/main/java/org/aspectj/weaver/bcel/AnnotationAccessVar.java
index 88a67d666..88a67d666 100644
--- a/weaver/src/org/aspectj/weaver/bcel/AnnotationAccessVar.java
+++ b/weaver/src/main/java/org/aspectj/weaver/bcel/AnnotationAccessVar.java
diff --git a/weaver/src/org/aspectj/weaver/bcel/AspectInstanceVar.java b/weaver/src/main/java/org/aspectj/weaver/bcel/AspectInstanceVar.java
index 37633b71f..37633b71f 100644
--- a/weaver/src/org/aspectj/weaver/bcel/AspectInstanceVar.java
+++ b/weaver/src/main/java/org/aspectj/weaver/bcel/AspectInstanceVar.java
diff --git a/weaver/src/org/aspectj/weaver/bcel/AtAjAttributes.java b/weaver/src/main/java/org/aspectj/weaver/bcel/AtAjAttributes.java
index 2da044c11..2da044c11 100644
--- a/weaver/src/org/aspectj/weaver/bcel/AtAjAttributes.java
+++ b/weaver/src/main/java/org/aspectj/weaver/bcel/AtAjAttributes.java
diff --git a/weaver/src/org/aspectj/weaver/bcel/BcelAccessForInlineMunger.java b/weaver/src/main/java/org/aspectj/weaver/bcel/BcelAccessForInlineMunger.java
index b81f7ffb1..b81f7ffb1 100644
--- a/weaver/src/org/aspectj/weaver/bcel/BcelAccessForInlineMunger.java
+++ b/weaver/src/main/java/org/aspectj/weaver/bcel/BcelAccessForInlineMunger.java
diff --git a/weaver/src/org/aspectj/weaver/bcel/BcelAdvice.java b/weaver/src/main/java/org/aspectj/weaver/bcel/BcelAdvice.java
index d22b17d12..d22b17d12 100644
--- a/weaver/src/org/aspectj/weaver/bcel/BcelAdvice.java
+++ b/weaver/src/main/java/org/aspectj/weaver/bcel/BcelAdvice.java
diff --git a/weaver/src/org/aspectj/weaver/bcel/BcelAnnotation.java b/weaver/src/main/java/org/aspectj/weaver/bcel/BcelAnnotation.java
index 275eae512..275eae512 100644
--- a/weaver/src/org/aspectj/weaver/bcel/BcelAnnotation.java
+++ b/weaver/src/main/java/org/aspectj/weaver/bcel/BcelAnnotation.java
diff --git a/weaver/src/org/aspectj/weaver/bcel/BcelCflowAccessVar.java b/weaver/src/main/java/org/aspectj/weaver/bcel/BcelCflowAccessVar.java
index 2640edd95..2640edd95 100644
--- a/weaver/src/org/aspectj/weaver/bcel/BcelCflowAccessVar.java
+++ b/weaver/src/main/java/org/aspectj/weaver/bcel/BcelCflowAccessVar.java
diff --git a/weaver/src/org/aspectj/weaver/bcel/BcelCflowCounterFieldAdder.java b/weaver/src/main/java/org/aspectj/weaver/bcel/BcelCflowCounterFieldAdder.java
index a70a5d8a9..a70a5d8a9 100644
--- a/weaver/src/org/aspectj/weaver/bcel/BcelCflowCounterFieldAdder.java
+++ b/weaver/src/main/java/org/aspectj/weaver/bcel/BcelCflowCounterFieldAdder.java
diff --git a/weaver/src/org/aspectj/weaver/bcel/BcelCflowStackFieldAdder.java b/weaver/src/main/java/org/aspectj/weaver/bcel/BcelCflowStackFieldAdder.java
index 455edd174..455edd174 100644
--- a/weaver/src/org/aspectj/weaver/bcel/BcelCflowStackFieldAdder.java
+++ b/weaver/src/main/java/org/aspectj/weaver/bcel/BcelCflowStackFieldAdder.java
diff --git a/weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java b/weaver/src/main/java/org/aspectj/weaver/bcel/BcelClassWeaver.java
index 83919ed50..83919ed50 100644
--- a/weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
+++ b/weaver/src/main/java/org/aspectj/weaver/bcel/BcelClassWeaver.java
diff --git a/weaver/src/org/aspectj/weaver/bcel/BcelConstantPoolReader.java b/weaver/src/main/java/org/aspectj/weaver/bcel/BcelConstantPoolReader.java
index 2deaf57c1..2deaf57c1 100644
--- a/weaver/src/org/aspectj/weaver/bcel/BcelConstantPoolReader.java
+++ b/weaver/src/main/java/org/aspectj/weaver/bcel/BcelConstantPoolReader.java
diff --git a/weaver/src/org/aspectj/weaver/bcel/BcelConstantPoolWriter.java b/weaver/src/main/java/org/aspectj/weaver/bcel/BcelConstantPoolWriter.java
index 634764901..634764901 100644
--- a/weaver/src/org/aspectj/weaver/bcel/BcelConstantPoolWriter.java
+++ b/weaver/src/main/java/org/aspectj/weaver/bcel/BcelConstantPoolWriter.java
diff --git a/weaver/src/org/aspectj/weaver/bcel/BcelField.java b/weaver/src/main/java/org/aspectj/weaver/bcel/BcelField.java
index c88e8519f..c88e8519f 100644
--- a/weaver/src/org/aspectj/weaver/bcel/BcelField.java
+++ b/weaver/src/main/java/org/aspectj/weaver/bcel/BcelField.java
diff --git a/weaver/src/org/aspectj/weaver/bcel/BcelFieldRef.java b/weaver/src/main/java/org/aspectj/weaver/bcel/BcelFieldRef.java
index a5a2a79ec..a5a2a79ec 100644
--- a/weaver/src/org/aspectj/weaver/bcel/BcelFieldRef.java
+++ b/weaver/src/main/java/org/aspectj/weaver/bcel/BcelFieldRef.java
diff --git a/weaver/src/org/aspectj/weaver/bcel/BcelGenericSignatureToTypeXConverter.java b/weaver/src/main/java/org/aspectj/weaver/bcel/BcelGenericSignatureToTypeXConverter.java
index 9b4c90cbc..9b4c90cbc 100644
--- a/weaver/src/org/aspectj/weaver/bcel/BcelGenericSignatureToTypeXConverter.java
+++ b/weaver/src/main/java/org/aspectj/weaver/bcel/BcelGenericSignatureToTypeXConverter.java
diff --git a/weaver/src/org/aspectj/weaver/bcel/BcelMethod.java b/weaver/src/main/java/org/aspectj/weaver/bcel/BcelMethod.java
index d1e60e1c7..d1e60e1c7 100644
--- a/weaver/src/org/aspectj/weaver/bcel/BcelMethod.java
+++ b/weaver/src/main/java/org/aspectj/weaver/bcel/BcelMethod.java
diff --git a/weaver/src/org/aspectj/weaver/bcel/BcelObjectType.java b/weaver/src/main/java/org/aspectj/weaver/bcel/BcelObjectType.java
index 710eb6dc7..710eb6dc7 100644
--- a/weaver/src/org/aspectj/weaver/bcel/BcelObjectType.java
+++ b/weaver/src/main/java/org/aspectj/weaver/bcel/BcelObjectType.java
diff --git a/weaver/src/org/aspectj/weaver/bcel/BcelPerClauseAspectAdder.java b/weaver/src/main/java/org/aspectj/weaver/bcel/BcelPerClauseAspectAdder.java
index b8ede0a9a..b8ede0a9a 100644
--- a/weaver/src/org/aspectj/weaver/bcel/BcelPerClauseAspectAdder.java
+++ b/weaver/src/main/java/org/aspectj/weaver/bcel/BcelPerClauseAspectAdder.java
diff --git a/weaver/src/org/aspectj/weaver/bcel/BcelRenderer.java b/weaver/src/main/java/org/aspectj/weaver/bcel/BcelRenderer.java
index e1f99439f..e1f99439f 100644
--- a/weaver/src/org/aspectj/weaver/bcel/BcelRenderer.java
+++ b/weaver/src/main/java/org/aspectj/weaver/bcel/BcelRenderer.java
diff --git a/weaver/src/org/aspectj/weaver/bcel/BcelShadow.java b/weaver/src/main/java/org/aspectj/weaver/bcel/BcelShadow.java
index c93a0f26e..c93a0f26e 100644
--- a/weaver/src/org/aspectj/weaver/bcel/BcelShadow.java
+++ b/weaver/src/main/java/org/aspectj/weaver/bcel/BcelShadow.java
diff --git a/weaver/src/org/aspectj/weaver/bcel/BcelTypeMunger.java b/weaver/src/main/java/org/aspectj/weaver/bcel/BcelTypeMunger.java
index b92760fe9..b92760fe9 100644
--- a/weaver/src/org/aspectj/weaver/bcel/BcelTypeMunger.java
+++ b/weaver/src/main/java/org/aspectj/weaver/bcel/BcelTypeMunger.java
diff --git a/weaver/src/org/aspectj/weaver/bcel/BcelVar.java b/weaver/src/main/java/org/aspectj/weaver/bcel/BcelVar.java
index ce45fdf12..ce45fdf12 100644
--- a/weaver/src/org/aspectj/weaver/bcel/BcelVar.java
+++ b/weaver/src/main/java/org/aspectj/weaver/bcel/BcelVar.java
diff --git a/weaver/src/org/aspectj/weaver/bcel/BcelWeakClassLoaderReference.java b/weaver/src/main/java/org/aspectj/weaver/bcel/BcelWeakClassLoaderReference.java
index aac294fa4..aac294fa4 100644
--- a/weaver/src/org/aspectj/weaver/bcel/BcelWeakClassLoaderReference.java
+++ b/weaver/src/main/java/org/aspectj/weaver/bcel/BcelWeakClassLoaderReference.java
diff --git a/weaver/src/org/aspectj/weaver/bcel/BcelWeaver.java b/weaver/src/main/java/org/aspectj/weaver/bcel/BcelWeaver.java
index f83a79379..f83a79379 100644
--- a/weaver/src/org/aspectj/weaver/bcel/BcelWeaver.java
+++ b/weaver/src/main/java/org/aspectj/weaver/bcel/BcelWeaver.java
diff --git a/weaver/src/org/aspectj/weaver/bcel/BcelWeavingSupport.java b/weaver/src/main/java/org/aspectj/weaver/bcel/BcelWeavingSupport.java
index 120df80c2..120df80c2 100644
--- a/weaver/src/org/aspectj/weaver/bcel/BcelWeavingSupport.java
+++ b/weaver/src/main/java/org/aspectj/weaver/bcel/BcelWeavingSupport.java
diff --git a/weaver/src/org/aspectj/weaver/bcel/BcelWorld.java b/weaver/src/main/java/org/aspectj/weaver/bcel/BcelWorld.java
index 4ade1e125..4ade1e125 100644
--- a/weaver/src/org/aspectj/weaver/bcel/BcelWorld.java
+++ b/weaver/src/main/java/org/aspectj/weaver/bcel/BcelWorld.java
diff --git a/weaver/src/org/aspectj/weaver/bcel/ClassPathManager.java b/weaver/src/main/java/org/aspectj/weaver/bcel/ClassPathManager.java
index f8a36ba98..b20911245 100644
--- a/weaver/src/org/aspectj/weaver/bcel/ClassPathManager.java
+++ b/weaver/src/main/java/org/aspectj/weaver/bcel/ClassPathManager.java
@@ -97,8 +97,7 @@ public class ClassPathManager {
if (!f.isDirectory()) {
if (!f.isFile()) {
if (!lc.endsWith(".jar") || lc.endsWith(".zip")) {
- // heuristic-only: ending with .jar or .zip means probably a
- // zip file
+ // heuristic-only: ending with .jar or .zip means probably a zip file
MessageUtil.info(handler, WeaverMessages.format(WeaverMessages.ZIPFILE_ENTRY_MISSING, name));
} else {
MessageUtil.info(handler, WeaverMessages.format(WeaverMessages.DIRECTORY_ENTRY_MISSING, name));
diff --git a/weaver/src/org/aspectj/weaver/bcel/ExceptionRange.java b/weaver/src/main/java/org/aspectj/weaver/bcel/ExceptionRange.java
index 5e74627c3..5e74627c3 100644
--- a/weaver/src/org/aspectj/weaver/bcel/ExceptionRange.java
+++ b/weaver/src/main/java/org/aspectj/weaver/bcel/ExceptionRange.java
diff --git a/weaver/src/org/aspectj/weaver/bcel/ExtensibleURLClassLoader.java b/weaver/src/main/java/org/aspectj/weaver/bcel/ExtensibleURLClassLoader.java
index 3480b8172..3480b8172 100644
--- a/weaver/src/org/aspectj/weaver/bcel/ExtensibleURLClassLoader.java
+++ b/weaver/src/main/java/org/aspectj/weaver/bcel/ExtensibleURLClassLoader.java
diff --git a/weaver/src/org/aspectj/weaver/bcel/FakeAnnotation.java b/weaver/src/main/java/org/aspectj/weaver/bcel/FakeAnnotation.java
index 4194e66e9..4194e66e9 100644
--- a/weaver/src/org/aspectj/weaver/bcel/FakeAnnotation.java
+++ b/weaver/src/main/java/org/aspectj/weaver/bcel/FakeAnnotation.java
diff --git a/weaver/src/org/aspectj/weaver/bcel/IfFinder.java b/weaver/src/main/java/org/aspectj/weaver/bcel/IfFinder.java
index c66aa8939..c66aa8939 100644
--- a/weaver/src/org/aspectj/weaver/bcel/IfFinder.java
+++ b/weaver/src/main/java/org/aspectj/weaver/bcel/IfFinder.java
diff --git a/weaver/src/org/aspectj/weaver/bcel/LazyClassGen.java b/weaver/src/main/java/org/aspectj/weaver/bcel/LazyClassGen.java
index 83189e1d4..83189e1d4 100644
--- a/weaver/src/org/aspectj/weaver/bcel/LazyClassGen.java
+++ b/weaver/src/main/java/org/aspectj/weaver/bcel/LazyClassGen.java
diff --git a/weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java b/weaver/src/main/java/org/aspectj/weaver/bcel/LazyMethodGen.java
index 2655a3456..2655a3456 100644
--- a/weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java
+++ b/weaver/src/main/java/org/aspectj/weaver/bcel/LazyMethodGen.java
diff --git a/weaver/src/org/aspectj/weaver/bcel/Range.java b/weaver/src/main/java/org/aspectj/weaver/bcel/Range.java
index fa162c526..fa162c526 100644
--- a/weaver/src/org/aspectj/weaver/bcel/Range.java
+++ b/weaver/src/main/java/org/aspectj/weaver/bcel/Range.java
diff --git a/weaver/src/org/aspectj/weaver/bcel/ShadowRange.java b/weaver/src/main/java/org/aspectj/weaver/bcel/ShadowRange.java
index 47c8400c5..47c8400c5 100644
--- a/weaver/src/org/aspectj/weaver/bcel/ShadowRange.java
+++ b/weaver/src/main/java/org/aspectj/weaver/bcel/ShadowRange.java
diff --git a/weaver/src/org/aspectj/weaver/bcel/TypeAnnotationAccessVar.java b/weaver/src/main/java/org/aspectj/weaver/bcel/TypeAnnotationAccessVar.java
index e23174389..e23174389 100644
--- a/weaver/src/org/aspectj/weaver/bcel/TypeAnnotationAccessVar.java
+++ b/weaver/src/main/java/org/aspectj/weaver/bcel/TypeAnnotationAccessVar.java
diff --git a/weaver/src/org/aspectj/weaver/bcel/TypeDelegateResolver.java b/weaver/src/main/java/org/aspectj/weaver/bcel/TypeDelegateResolver.java
index 2a29c927a..2a29c927a 100644
--- a/weaver/src/org/aspectj/weaver/bcel/TypeDelegateResolver.java
+++ b/weaver/src/main/java/org/aspectj/weaver/bcel/TypeDelegateResolver.java
diff --git a/weaver/src/org/aspectj/weaver/bcel/UnwovenClassFile.java b/weaver/src/main/java/org/aspectj/weaver/bcel/UnwovenClassFile.java
index 7076316f7..7076316f7 100644
--- a/weaver/src/org/aspectj/weaver/bcel/UnwovenClassFile.java
+++ b/weaver/src/main/java/org/aspectj/weaver/bcel/UnwovenClassFile.java
diff --git a/weaver/src/org/aspectj/weaver/bcel/UnwovenClassFileWithThirdPartyManagedBytecode.java b/weaver/src/main/java/org/aspectj/weaver/bcel/UnwovenClassFileWithThirdPartyManagedBytecode.java
index 18edc8413..18edc8413 100644
--- a/weaver/src/org/aspectj/weaver/bcel/UnwovenClassFileWithThirdPartyManagedBytecode.java
+++ b/weaver/src/main/java/org/aspectj/weaver/bcel/UnwovenClassFileWithThirdPartyManagedBytecode.java
diff --git a/weaver/src/org/aspectj/weaver/bcel/Utility.java b/weaver/src/main/java/org/aspectj/weaver/bcel/Utility.java
index 4acf032fc..4acf032fc 100644
--- a/weaver/src/org/aspectj/weaver/bcel/Utility.java
+++ b/weaver/src/main/java/org/aspectj/weaver/bcel/Utility.java
diff --git a/weaver/src/org/aspectj/weaver/bcel/asm/AsmDetector.java b/weaver/src/main/java/org/aspectj/weaver/bcel/asm/AsmDetector.java
index 5d5bb6990..5d5bb6990 100644
--- a/weaver/src/org/aspectj/weaver/bcel/asm/AsmDetector.java
+++ b/weaver/src/main/java/org/aspectj/weaver/bcel/asm/AsmDetector.java
diff --git a/weaver/src/org/aspectj/weaver/bcel/asm/StackMapAdder.java b/weaver/src/main/java/org/aspectj/weaver/bcel/asm/StackMapAdder.java
index dd3965b61..dd3965b61 100644
--- a/weaver/src/org/aspectj/weaver/bcel/asm/StackMapAdder.java
+++ b/weaver/src/main/java/org/aspectj/weaver/bcel/asm/StackMapAdder.java
diff --git a/weaver/src/org/aspectj/weaver/loadtime/IWeavingContext.java b/weaver/src/main/java/org/aspectj/weaver/loadtime/IWeavingContext.java
index 51b781e86..51b781e86 100644
--- a/weaver/src/org/aspectj/weaver/loadtime/IWeavingContext.java
+++ b/weaver/src/main/java/org/aspectj/weaver/loadtime/IWeavingContext.java
diff --git a/weaver/src/org/aspectj/weaver/loadtime/definition/Definition.java b/weaver/src/main/java/org/aspectj/weaver/loadtime/definition/Definition.java
index de780156e..de780156e 100644
--- a/weaver/src/org/aspectj/weaver/loadtime/definition/Definition.java
+++ b/weaver/src/main/java/org/aspectj/weaver/loadtime/definition/Definition.java
diff --git a/weaver/src/org/aspectj/weaver/loadtime/definition/DocumentParser.java b/weaver/src/main/java/org/aspectj/weaver/loadtime/definition/DocumentParser.java
index 7ff275fd7..7ff275fd7 100644
--- a/weaver/src/org/aspectj/weaver/loadtime/definition/DocumentParser.java
+++ b/weaver/src/main/java/org/aspectj/weaver/loadtime/definition/DocumentParser.java
diff --git a/weaver/src/org/aspectj/weaver/loadtime/definition/LightXMLParser.java b/weaver/src/main/java/org/aspectj/weaver/loadtime/definition/LightXMLParser.java
index 09a9df96f..09a9df96f 100644
--- a/weaver/src/org/aspectj/weaver/loadtime/definition/LightXMLParser.java
+++ b/weaver/src/main/java/org/aspectj/weaver/loadtime/definition/LightXMLParser.java
diff --git a/weaver/src/org/aspectj/weaver/loadtime/definition/SimpleAOPParser.java b/weaver/src/main/java/org/aspectj/weaver/loadtime/definition/SimpleAOPParser.java
index bcd6ddcd0..bcd6ddcd0 100644
--- a/weaver/src/org/aspectj/weaver/loadtime/definition/SimpleAOPParser.java
+++ b/weaver/src/main/java/org/aspectj/weaver/loadtime/definition/SimpleAOPParser.java
diff --git a/weaver/src/org/aspectj/weaver/ltw/LTWWorld.java b/weaver/src/main/java/org/aspectj/weaver/ltw/LTWWorld.java
index de5a4d854..de5a4d854 100644
--- a/weaver/src/org/aspectj/weaver/ltw/LTWWorld.java
+++ b/weaver/src/main/java/org/aspectj/weaver/ltw/LTWWorld.java
diff --git a/weaver/src/org/aspectj/weaver/model/AsmRelationshipProvider.java b/weaver/src/main/java/org/aspectj/weaver/model/AsmRelationshipProvider.java
index 5801397a8..5801397a8 100644
--- a/weaver/src/org/aspectj/weaver/model/AsmRelationshipProvider.java
+++ b/weaver/src/main/java/org/aspectj/weaver/model/AsmRelationshipProvider.java
diff --git a/weaver/src/org/aspectj/weaver/model/AsmRelationshipUtils.java b/weaver/src/main/java/org/aspectj/weaver/model/AsmRelationshipUtils.java
index f9c9f6ae2..f9c9f6ae2 100644
--- a/weaver/src/org/aspectj/weaver/model/AsmRelationshipUtils.java
+++ b/weaver/src/main/java/org/aspectj/weaver/model/AsmRelationshipUtils.java
diff --git a/weaver/src/main/java/org/aspectj/weaver/reflect/ArgNameFinder.java b/weaver/src/main/java/org/aspectj/weaver/reflect/ArgNameFinder.java
new file mode 100644
index 000000000..25945a90a
--- /dev/null
+++ b/weaver/src/main/java/org/aspectj/weaver/reflect/ArgNameFinder.java
@@ -0,0 +1,26 @@
+/* *******************************************************************
+ * Copyright (c) 2005-2017 Contributors.
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://eclipse.org/legal/epl-v10.html
+ * ******************************************************************/
+package org.aspectj.weaver.reflect;
+
+import java.lang.reflect.Member;
+
+/**
+ * @author Adrian Colyer
+ * @author Andy Clement
+ */
+public interface ArgNameFinder {
+
+ /**
+ * Attempt to discover the parameter names for a reflectively obtained member.
+ * @param forMember the member for which parameter names are being looked up
+ * @return parameter names or null if names can't be determined
+ */
+ String[] getParameterNames(Member forMember);
+
+}
diff --git a/weaver/src/main/java/org/aspectj/weaver/reflect/DeferredResolvedPointcutDefinition.java b/weaver/src/main/java/org/aspectj/weaver/reflect/DeferredResolvedPointcutDefinition.java
new file mode 100644
index 000000000..b0af93f16
--- /dev/null
+++ b/weaver/src/main/java/org/aspectj/weaver/reflect/DeferredResolvedPointcutDefinition.java
@@ -0,0 +1,35 @@
+/* *******************************************************************
+ * Copyright (c) 2006 Contributors.
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Adrian Colyer Initial implementation
+ * ******************************************************************/
+
+package org.aspectj.weaver.reflect;
+
+import org.aspectj.weaver.ResolvedPointcutDefinition;
+import org.aspectj.weaver.UnresolvedType;
+
+/**
+ * When a Java15ReflectionBasedDelegate gets the pointcuts for a given class it tries to resolve them before returning. This can
+ * cause problems if the resolution of one pointcut in the type depends on another pointcut in the same type. Therefore the
+ * algorithm proceeds in two phases, first we create and store instances of this class in the pointcuts array, and once that is
+ * done, we come back round and resolve the actual pointcut expression. This means that if we recurse doing resolution, we will find
+ * the named pointcut we are looking for!
+ *
+ * @author adrian colyer
+ *
+ */
+public class DeferredResolvedPointcutDefinition extends ResolvedPointcutDefinition {
+
+ public DeferredResolvedPointcutDefinition(UnresolvedType declaringType, int modifiers, String name,
+ UnresolvedType[] parameterTypes) {
+ super(declaringType, modifiers, name, parameterTypes, UnresolvedType.VOID, null);
+ }
+
+}
diff --git a/weaver/src/main/java/org/aspectj/weaver/reflect/InternalUseOnlyPointcutParser.java b/weaver/src/main/java/org/aspectj/weaver/reflect/InternalUseOnlyPointcutParser.java
new file mode 100644
index 000000000..8d81d7b08
--- /dev/null
+++ b/weaver/src/main/java/org/aspectj/weaver/reflect/InternalUseOnlyPointcutParser.java
@@ -0,0 +1,43 @@
+/* *******************************************************************
+ * Copyright (c) 2006 Contributors.
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Adrian Colyer Initial implementation
+ * ******************************************************************/
+
+package org.aspectj.weaver.reflect;
+
+import org.aspectj.weaver.patterns.Pointcut;
+import org.aspectj.weaver.tools.PointcutParameter;
+import org.aspectj.weaver.tools.PointcutParser;
+
+public class InternalUseOnlyPointcutParser extends PointcutParser {
+
+ public InternalUseOnlyPointcutParser(ClassLoader classLoader, ReflectionWorld world) {
+ super();
+ setClassLoader(classLoader);
+ setWorld(world);
+ }
+
+ public InternalUseOnlyPointcutParser(ClassLoader classLoader) {
+ super();
+ setClassLoader(classLoader);
+ }
+
+ public Pointcut resolvePointcutExpression(
+ String expression,
+ Class inScope,
+ PointcutParameter[] formalParameters) {
+ return super.resolvePointcutExpression(expression, inScope, formalParameters);
+ }
+
+ public Pointcut concretizePointcutExpression(Pointcut pc, Class inScope, PointcutParameter[] formalParameters) {
+ return super.concretizePointcutExpression(pc, inScope, formalParameters);
+ }
+
+}
diff --git a/weaver/src/main/java/org/aspectj/weaver/reflect/Java15AnnotationFinder.java b/weaver/src/main/java/org/aspectj/weaver/reflect/Java15AnnotationFinder.java
new file mode 100644
index 000000000..016becf87
--- /dev/null
+++ b/weaver/src/main/java/org/aspectj/weaver/reflect/Java15AnnotationFinder.java
@@ -0,0 +1,386 @@
+/* *******************************************************************
+ * Copyright (c) 2005, 2017 Contributors.
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://eclipse.org/legal/epl-v10.html
+ * ******************************************************************/
+package org.aspectj.weaver.reflect;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.AccessibleObject;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
+import java.lang.reflect.Member;
+import java.lang.reflect.Method;
+
+import org.aspectj.apache.bcel.classfile.AnnotationDefault;
+import org.aspectj.apache.bcel.classfile.Attribute;
+import org.aspectj.apache.bcel.classfile.JavaClass;
+import org.aspectj.apache.bcel.classfile.LocalVariable;
+import org.aspectj.apache.bcel.classfile.LocalVariableTable;
+import org.aspectj.apache.bcel.util.ClassLoaderRepository;
+import org.aspectj.apache.bcel.util.NonCachingClassLoaderRepository;
+import org.aspectj.apache.bcel.util.Repository;
+import org.aspectj.weaver.AnnotationAJ;
+import org.aspectj.weaver.ResolvedType;
+import org.aspectj.weaver.UnresolvedType;
+import org.aspectj.weaver.World;
+import org.aspectj.weaver.bcel.BcelAnnotation;
+import org.aspectj.weaver.bcel.BcelWeakClassLoaderReference;
+
+/**
+ *
+ * @author Adrian Colyer
+ * @author Andy Clement
+ */
+public class Java15AnnotationFinder implements AnnotationFinder, ArgNameFinder {
+
+ public static final ResolvedType[][] NO_PARAMETER_ANNOTATIONS = new ResolvedType[][] {};
+
+ private Repository bcelRepository;
+ private BcelWeakClassLoaderReference classLoaderRef;
+ private World world;
+ private static boolean useCachingClassLoaderRepository;
+
+ static {
+ try {
+ useCachingClassLoaderRepository = System.getProperty("Xset:bcelRepositoryCaching","true").equalsIgnoreCase("true");
+ } catch (Throwable t) {
+ useCachingClassLoaderRepository = false;
+ }
+ }
+
+ // must have no-arg constructor for reflective construction
+ public Java15AnnotationFinder() {
+ }
+
+ public void setClassLoader(ClassLoader aLoader) {
+ this.classLoaderRef = new BcelWeakClassLoaderReference(aLoader);
+ if (useCachingClassLoaderRepository) {
+ this.bcelRepository = new ClassLoaderRepository(classLoaderRef);
+ } else {
+ this.bcelRepository = new NonCachingClassLoaderRepository(classLoaderRef);
+ }
+ }
+
+ public void setWorld(World aWorld) {
+ this.world = aWorld;
+ }
+
+ public Object getAnnotation(ResolvedType annotationType, Object onObject) {
+ try {
+ Class<? extends Annotation> annotationClass = (Class<? extends Annotation>) Class.forName(annotationType.getName(),
+ false, getClassLoader());
+ if (onObject.getClass().isAnnotationPresent(annotationClass)) {
+ return onObject.getClass().getAnnotation(annotationClass);
+ }
+ } catch (ClassNotFoundException ex) {
+ // just return null
+ }
+ return null;
+ }
+
+ public Object getAnnotationFromClass(ResolvedType annotationType, Class aClass) {
+ try {
+ Class<? extends Annotation> annotationClass = (Class<? extends Annotation>) Class.forName(annotationType.getName(),
+ false, getClassLoader());
+ if (aClass.isAnnotationPresent(annotationClass)) {
+ return aClass.getAnnotation(annotationClass);
+ }
+ } catch (ClassNotFoundException ex) {
+ // just return null
+ }
+ return null;
+ }
+
+ public Object getAnnotationFromMember(ResolvedType annotationType, Member aMember) {
+ if (!(aMember instanceof AccessibleObject))
+ return null;
+ AccessibleObject ao = (AccessibleObject) aMember;
+ try {
+ Class annotationClass = Class.forName(annotationType.getName(), false, getClassLoader());
+ if (ao.isAnnotationPresent(annotationClass)) {
+ return ao.getAnnotation(annotationClass);
+ }
+ } catch (ClassNotFoundException ex) {
+ // just return null
+ }
+ return null;
+ }
+
+ private ClassLoader getClassLoader() {
+ return classLoaderRef.getClassLoader();
+ }
+
+ public AnnotationAJ getAnnotationOfType(UnresolvedType ofType, Member onMember) {
+ if (!(onMember instanceof AccessibleObject))
+ return null;
+ // here we really want both the runtime visible AND the class visible
+ // annotations
+ // so we bail out to Bcel and then chuck away the JavaClass so that we
+ // don't hog
+ // memory.
+ try {
+ JavaClass jc = bcelRepository.loadClass(onMember.getDeclaringClass());
+ org.aspectj.apache.bcel.classfile.annotation.AnnotationGen[] anns = new org.aspectj.apache.bcel.classfile.annotation.AnnotationGen[0];
+ if (onMember instanceof Method) {
+ org.aspectj.apache.bcel.classfile.Method bcelMethod = jc.getMethod((Method) onMember);
+ if (bcelMethod == null) {
+ // pr220430
+ // System.err.println(
+ // "Unexpected problem in Java15AnnotationFinder: cannot retrieve annotations on method '"
+ // +
+ // onMember.getName()+"' in class '"+jc.getClassName()+"'");
+ } else {
+ anns = bcelMethod.getAnnotations();
+ }
+ } else if (onMember instanceof Constructor) {
+ org.aspectj.apache.bcel.classfile.Method bcelCons = jc.getMethod((Constructor) onMember);
+ anns = bcelCons.getAnnotations();
+ } else if (onMember instanceof Field) {
+ org.aspectj.apache.bcel.classfile.Field bcelField = jc.getField((Field) onMember);
+ anns = bcelField.getAnnotations();
+ }
+ // the answer is cached and we don't want to hold on to memory
+ bcelRepository.clear();
+ // OPTIMIZE make constant 0 size array for sharing
+ if (anns == null)
+ anns = new org.aspectj.apache.bcel.classfile.annotation.AnnotationGen[0];
+ // convert to our Annotation type
+ for (int i = 0; i < anns.length; i++) {
+ if (anns[i].getTypeSignature().equals(ofType.getSignature())) {
+ return new BcelAnnotation(anns[i], world);
+ }
+ }
+ return null;
+ } catch (ClassNotFoundException cnfEx) {
+ // just use reflection then
+ }
+ return null;
+ }
+
+ public String getAnnotationDefaultValue(Member onMember) {
+ try {
+ JavaClass jc = bcelRepository.loadClass(onMember.getDeclaringClass());
+ if (onMember instanceof Method) {
+ org.aspectj.apache.bcel.classfile.Method bcelMethod = jc.getMethod((Method) onMember);
+
+ if (bcelMethod == null) {
+ // pr220430
+ // System.err.println(
+ // "Unexpected problem in Java15AnnotationFinder: cannot retrieve annotations on method '"
+ // +
+ // onMember.getName()+"' in class '"+jc.getClassName()+"'");
+ } else {
+ Attribute[] attrs = bcelMethod.getAttributes();
+ for (int i = 0; i < attrs.length; i++) {
+ Attribute attribute = attrs[i];
+ if (attribute.getName().equals("AnnotationDefault")) {
+ AnnotationDefault def = (AnnotationDefault) attribute;
+ return def.getElementValue().stringifyValue();
+ }
+ }
+ return null;
+ }
+ }
+ } catch (ClassNotFoundException cnfEx) {
+ // just use reflection then
+ }
+ return null;
+ }
+
+ public ResolvedType[] getAnnotations(Member onMember, boolean areRuntimeAnnotationsSufficient) {
+ if (!(onMember instanceof AccessibleObject)) {
+ return ResolvedType.NONE;
+ }
+ // If annotations with class level retention are required then we need to open
+ // open the class file. If only runtime retention annotations are required
+ // we can just use reflection.
+ if (!areRuntimeAnnotationsSufficient) {
+ try {
+ JavaClass jc = bcelRepository.loadClass(onMember.getDeclaringClass());
+ org.aspectj.apache.bcel.classfile.annotation.AnnotationGen[] anns = null;
+ if (onMember instanceof Method) {
+ org.aspectj.apache.bcel.classfile.Method bcelMethod = jc.getMethod((Method) onMember);
+ if (bcelMethod != null) {
+ anns = bcelMethod.getAnnotations();
+ }
+ } else if (onMember instanceof Constructor) {
+ org.aspectj.apache.bcel.classfile.Method bcelCons = jc.getMethod((Constructor) onMember);
+ anns = bcelCons.getAnnotations();
+ } else if (onMember instanceof Field) {
+ org.aspectj.apache.bcel.classfile.Field bcelField = jc.getField((Field) onMember);
+ anns = bcelField.getAnnotations();
+ }
+ // the answer is cached and we don't want to hold on to memory
+ bcelRepository.clear();
+ if (anns == null || anns.length == 0) {
+ return ResolvedType.NONE;
+ }
+ ResolvedType[] annotationTypes = new ResolvedType[anns.length];
+ for (int i = 0; i < anns.length; i++) {
+ annotationTypes[i] = world.resolve(UnresolvedType.forSignature(anns[i].getTypeSignature()));
+ }
+ return annotationTypes;
+ } catch (ClassNotFoundException cnfEx) {
+ // just use reflection then
+ }
+ }
+
+ AccessibleObject ao = (AccessibleObject) onMember;
+ Annotation[] anns = ao.getDeclaredAnnotations();
+ if (anns.length == 0) {
+ return ResolvedType.NONE;
+ }
+ ResolvedType[] annotationTypes = new ResolvedType[anns.length];
+ for (int i = 0; i < anns.length; i++) {
+ annotationTypes[i] = UnresolvedType.forName(anns[i].annotationType().getName()).resolve(world);
+ }
+ return annotationTypes;
+ }
+
+ public ResolvedType[] getAnnotations(Class forClass, World inWorld) {
+ // here we really want both the runtime visible AND the class visible
+ // annotations so we bail out to Bcel and then chuck away the JavaClass so that we
+ // don't hog memory.
+ try {
+ JavaClass jc = bcelRepository.loadClass(forClass);
+ org.aspectj.apache.bcel.classfile.annotation.AnnotationGen[] anns = jc.getAnnotations();
+ bcelRepository.clear();
+ if (anns == null) {
+ return ResolvedType.NONE;
+ } else {
+ ResolvedType[] ret = new ResolvedType[anns.length];
+ for (int i = 0; i < ret.length; i++) {
+ ret[i] = inWorld.resolve(UnresolvedType.forSignature(anns[i].getTypeSignature()));
+ }
+ return ret;
+ }
+ } catch (ClassNotFoundException cnfEx) {
+ // just use reflection then
+ }
+
+ Annotation[] classAnnotations = forClass.getAnnotations();
+ ResolvedType[] ret = new ResolvedType[classAnnotations.length];
+ for (int i = 0; i < classAnnotations.length; i++) {
+ ret[i] = inWorld.resolve(classAnnotations[i].annotationType().getName());
+ }
+
+ return ret;
+ }
+
+ public String[] getParameterNames(Member forMember) {
+ if (!(forMember instanceof AccessibleObject))
+ return null;
+
+ try {
+ JavaClass jc = bcelRepository.loadClass(forMember.getDeclaringClass());
+ LocalVariableTable lvt = null;
+ int numVars = 0;
+ if (forMember instanceof Method) {
+ org.aspectj.apache.bcel.classfile.Method bcelMethod = jc.getMethod((Method) forMember);
+ lvt = bcelMethod.getLocalVariableTable();
+ numVars = bcelMethod.getArgumentTypes().length;
+ } else if (forMember instanceof Constructor) {
+ org.aspectj.apache.bcel.classfile.Method bcelCons = jc.getMethod((Constructor) forMember);
+ lvt = bcelCons.getLocalVariableTable();
+ numVars = bcelCons.getArgumentTypes().length;
+ }
+ return getParameterNamesFromLVT(lvt, numVars);
+ } catch (ClassNotFoundException cnfEx) {
+ ; // no luck
+ }
+
+ return null;
+ }
+
+ private String[] getParameterNamesFromLVT(LocalVariableTable lvt, int numVars) {
+ if (lvt == null)
+ return null;// pr222987 - prevent NPE
+ LocalVariable[] vars = lvt.getLocalVariableTable();
+ if (vars.length < numVars) {
+ // basic error, we can't get the names...
+ return null;
+ }
+ String[] ret = new String[numVars];
+ for (int i = 0; i < numVars; i++) {
+ ret[i] = vars[i + 1].getName();
+ }
+ return ret;
+ }
+
+ public ResolvedType[][] getParameterAnnotationTypes(Member onMember) {
+ if (!(onMember instanceof AccessibleObject))
+ return NO_PARAMETER_ANNOTATIONS;
+ // here we really want both the runtime visible AND the class visible
+ // annotations
+ // so we bail out to Bcel and then chuck away the JavaClass so that we
+ // don't hog
+ // memory.
+ try {
+ JavaClass jc = bcelRepository.loadClass(onMember.getDeclaringClass());
+ org.aspectj.apache.bcel.classfile.annotation.AnnotationGen[][] anns = null;
+ if (onMember instanceof Method) {
+ org.aspectj.apache.bcel.classfile.Method bcelMethod = jc.getMethod((Method) onMember);
+ if (bcelMethod == null) {
+ // pr220430
+ // System.err.println(
+ // "Unexpected problem in Java15AnnotationFinder: cannot retrieve annotations on method '"
+ // +
+ // onMember.getName()+"' in class '"+jc.getClassName()+"'");
+ } else {
+ anns = bcelMethod.getParameterAnnotations();
+ }
+ } else if (onMember instanceof Constructor) {
+ org.aspectj.apache.bcel.classfile.Method bcelCons = jc.getMethod((Constructor) onMember);
+ anns = bcelCons.getParameterAnnotations();
+ } else if (onMember instanceof Field) {
+ // anns = null;
+ }
+ // the answer is cached and we don't want to hold on to memory
+ bcelRepository.clear();
+ if (anns == null)
+ return NO_PARAMETER_ANNOTATIONS;
+ ResolvedType[][] result = new ResolvedType[anns.length][];
+ // CACHING??
+ for (int i = 0; i < anns.length; i++) {
+ if (anns[i] != null) {
+ result[i] = new ResolvedType[anns[i].length];
+ for (int j = 0; j < anns[i].length; j++) {
+ result[i][j] = world.resolve(UnresolvedType.forSignature(anns[i][j].getTypeSignature()));
+ }
+ }
+ }
+ return result;
+ } catch (ClassNotFoundException cnfEx) {
+ // just use reflection then
+ }
+
+ // reflection...
+ AccessibleObject ao = (AccessibleObject) onMember;
+ Annotation[][] anns = null;
+ if (onMember instanceof Method) {
+ anns = ((Method) ao).getParameterAnnotations();
+ } else if (onMember instanceof Constructor) {
+ anns = ((Constructor) ao).getParameterAnnotations();
+ } else if (onMember instanceof Field) {
+ // anns = null;
+ }
+ if (anns == null)
+ return NO_PARAMETER_ANNOTATIONS;
+ ResolvedType[][] result = new ResolvedType[anns.length][];
+ // CACHING??
+ for (int i = 0; i < anns.length; i++) {
+ if (anns[i] != null) {
+ result[i] = new ResolvedType[anns[i].length];
+ for (int j = 0; j < anns[i].length; j++) {
+ result[i][j] = UnresolvedType.forName(anns[i][j].annotationType().getName()).resolve(world);
+ }
+ }
+ }
+ return result;
+ }
+
+}
diff --git a/weaver/src/main/java/org/aspectj/weaver/reflect/Java15GenericSignatureInformationProvider.java b/weaver/src/main/java/org/aspectj/weaver/reflect/Java15GenericSignatureInformationProvider.java
new file mode 100644
index 000000000..c9de9517e
--- /dev/null
+++ b/weaver/src/main/java/org/aspectj/weaver/reflect/Java15GenericSignatureInformationProvider.java
@@ -0,0 +1,103 @@
+/* *******************************************************************
+ * Copyright (c) 2005 Contributors.
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Adrian Colyer Initial implementation
+ * ******************************************************************/
+package org.aspectj.weaver.reflect;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
+import java.lang.reflect.Member;
+import java.lang.reflect.Method;
+import java.lang.reflect.Type;
+
+import org.aspectj.weaver.UnresolvedType;
+import org.aspectj.weaver.World;
+
+/**
+ * Uses Java 1.5 reflection APIs to determine generic signatures
+ */
+public class Java15GenericSignatureInformationProvider implements
+ GenericSignatureInformationProvider {
+
+ private final World world;
+
+ public Java15GenericSignatureInformationProvider(World forWorld) {
+ this.world = forWorld;
+ }
+
+ /* (non-Javadoc)
+ * @see org.aspectj.weaver.reflect.GenericSignatureInformationProvider#getGenericParameterTypes(org.aspectj.weaver.reflect.ReflectionBasedResolvedMemberImpl)
+ */
+ public UnresolvedType[] getGenericParameterTypes(
+ ReflectionBasedResolvedMemberImpl resolvedMember) {
+ JavaLangTypeToResolvedTypeConverter typeConverter = new JavaLangTypeToResolvedTypeConverter(world);
+ Type[] pTypes = new Type[0];
+ Member member = resolvedMember.getMember();
+ if (member instanceof Method) {
+ pTypes = ((Method)member).getGenericParameterTypes();
+ } else if (member instanceof Constructor) {
+ pTypes = ((Constructor)member).getGenericParameterTypes();
+ }
+ return typeConverter.fromTypes(pTypes);
+ }
+
+ /* (non-Javadoc)
+ * @see org.aspectj.weaver.reflect.GenericSignatureInformationProvider#getGenericReturnType(org.aspectj.weaver.reflect.ReflectionBasedResolvedMemberImpl)
+ */
+ public UnresolvedType getGenericReturnType(
+ ReflectionBasedResolvedMemberImpl resolvedMember) {
+ JavaLangTypeToResolvedTypeConverter typeConverter = new JavaLangTypeToResolvedTypeConverter(world);
+ Member member = resolvedMember.getMember();
+ if (member instanceof Field) {
+ return typeConverter.fromType(((Field)member).getGenericType());
+ } else if (member instanceof Method) {
+ return typeConverter.fromType(((Method)member).getGenericReturnType());
+ } else if (member instanceof Constructor) {
+ return typeConverter.fromType(((Constructor)member).getDeclaringClass());
+ } else {
+ throw new IllegalStateException("unexpected member type: " + member);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.aspectj.weaver.reflect.GenericSignatureInformationProvider#isBridge()
+ */
+ public boolean isBridge(ReflectionBasedResolvedMemberImpl resolvedMember) {
+ Member member = resolvedMember.getMember();
+ if (member instanceof Method) {
+ return ((Method)member).isBridge();
+ } else {
+ return false;
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.aspectj.weaver.reflect.GenericSignatureInformationProvider#isVarArgs()
+ */
+ public boolean isVarArgs(ReflectionBasedResolvedMemberImpl resolvedMember) {
+ Member member = resolvedMember.getMember();
+ if (member instanceof Method) {
+ return ((Method)member).isVarArgs();
+ } else if (member instanceof Constructor) {
+ return ((Constructor)member).isVarArgs();
+ } else {
+ return false;
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.aspectj.weaver.reflect.GenericSignatureInformationProvider#isSynthetic()
+ */
+ public boolean isSynthetic(ReflectionBasedResolvedMemberImpl resolvedMember) {
+ Member member = resolvedMember.getMember();
+ return member.isSynthetic();
+ }
+
+}
diff --git a/weaver/src/main/java/org/aspectj/weaver/reflect/Java15ReflectionBasedReferenceTypeDelegate.java b/weaver/src/main/java/org/aspectj/weaver/reflect/Java15ReflectionBasedReferenceTypeDelegate.java
new file mode 100644
index 000000000..6b65ed31e
--- /dev/null
+++ b/weaver/src/main/java/org/aspectj/weaver/reflect/Java15ReflectionBasedReferenceTypeDelegate.java
@@ -0,0 +1,389 @@
+/* *******************************************************************
+ * Copyright (c) 2005 Contributors.
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Adrian Colyer Initial implementation
+ * ******************************************************************/
+package org.aspectj.weaver.reflect;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.lang.reflect.Type;
+import java.util.Iterator;
+import java.util.Set;
+
+import org.aspectj.lang.annotation.Aspect;
+import org.aspectj.lang.reflect.AjType;
+import org.aspectj.lang.reflect.AjTypeSystem;
+import org.aspectj.lang.reflect.Pointcut;
+import org.aspectj.weaver.AnnotationAJ;
+import org.aspectj.weaver.ReferenceType;
+import org.aspectj.weaver.ResolvedMember;
+import org.aspectj.weaver.ResolvedPointcutDefinition;
+import org.aspectj.weaver.ResolvedType;
+import org.aspectj.weaver.TypeVariable;
+import org.aspectj.weaver.TypeVariableReferenceType;
+import org.aspectj.weaver.UnresolvedType;
+import org.aspectj.weaver.World;
+import org.aspectj.weaver.tools.PointcutDesignatorHandler;
+import org.aspectj.weaver.tools.PointcutParameter;
+
+/**
+ * Provides Java 5 behaviour in reflection based delegates (overriding 1.4 behaviour from superclass where
+ * appropriate)
+ *
+ * @author Adrian Colyer
+ * @author Andy Clement
+ */
+public class Java15ReflectionBasedReferenceTypeDelegate extends ReflectionBasedReferenceTypeDelegate {
+
+ private AjType<?> myType;
+ private ResolvedType[] annotations;
+ private ResolvedMember[] pointcuts;
+ private ResolvedMember[] methods;
+ private ResolvedMember[] fields;
+ private TypeVariable[] typeVariables;
+ private ResolvedType superclass;
+ private ResolvedType[] superInterfaces;
+ private String genericSignature = null;
+ private JavaLangTypeToResolvedTypeConverter typeConverter;
+ private Java15AnnotationFinder annotationFinder = null;
+ private ArgNameFinder argNameFinder = null;
+
+ public Java15ReflectionBasedReferenceTypeDelegate() {
+ }
+
+ @Override
+ public void initialize(ReferenceType aType, Class aClass, ClassLoader classLoader, World aWorld) {
+ super.initialize(aType, aClass, classLoader, aWorld);
+ myType = AjTypeSystem.getAjType(aClass);
+ annotationFinder = new Java15AnnotationFinder();
+ argNameFinder = annotationFinder;
+ annotationFinder.setClassLoader(this.classLoaderReference.getClassLoader());
+ annotationFinder.setWorld(aWorld);
+ this.typeConverter = new JavaLangTypeToResolvedTypeConverter(aWorld);
+ }
+
+ @Override
+ public ReferenceType buildGenericType() {
+ return (ReferenceType) UnresolvedType.forGenericTypeVariables(getResolvedTypeX().getSignature(), getTypeVariables())
+ .resolve(getWorld());
+ }
+
+ @Override
+ public AnnotationAJ[] getAnnotations() {
+ // AMC - we seem not to need to implement this method...
+ // throw new UnsupportedOperationException(
+ // "getAnnotations on Java15ReflectionBasedReferenceTypeDelegate is not implemented yet"
+ // );
+ // FIXME is this the right implementation in the reflective case?
+ return super.getAnnotations();
+ }
+
+ @Override
+ public ResolvedType[] getAnnotationTypes() {
+ if (annotations == null) {
+ annotations = annotationFinder.getAnnotations(getBaseClass(), getWorld());
+ }
+ return annotations;
+ }
+
+ @Override
+ public boolean hasAnnotations() {
+ if (annotations == null) {
+ annotations = annotationFinder.getAnnotations(getBaseClass(), getWorld());
+ }
+ return annotations.length != 0;
+ }
+
+ @Override
+ public boolean hasAnnotation(UnresolvedType ofType) {
+ ResolvedType[] myAnns = getAnnotationTypes();
+ ResolvedType toLookFor = ofType.resolve(getWorld());
+ for (int i = 0; i < myAnns.length; i++) {
+ if (myAnns[i] == toLookFor) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ // use the MAP to ensure that any aj-synthetic fields are filtered out
+ @Override
+ public ResolvedMember[] getDeclaredFields() {
+ if (fields == null) {
+ Field[] reflectFields = this.myType.getDeclaredFields();
+ ResolvedMember[] rFields = new ResolvedMember[reflectFields.length];
+ for (int i = 0; i < reflectFields.length; i++) {
+ rFields[i] = createGenericFieldMember(reflectFields[i]);
+ }
+ this.fields = rFields;
+ }
+ return fields;
+ }
+
+ @Override
+ public String getDeclaredGenericSignature() {
+ if (this.genericSignature == null && isGeneric()) {
+ // BUG? what the hell is this doing - see testcode in MemberTestCase15.testMemberSignatureCreation() and run it
+ // off a Reflection World
+ }
+ return genericSignature;
+ }
+
+ @Override
+ public ResolvedType[] getDeclaredInterfaces() {
+ if (superInterfaces == null) {
+ Type[] genericInterfaces = getBaseClass().getGenericInterfaces();
+ this.superInterfaces = typeConverter.fromTypes(genericInterfaces);
+ }
+ return superInterfaces;
+ }
+
+ @Override
+ public ResolvedType getSuperclass() {
+ // Superclass of object is null
+ if (superclass == null && getBaseClass() != Object.class) {
+ Type t = this.getBaseClass().getGenericSuperclass();
+ if (t != null) {
+ superclass = typeConverter.fromType(t);
+ }
+ if (t == null) {
+ // If the superclass is null, return Object - same as bcel does
+ superclass = getWorld().resolve(UnresolvedType.OBJECT);
+ }
+ }
+ return superclass;
+ }
+
+ @Override
+ public TypeVariable[] getTypeVariables() {
+ TypeVariable[] workInProgressSetOfVariables = getResolvedTypeX().getWorld().getTypeVariablesCurrentlyBeingProcessed(
+ getBaseClass());
+ if (workInProgressSetOfVariables != null) {
+ return workInProgressSetOfVariables;
+ }
+ if (this.typeVariables == null) {
+ java.lang.reflect.TypeVariable[] tVars = this.getBaseClass().getTypeParameters();
+ TypeVariable[] rTypeVariables = new TypeVariable[tVars.length];
+ // basic initialization
+ for (int i = 0; i < tVars.length; i++) {
+ rTypeVariables[i] = new TypeVariable(tVars[i].getName());
+ }
+ // stash it
+ this.getResolvedTypeX().getWorld().recordTypeVariablesCurrentlyBeingProcessed(getBaseClass(), rTypeVariables);
+ // now fill in the details...
+ for (int i = 0; i < tVars.length; i++) {
+ TypeVariableReferenceType tvrt = ((TypeVariableReferenceType) typeConverter.fromType(tVars[i]));
+ TypeVariable tv = tvrt.getTypeVariable();
+ rTypeVariables[i].setSuperclass(tv.getSuperclass());
+ rTypeVariables[i].setAdditionalInterfaceBounds(tv.getSuperInterfaces());
+ rTypeVariables[i].setDeclaringElement(tv.getDeclaringElement());
+ rTypeVariables[i].setDeclaringElementKind(tv.getDeclaringElementKind());
+ rTypeVariables[i].setRank(tv.getRank());
+ }
+ this.typeVariables = rTypeVariables;
+ this.getResolvedTypeX().getWorld().forgetTypeVariablesCurrentlyBeingProcessed(getBaseClass());
+ }
+ return this.typeVariables;
+ }
+
+ // overrides super method since by using the MAP we can filter out advice
+ // methods that really shouldn't be seen in this list
+ @Override
+ public ResolvedMember[] getDeclaredMethods() {
+ if (methods == null) {
+ Method[] reflectMethods = this.myType.getDeclaredMethods();
+ Constructor[] reflectCons = this.myType.getDeclaredConstructors();
+ ResolvedMember[] rMethods = new ResolvedMember[reflectMethods.length + reflectCons.length];
+ for (int i = 0; i < reflectMethods.length; i++) {
+ rMethods[i] = createGenericMethodMember(reflectMethods[i]);
+ }
+ for (int i = 0; i < reflectCons.length; i++) {
+ rMethods[i + reflectMethods.length] = createGenericConstructorMember(reflectCons[i]);
+ }
+ this.methods = rMethods;
+ }
+ return methods;
+ }
+
+ /**
+ * Returns the generic type, regardless of the resolvedType we 'know about'
+ */
+ public ResolvedType getGenericResolvedType() {
+ ResolvedType rt = getResolvedTypeX();
+ if (rt.isParameterizedType() || rt.isRawType()) {
+ return rt.getGenericType();
+ }
+ return rt;
+ }
+
+ private ResolvedMember createGenericMethodMember(Method forMethod) {
+ ReflectionBasedResolvedMemberImpl ret = new ReflectionBasedResolvedMemberImpl(org.aspectj.weaver.Member.METHOD,
+ getGenericResolvedType(), forMethod.getModifiers(), typeConverter.fromType(forMethod.getReturnType()),
+ forMethod.getName(), typeConverter.fromTypes(forMethod.getParameterTypes()), typeConverter.fromTypes(forMethod
+ .getExceptionTypes()), forMethod);
+ ret.setAnnotationFinder(this.annotationFinder);
+ ret.setGenericSignatureInformationProvider(new Java15GenericSignatureInformationProvider(this.getWorld()));
+ return ret;
+ }
+
+ private ResolvedMember createGenericConstructorMember(Constructor forConstructor) {
+ ReflectionBasedResolvedMemberImpl ret = new ReflectionBasedResolvedMemberImpl(org.aspectj.weaver.Member.METHOD,
+ getGenericResolvedType(), forConstructor.getModifiers(),
+ // to return what BCEL returns the return type is void
+ UnresolvedType.VOID,// getGenericResolvedType(),
+ "<init>", typeConverter.fromTypes(forConstructor.getParameterTypes()), typeConverter.fromTypes(forConstructor
+ .getExceptionTypes()), forConstructor);
+ ret.setAnnotationFinder(this.annotationFinder);
+ ret.setGenericSignatureInformationProvider(new Java15GenericSignatureInformationProvider(this.getWorld()));
+ return ret;
+ }
+
+ private ResolvedMember createGenericFieldMember(Field forField) {
+ ReflectionBasedResolvedMemberImpl ret = new ReflectionBasedResolvedMemberImpl(org.aspectj.weaver.Member.FIELD,
+ getGenericResolvedType(), forField.getModifiers(), typeConverter.fromType(forField.getType()), forField.getName(),
+ new UnresolvedType[0], forField);
+ ret.setAnnotationFinder(this.annotationFinder);
+ ret.setGenericSignatureInformationProvider(new Java15GenericSignatureInformationProvider(this.getWorld()));
+ return ret;
+ }
+
+ @Override
+ public ResolvedMember[] getDeclaredPointcuts() {
+ if (pointcuts == null) {
+ Pointcut[] pcs = this.myType.getDeclaredPointcuts();
+ pointcuts = new ResolvedMember[pcs.length];
+ InternalUseOnlyPointcutParser parser = null;
+ World world = getWorld();
+ if (world instanceof ReflectionWorld) {
+ parser = new InternalUseOnlyPointcutParser(classLoaderReference.getClassLoader(), (ReflectionWorld) getWorld());
+ } else {
+ parser = new InternalUseOnlyPointcutParser(classLoaderReference.getClassLoader());
+ }
+ Set additionalPointcutHandlers = world.getRegisteredPointcutHandlers();
+ for (Iterator handlerIterator = additionalPointcutHandlers.iterator(); handlerIterator.hasNext();) {
+ PointcutDesignatorHandler handler = (PointcutDesignatorHandler) handlerIterator.next();
+ parser.registerPointcutDesignatorHandler(handler);
+ }
+
+ // phase 1, create legitimate entries in pointcuts[] before we
+ // attempt to resolve *any* of the pointcuts
+ // resolution can sometimes cause us to recurse, and this two stage
+ // process allows us to cope with that
+ for (int i = 0; i < pcs.length; i++) {
+ AjType<?>[] ptypes = pcs[i].getParameterTypes();
+ UnresolvedType[] weaverPTypes = new UnresolvedType[ptypes.length];
+ for (int j = 0; j < weaverPTypes.length; j++) {
+ weaverPTypes[j] = this.typeConverter.fromType(ptypes[j].getJavaClass());
+ }
+ pointcuts[i] = new DeferredResolvedPointcutDefinition(getResolvedTypeX(), pcs[i].getModifiers(), pcs[i].getName(),
+ weaverPTypes);
+ }
+ // phase 2, now go back round and resolve in-place all of the
+ // pointcuts
+ PointcutParameter[][] parameters = new PointcutParameter[pcs.length][];
+ for (int i = 0; i < pcs.length; i++) {
+ AjType<?>[] ptypes = pcs[i].getParameterTypes();
+ String[] pnames = pcs[i].getParameterNames();
+ if (pnames.length != ptypes.length) {
+ pnames = tryToDiscoverParameterNames(pcs[i]);
+ if (pnames == null || (pnames.length != ptypes.length)) {
+ throw new IllegalStateException("Required parameter names not available when parsing pointcut "
+ + pcs[i].getName() + " in type " + getResolvedTypeX().getName());
+ }
+ }
+ parameters[i] = new PointcutParameter[ptypes.length];
+ for (int j = 0; j < parameters[i].length; j++) {
+ parameters[i][j] = parser.createPointcutParameter(pnames[j], ptypes[j].getJavaClass());
+ }
+ String pcExpr = pcs[i].getPointcutExpression().toString();
+ org.aspectj.weaver.patterns.Pointcut pc = parser.resolvePointcutExpression(pcExpr, getBaseClass(), parameters[i]);
+ ((ResolvedPointcutDefinition) pointcuts[i]).setParameterNames(pnames);
+ ((ResolvedPointcutDefinition) pointcuts[i]).setPointcut(pc);
+ }
+ // phase 3, now concretize them all
+ for (int i = 0; i < pointcuts.length; i++) {
+ ResolvedPointcutDefinition rpd = (ResolvedPointcutDefinition) pointcuts[i];
+ rpd.setPointcut(parser.concretizePointcutExpression(rpd.getPointcut(), getBaseClass(), parameters[i]));
+ }
+ }
+ return pointcuts;
+ }
+
+ // for @AspectJ pointcuts compiled by javac only...
+ private String[] tryToDiscoverParameterNames(Pointcut pcut) {
+ Method[] ms = pcut.getDeclaringType().getJavaClass().getDeclaredMethods();
+ for (Method m : ms) {
+ if (m.getName().equals(pcut.getName())) {
+ return argNameFinder.getParameterNames(m);
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public boolean isAnnotation() {
+ return getBaseClass().isAnnotation();
+ }
+
+ @Override
+ public boolean isAnnotationStyleAspect() {
+ return getBaseClass().isAnnotationPresent(Aspect.class);
+ }
+
+ @Override
+ public boolean isAnnotationWithRuntimeRetention() {
+ if (!isAnnotation()) {
+ return false;
+ }
+ if (getBaseClass().isAnnotationPresent(Retention.class)) {
+ Retention retention = (Retention) getBaseClass().getAnnotation(Retention.class);
+ RetentionPolicy policy = retention.value();
+ return policy == RetentionPolicy.RUNTIME;
+ } else {
+ return false;
+ }
+ }
+
+ @Override
+ public boolean isAspect() {
+ return this.myType.isAspect();
+ }
+
+ @Override
+ public boolean isEnum() {
+ return getBaseClass().isEnum();
+ }
+
+ @Override
+ public boolean isGeneric() {
+ // return false; // for now
+ return getBaseClass().getTypeParameters().length > 0;
+ }
+
+ @Override
+ public boolean isAnonymous() {
+ return this.myClass.isAnonymousClass();
+ }
+
+ @Override
+ public boolean isNested() {
+ return this.myClass.isMemberClass();
+ }
+
+ @Override
+ public ResolvedType getOuterClass() {
+ return ReflectionBasedReferenceTypeDelegateFactory.resolveTypeInWorld(
+ myClass.getEnclosingClass(),world);
+ }
+
+}
diff --git a/weaver/src/main/java/org/aspectj/weaver/reflect/JavaLangTypeToResolvedTypeConverter.java b/weaver/src/main/java/org/aspectj/weaver/reflect/JavaLangTypeToResolvedTypeConverter.java
new file mode 100644
index 000000000..30983e38f
--- /dev/null
+++ b/weaver/src/main/java/org/aspectj/weaver/reflect/JavaLangTypeToResolvedTypeConverter.java
@@ -0,0 +1,134 @@
+/* *******************************************************************
+ * Copyright (c) 2005 Contributors.
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://eclipse.org/legal/epl-v10.html
+ * ******************************************************************/
+package org.aspectj.weaver.reflect;
+
+import java.lang.reflect.GenericArrayType;
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+import java.lang.reflect.WildcardType;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.aspectj.weaver.BoundedReferenceType;
+import org.aspectj.weaver.ReferenceType;
+import org.aspectj.weaver.ResolvedType;
+import org.aspectj.weaver.TypeFactory;
+import org.aspectj.weaver.TypeVariable;
+import org.aspectj.weaver.TypeVariableReferenceType;
+import org.aspectj.weaver.UnresolvedType;
+import org.aspectj.weaver.World;
+
+/**
+ * Handles the translation of java.lang.reflect.Type objects into AspectJ UnresolvedTypes.
+ *
+ * @author Adrian Colyer
+ */
+public class JavaLangTypeToResolvedTypeConverter {
+
+ // Used to prevent recursion - we record what we are working on and return it if asked again *whilst* working on it
+ private Map<Type, TypeVariableReferenceType> typeVariablesInProgress = new HashMap<Type, TypeVariableReferenceType>();
+ private final World world;
+
+ public JavaLangTypeToResolvedTypeConverter(World aWorld) {
+ this.world = aWorld;
+ }
+
+ private World getWorld() {
+ return this.world;
+ }
+
+ public ResolvedType fromType(Type type) {
+ if (type instanceof Class) {
+ Class clazz = (Class) type;
+ String name = clazz.getName();
+ /**
+ * getName() can return:
+ *
+ * 1. If this class object represents a reference type that is not an
+ * array type then the binary name of the class is returned
+ * 2. If this class object represents a primitive type or void, then
+ * the name returned is a String equal to the Java language keyword
+ * corresponding to the primitive type or void.
+ * 3. If this class object represents a class of arrays, then the internal
+ * form of the name consists of the name of the element type preceded by
+ * one or more '[' characters representing the depth of the array nesting.
+ */
+ if (clazz.isArray()) {
+ UnresolvedType ut = UnresolvedType.forSignature(name.replace('.', '/'));
+ return getWorld().resolve(ut);
+ } else {
+ return getWorld().resolve(name);
+ }
+ } else if (type instanceof ParameterizedType) {
+ // https://bugs.eclipse.org/bugs/show_bug.cgi?id=509327
+ // TODO should deal with the ownerType if it set, indicating this is possibly an inner type of a parameterized type
+ Type ownerType = ((ParameterizedType) type).getOwnerType();
+ ParameterizedType parameterizedType = (ParameterizedType) type;
+ ResolvedType baseType = fromType(parameterizedType.getRawType());
+ Type[] typeArguments = parameterizedType.getActualTypeArguments();
+ if (baseType.isSimpleType() && typeArguments.length == 0 && ownerType != null) {
+ // 'type' is an inner type of some outer parameterized type
+ // For now just return the base type - in future create the parameterized form of the outer
+ // and use it with the inner. We return the base type to be compatible with what the
+ // code does that accesses the info from the bytecode (unlike this code which accesses it
+ // reflectively).
+ return baseType;
+ }
+ ResolvedType[] resolvedTypeArguments = fromTypes(typeArguments);
+ return TypeFactory.createParameterizedType(baseType, resolvedTypeArguments, getWorld());
+ } else if (type instanceof java.lang.reflect.TypeVariable) {
+ TypeVariableReferenceType inprogressVar = typeVariablesInProgress.get(type);
+ if (inprogressVar != null) {
+ return inprogressVar;
+ }
+ java.lang.reflect.TypeVariable tv = (java.lang.reflect.TypeVariable) type;
+ TypeVariable rt_tv = new TypeVariable(tv.getName());
+ TypeVariableReferenceType tvrt = new TypeVariableReferenceType(rt_tv, getWorld());
+ typeVariablesInProgress.put(type, tvrt); // record what we are working on, for recursion case
+ Type[] bounds = tv.getBounds();
+ ResolvedType[] resBounds = fromTypes(bounds);
+ ResolvedType upperBound = resBounds[0];
+ ResolvedType[] additionalBounds = new ResolvedType[0];
+ if (resBounds.length > 1) {
+ additionalBounds = new ResolvedType[resBounds.length - 1];
+ System.arraycopy(resBounds, 1, additionalBounds, 0, additionalBounds.length);
+ }
+ rt_tv.setUpperBound(upperBound);
+ rt_tv.setAdditionalInterfaceBounds(additionalBounds);
+ typeVariablesInProgress.remove(type); // we have finished working on it
+ return tvrt;
+ } else if (type instanceof WildcardType) {
+ WildcardType wildType = (WildcardType) type;
+ Type[] lowerBounds = wildType.getLowerBounds();
+ Type[] upperBounds = wildType.getUpperBounds();
+ ResolvedType bound = null;
+ boolean isExtends = lowerBounds.length == 0;
+ if (isExtends) {
+ bound = fromType(upperBounds[0]);
+ } else {
+ bound = fromType(lowerBounds[0]);
+ }
+ return new BoundedReferenceType((ReferenceType) bound, isExtends, getWorld());
+ } else if (type instanceof GenericArrayType) {
+ GenericArrayType genericArrayType = (GenericArrayType) type;
+ Type componentType = genericArrayType.getGenericComponentType();
+ return UnresolvedType.makeArray(fromType(componentType), 1).resolve(getWorld());
+ }
+ return ResolvedType.MISSING;
+ }
+
+ public ResolvedType[] fromTypes(Type[] types) {
+ ResolvedType[] ret = new ResolvedType[types.length];
+ for (int i = 0; i < ret.length; i++) {
+ ret[i] = fromType(types[i]);
+ }
+ return ret;
+ }
+
+}
diff --git a/weaver/src/main/java/org/aspectj/weaver/tools/Jdk14Trace.java b/weaver/src/main/java/org/aspectj/weaver/tools/Jdk14Trace.java
new file mode 100644
index 000000000..061b0b0a0
--- /dev/null
+++ b/weaver/src/main/java/org/aspectj/weaver/tools/Jdk14Trace.java
@@ -0,0 +1,127 @@
+/*******************************************************************************
+ * Copyright (c) 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Matthew Webster - initial implementation
+ *******************************************************************************/
+package org.aspectj.weaver.tools;
+
+import java.util.logging.Handler;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+// OPTIMIZE move out for now? check what doc says about using these variants on trace (commons/14)
+public class Jdk14Trace extends AbstractTrace {
+
+ private Logger logger;
+ private String name;
+
+ public Jdk14Trace (Class clazz) {
+ super(clazz);
+ this.name = clazz.getName();
+ this.logger = Logger.getLogger(name);
+ }
+
+ public void enter(String methodName, Object thiz, Object[] args) {
+ if (logger.isLoggable(Level.FINE)) {
+ logger.entering(name,methodName,formatObj(thiz));
+ if (args != null && logger.isLoggable(Level.FINER)) {
+ logger.entering(name,methodName,formatObjects(args));
+ }
+ }
+ }
+
+ public void enter(String methodName, Object thiz) {
+ enter(methodName,thiz,null);
+ }
+
+ public void exit(String methodName, Object ret) {
+ if (logger.isLoggable(Level.FINE)) {
+ logger.exiting(name,methodName,formatObj(ret));
+ }
+ }
+
+ public void exit(String methodName, Throwable th) {
+ if (logger.isLoggable(Level.FINE)) {
+ logger.exiting(name,methodName,th);
+ }
+ }
+
+ public void exit(String methodName) {
+ if (logger.isLoggable(Level.FINE)) {
+ logger.exiting(name,methodName);
+ }
+ }
+
+ public void event(String methodName, Object thiz, Object[] args) {
+ if (logger.isLoggable(Level.FINE)) {
+ logger.logp(Level.FINER,name,methodName,"EVENT",formatObj(thiz));
+ if (args != null && logger.isLoggable(Level.FINER)) {
+ logger.logp(Level.FINER,name,methodName,"EVENT",formatObjects(args));
+ }
+ }
+ }
+
+ public void event(String methodName) {
+ if (logger.isLoggable(Level.FINE)) {
+ logger.logp(Level.FINER,name,methodName,"EVENT");
+ }
+ }
+
+ public boolean isTraceEnabled() {
+ return logger.isLoggable(Level.FINER);
+ }
+
+ public void setTraceEnabled (boolean b) {
+ if (b) {
+ logger.setLevel(Level.FINER);
+ Handler[] handlers = logger.getHandlers();
+ if (handlers.length == 0) {
+ Logger parent = logger.getParent();
+ if (parent != null) handlers = parent.getHandlers();
+ }
+ for (int i = 0; i < handlers.length; i++) {
+ Handler handler = handlers[i];
+ handler.setLevel(Level.FINER);
+ }
+ }
+ else {
+ logger.setLevel(Level.INFO);
+ }
+ }
+
+ public void debug (String message) {
+ if (logger.isLoggable(Level.FINE)) {
+ logger.fine(message);
+ }
+ }
+
+ public void info(String message) {
+ if (logger.isLoggable(Level.INFO)) {
+ logger.info(message);
+ }
+ }
+
+ public void warn (String message, Throwable th) {
+ if (logger.isLoggable(Level.WARNING)) {
+ logger.log(Level.WARNING,message,th);
+ }
+ }
+
+ public void error (String message, Throwable th) {
+ if (logger.isLoggable(Level.SEVERE)) {
+ logger.log(Level.SEVERE,message,th);
+ }
+ }
+
+ public void fatal (String message, Throwable th) {
+ if (logger.isLoggable(Level.SEVERE)) {
+ logger.log(Level.SEVERE,message,th);
+ }
+ }
+
+}
diff --git a/weaver/src/main/java/org/aspectj/weaver/tools/Jdk14TraceFactory.java b/weaver/src/main/java/org/aspectj/weaver/tools/Jdk14TraceFactory.java
new file mode 100644
index 000000000..4043d1d33
--- /dev/null
+++ b/weaver/src/main/java/org/aspectj/weaver/tools/Jdk14TraceFactory.java
@@ -0,0 +1,20 @@
+/*******************************************************************************
+ * Copyright (c) 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Matthew Webster - initial implementation
+ *******************************************************************************/
+package org.aspectj.weaver.tools;
+
+public class Jdk14TraceFactory extends TraceFactory {
+
+ @Override
+ public Trace getTrace(Class clazz) {
+ return new Jdk14Trace(clazz);
+ }
+
+}
diff --git a/weaver/src/org/aspectj/weaver/tools/WeavingAdaptor.java b/weaver/src/main/java/org/aspectj/weaver/tools/WeavingAdaptor.java
index a02400fb0..a02400fb0 100644
--- a/weaver/src/org/aspectj/weaver/tools/WeavingAdaptor.java
+++ b/weaver/src/main/java/org/aspectj/weaver/tools/WeavingAdaptor.java
diff --git a/weaver/src/org/aspectj/weaver/tools/cache/AbstractCacheBacking.java b/weaver/src/main/java/org/aspectj/weaver/tools/cache/AbstractCacheBacking.java
index 649e21d05..649e21d05 100644
--- a/weaver/src/org/aspectj/weaver/tools/cache/AbstractCacheBacking.java
+++ b/weaver/src/main/java/org/aspectj/weaver/tools/cache/AbstractCacheBacking.java
diff --git a/weaver/src/org/aspectj/weaver/tools/cache/AbstractFileCacheBacking.java b/weaver/src/main/java/org/aspectj/weaver/tools/cache/AbstractFileCacheBacking.java
index 5447c158b..5447c158b 100644
--- a/weaver/src/org/aspectj/weaver/tools/cache/AbstractFileCacheBacking.java
+++ b/weaver/src/main/java/org/aspectj/weaver/tools/cache/AbstractFileCacheBacking.java
diff --git a/weaver/src/org/aspectj/weaver/tools/cache/AbstractIndexedFileCacheBacking.java b/weaver/src/main/java/org/aspectj/weaver/tools/cache/AbstractIndexedFileCacheBacking.java
index 1580277b1..1580277b1 100644
--- a/weaver/src/org/aspectj/weaver/tools/cache/AbstractIndexedFileCacheBacking.java
+++ b/weaver/src/main/java/org/aspectj/weaver/tools/cache/AbstractIndexedFileCacheBacking.java
diff --git a/weaver/src/org/aspectj/weaver/tools/cache/AsynchronousFileCacheBacking.java b/weaver/src/main/java/org/aspectj/weaver/tools/cache/AsynchronousFileCacheBacking.java
index 636a82a7a..636a82a7a 100644
--- a/weaver/src/org/aspectj/weaver/tools/cache/AsynchronousFileCacheBacking.java
+++ b/weaver/src/main/java/org/aspectj/weaver/tools/cache/AsynchronousFileCacheBacking.java
diff --git a/weaver/src/org/aspectj/weaver/tools/cache/CacheBacking.java b/weaver/src/main/java/org/aspectj/weaver/tools/cache/CacheBacking.java
index bcf7c0b60..bcf7c0b60 100644
--- a/weaver/src/org/aspectj/weaver/tools/cache/CacheBacking.java
+++ b/weaver/src/main/java/org/aspectj/weaver/tools/cache/CacheBacking.java
diff --git a/weaver/src/org/aspectj/weaver/tools/cache/CacheFactory.java b/weaver/src/main/java/org/aspectj/weaver/tools/cache/CacheFactory.java
index 042ef61bd..042ef61bd 100644
--- a/weaver/src/org/aspectj/weaver/tools/cache/CacheFactory.java
+++ b/weaver/src/main/java/org/aspectj/weaver/tools/cache/CacheFactory.java
diff --git a/weaver/src/org/aspectj/weaver/tools/cache/CacheKeyResolver.java b/weaver/src/main/java/org/aspectj/weaver/tools/cache/CacheKeyResolver.java
index 8c76ad878..8c76ad878 100644
--- a/weaver/src/org/aspectj/weaver/tools/cache/CacheKeyResolver.java
+++ b/weaver/src/main/java/org/aspectj/weaver/tools/cache/CacheKeyResolver.java
diff --git a/weaver/src/org/aspectj/weaver/tools/cache/CacheStatistics.java b/weaver/src/main/java/org/aspectj/weaver/tools/cache/CacheStatistics.java
index 1ccacfc18..1ccacfc18 100644
--- a/weaver/src/org/aspectj/weaver/tools/cache/CacheStatistics.java
+++ b/weaver/src/main/java/org/aspectj/weaver/tools/cache/CacheStatistics.java
diff --git a/weaver/src/org/aspectj/weaver/tools/cache/CachedClassEntry.java b/weaver/src/main/java/org/aspectj/weaver/tools/cache/CachedClassEntry.java
index db74e7f92..db74e7f92 100644
--- a/weaver/src/org/aspectj/weaver/tools/cache/CachedClassEntry.java
+++ b/weaver/src/main/java/org/aspectj/weaver/tools/cache/CachedClassEntry.java
diff --git a/weaver/src/org/aspectj/weaver/tools/cache/CachedClassReference.java b/weaver/src/main/java/org/aspectj/weaver/tools/cache/CachedClassReference.java
index 7d48ff171..7d48ff171 100644
--- a/weaver/src/org/aspectj/weaver/tools/cache/CachedClassReference.java
+++ b/weaver/src/main/java/org/aspectj/weaver/tools/cache/CachedClassReference.java
diff --git a/weaver/src/org/aspectj/weaver/tools/cache/DefaultCacheFactory.java b/weaver/src/main/java/org/aspectj/weaver/tools/cache/DefaultCacheFactory.java
index 7eb796e4b..7eb796e4b 100644
--- a/weaver/src/org/aspectj/weaver/tools/cache/DefaultCacheFactory.java
+++ b/weaver/src/main/java/org/aspectj/weaver/tools/cache/DefaultCacheFactory.java
diff --git a/weaver/src/org/aspectj/weaver/tools/cache/DefaultCacheKeyResolver.java b/weaver/src/main/java/org/aspectj/weaver/tools/cache/DefaultCacheKeyResolver.java
index 4951923d3..4951923d3 100644
--- a/weaver/src/org/aspectj/weaver/tools/cache/DefaultCacheKeyResolver.java
+++ b/weaver/src/main/java/org/aspectj/weaver/tools/cache/DefaultCacheKeyResolver.java
diff --git a/weaver/src/org/aspectj/weaver/tools/cache/DefaultFileCacheBacking.java b/weaver/src/main/java/org/aspectj/weaver/tools/cache/DefaultFileCacheBacking.java
index 21543a80d..21543a80d 100644
--- a/weaver/src/org/aspectj/weaver/tools/cache/DefaultFileCacheBacking.java
+++ b/weaver/src/main/java/org/aspectj/weaver/tools/cache/DefaultFileCacheBacking.java
diff --git a/weaver/src/org/aspectj/weaver/tools/cache/FlatFileCacheBacking.java b/weaver/src/main/java/org/aspectj/weaver/tools/cache/FlatFileCacheBacking.java
index 6de416a80..6de416a80 100644
--- a/weaver/src/org/aspectj/weaver/tools/cache/FlatFileCacheBacking.java
+++ b/weaver/src/main/java/org/aspectj/weaver/tools/cache/FlatFileCacheBacking.java
diff --git a/weaver/src/org/aspectj/weaver/tools/cache/GeneratedCachedClassHandler.java b/weaver/src/main/java/org/aspectj/weaver/tools/cache/GeneratedCachedClassHandler.java
index 91c332b6b..91c332b6b 100644
--- a/weaver/src/org/aspectj/weaver/tools/cache/GeneratedCachedClassHandler.java
+++ b/weaver/src/main/java/org/aspectj/weaver/tools/cache/GeneratedCachedClassHandler.java
diff --git a/weaver/src/org/aspectj/weaver/tools/cache/SimpleCache.java b/weaver/src/main/java/org/aspectj/weaver/tools/cache/SimpleCache.java
index 45d718a14..45d718a14 100644
--- a/weaver/src/org/aspectj/weaver/tools/cache/SimpleCache.java
+++ b/weaver/src/main/java/org/aspectj/weaver/tools/cache/SimpleCache.java
diff --git a/weaver/src/org/aspectj/weaver/tools/cache/SimpleCacheFactory.java b/weaver/src/main/java/org/aspectj/weaver/tools/cache/SimpleCacheFactory.java
index 49569dd0e..49569dd0e 100644
--- a/weaver/src/org/aspectj/weaver/tools/cache/SimpleCacheFactory.java
+++ b/weaver/src/main/java/org/aspectj/weaver/tools/cache/SimpleCacheFactory.java
diff --git a/weaver/src/org/aspectj/weaver/tools/cache/WeavedClassCache.java b/weaver/src/main/java/org/aspectj/weaver/tools/cache/WeavedClassCache.java
index b281d412f..b281d412f 100644
--- a/weaver/src/org/aspectj/weaver/tools/cache/WeavedClassCache.java
+++ b/weaver/src/main/java/org/aspectj/weaver/tools/cache/WeavedClassCache.java
diff --git a/weaver/src/org/aspectj/weaver/tools/cache/ZippedFileCacheBacking.java b/weaver/src/main/java/org/aspectj/weaver/tools/cache/ZippedFileCacheBacking.java
index 6ee8b728c..6ee8b728c 100644
--- a/weaver/src/org/aspectj/weaver/tools/cache/ZippedFileCacheBacking.java
+++ b/weaver/src/main/java/org/aspectj/weaver/tools/cache/ZippedFileCacheBacking.java
diff --git a/weaver/src/aspectj_1_5_0.dtd b/weaver/src/main/resources/aspectj_1_5_0.dtd
index 314290333..314290333 100644
--- a/weaver/src/aspectj_1_5_0.dtd
+++ b/weaver/src/main/resources/aspectj_1_5_0.dtd
diff --git a/weaver/src/test/java/$Proxy1.java b/weaver/src/test/java/$Proxy1.java
new file mode 100644
index 000000000..51cae8b05
--- /dev/null
+++ b/weaver/src/test/java/$Proxy1.java
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andy Clement - initial API and implementation
+ *******************************************************************************/
+import java.io.Serializable;
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Proxy;
+
+public class $Proxy1 extends Proxy implements MessageService {
+
+ protected $Proxy1(InvocationHandler arg0) {
+ super(arg0);
+ }
+
+ public Object get1(Long t) {
+ return null;
+ }
+
+ public Object get2(Serializable s) {
+ return null;
+ }
+}
diff --git a/weaver/src/test/java/CounterAspect.java b/weaver/src/test/java/CounterAspect.java
new file mode 100644
index 000000000..1ca126d02
--- /dev/null
+++ b/weaver/src/test/java/CounterAspect.java
@@ -0,0 +1,52 @@
+/* *******************************************************************
+ * Copyright (c) 2008 Contributors.
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andy Clement initial implementation
+ * ******************************************************************/
+import org.aspectj.lang.annotation.Aspect;
+import org.aspectj.lang.annotation.Before;
+import org.aspectj.lang.annotation.Pointcut;
+
+/**
+ * Created to enable PointcutDesignatorHandlerTests.testParsingBeanInReferencePointcut01 and 02 to run
+ *
+ * @author Andy Clement
+ */
+@Aspect
+public class CounterAspect {
+
+ int count;
+
+ @Before("execution(* set*(..)) && bean(testBean1)")
+ public void increment1ForAnonymousPointcut() {
+ count++;
+ }
+
+ @Pointcut("execution(* toString(..)) && bean(testBean1)")
+ public void testBean1toString() {
+ }
+
+ @Pointcut("execution(* setAge(..)) && bean(testBean1)")
+ public void testBean1SetAge() {
+ }
+
+ @Pointcut("execution(* setAge(..)) && bean(testBean2)")
+ public void testBean2SetAge() {
+ }
+
+ @Before("testBean1SetAge()")
+ public void increment1() {
+ count++;
+ }
+
+ @Before("testBean2SetAge()")
+ public void increment2() {
+ count++;
+ }
+} \ No newline at end of file
diff --git a/weaver/src/test/java/GenericService.java b/weaver/src/test/java/GenericService.java
new file mode 100644
index 000000000..87f5c0419
--- /dev/null
+++ b/weaver/src/test/java/GenericService.java
@@ -0,0 +1,17 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andy Clement - initial API and implementation
+ *******************************************************************************/
+import java.io.Serializable;
+
+public interface GenericService<T extends Serializable> {
+ Object get1(T t);
+
+ Object get2(Serializable s);
+}
diff --git a/weaver/src/test/java/MA.java b/weaver/src/test/java/MA.java
new file mode 100644
index 000000000..270882586
--- /dev/null
+++ b/weaver/src/test/java/MA.java
@@ -0,0 +1,15 @@
+/* *******************************************************************
+ * Copyright (c) 2008 Contributors
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors
+ * Andy Clement
+ * ******************************************************************/
+
+public @interface MA {
+
+}
diff --git a/weaver/src/test/java/MB.java b/weaver/src/test/java/MB.java
new file mode 100644
index 000000000..3ff3eede4
--- /dev/null
+++ b/weaver/src/test/java/MB.java
@@ -0,0 +1,15 @@
+/* *******************************************************************
+ * Copyright (c) 2008 Contributors
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors
+ * Andy Clement
+ * ******************************************************************/
+
+public @interface MB {
+
+}
diff --git a/weaver/src/test/java/MC.java b/weaver/src/test/java/MC.java
new file mode 100644
index 000000000..d48133baf
--- /dev/null
+++ b/weaver/src/test/java/MC.java
@@ -0,0 +1,15 @@
+/* *******************************************************************
+ * Copyright (c) 2008 Contributors
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors
+ * Andy Clement
+ * ******************************************************************/
+
+public @interface MC {
+
+}
diff --git a/weaver/src/test/java/MD.java b/weaver/src/test/java/MD.java
new file mode 100644
index 000000000..47a61cba0
--- /dev/null
+++ b/weaver/src/test/java/MD.java
@@ -0,0 +1,15 @@
+/* *******************************************************************
+ * Copyright (c) 2008 Contributors
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors
+ * Andy Clement
+ * ******************************************************************/
+
+public @interface MD {
+
+}
diff --git a/weaver/src/test/java/MessageService.java b/weaver/src/test/java/MessageService.java
new file mode 100644
index 000000000..160aecc21
--- /dev/null
+++ b/weaver/src/test/java/MessageService.java
@@ -0,0 +1,13 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Contributors
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andy Clement - initial API and implementation
+ *******************************************************************************/
+public interface MessageService extends GenericService<Long> {
+
+}
diff --git a/weaver/testsrc/fluffy/Aspect.java b/weaver/src/test/java/fluffy/Aspect.java
index 401ce9ba8..401ce9ba8 100644
--- a/weaver/testsrc/fluffy/Aspect.java
+++ b/weaver/src/test/java/fluffy/Aspect.java
diff --git a/weaver/testsrc/fluffy/Base.java b/weaver/src/test/java/fluffy/Base.java
index 4cdb1f772..4cdb1f772 100644
--- a/weaver/testsrc/fluffy/Base.java
+++ b/weaver/src/test/java/fluffy/Base.java
diff --git a/weaver/testsrc/fluffy/Derived.java b/weaver/src/test/java/fluffy/Derived.java
index e6d848cfb..ad0842c18 100644
--- a/weaver/testsrc/fluffy/Derived.java
+++ b/weaver/src/test/java/fluffy/Derived.java
@@ -2,8 +2,6 @@ package fluffy;
import java.io.IOException;
-import org.aspectj.weaver.testcode.Base;
-
public class Derived extends Base {
public static void onlyDerived() throws IOException, CloneNotSupportedException {}
diff --git a/weaver/src/test/java/org/aspectj/matcher/tools/ReflectionWorldAdvancedPointcutExpressionTest.java b/weaver/src/test/java/org/aspectj/matcher/tools/ReflectionWorldAdvancedPointcutExpressionTest.java
new file mode 100644
index 000000000..9e16e65fb
--- /dev/null
+++ b/weaver/src/test/java/org/aspectj/matcher/tools/ReflectionWorldAdvancedPointcutExpressionTest.java
@@ -0,0 +1,30 @@
+/* *******************************************************************
+ * Copyright (c) 2008 Contributors
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andy Clement
+ * ******************************************************************/
+package org.aspectj.matcher.tools;
+
+import org.aspectj.weaver.World;
+import org.aspectj.weaver.reflect.ReflectionWorld;
+
+/**
+ * Run all the pointcut parsing/matching tests against a ReflectionWorld.
+ *
+ * @author Andy Clement
+ */
+public class ReflectionWorldAdvancedPointcutExpressionTest extends CommonAdvancedPointcutExpressionTests {
+
+ protected World getWorld() {
+ World w = new ReflectionWorld(false, getClass().getClassLoader());
+ w.setBehaveInJava5Way(true);
+ return w;
+ }
+
+}
diff --git a/weaver/testsrc/org/aspectj/weaver/AbstractTraceTest.java b/weaver/src/test/java/org/aspectj/weaver/AbstractTraceTest.java
index 334690b62..334690b62 100644
--- a/weaver/testsrc/org/aspectj/weaver/AbstractTraceTest.java
+++ b/weaver/src/test/java/org/aspectj/weaver/AbstractTraceTest.java
diff --git a/weaver/src/test/java/org/aspectj/weaver/AllWeaver5Tests.java b/weaver/src/test/java/org/aspectj/weaver/AllWeaver5Tests.java
new file mode 100644
index 000000000..6ce2e0354
--- /dev/null
+++ b/weaver/src/test/java/org/aspectj/weaver/AllWeaver5Tests.java
@@ -0,0 +1,40 @@
+///* *******************************************************************
+// * Copyright (c) 2005-2006 Contributors.
+// * All rights reserved.
+// * This program and the accompanying materials are made available
+// * under the terms of the Eclipse Public License v1.0
+// * which accompanies this distribution and is available at
+// * http://eclipse.org/legal/epl-v10.html
+// *
+// * Contributors:
+// * Adrian Colyer Initial implementation
+// * Matthew Webster Move from default package
+// * ******************************************************************/
+//package org.aspectj.weaver;
+//
+//import junit.framework.Test;
+//import junit.framework.TestSuite;
+//
+//import org.aspectj.weaver.reflect.ReflectionWorldReferenceTypeTest;
+//import org.aspectj.weaver.reflect.ReflectionWorldSpecificTest;
+//import org.aspectj.weaver.tools.PointcutExpressionTest;
+//
+//public class AllWeaver5Tests {
+//
+// public static Test suite() {
+// TestSuite suite = new TestSuite(AllWeaver5Tests.class.getName());
+// // $JUnit-BEGIN$
+// suite.addTest(AllTracing5Tests.suite());
+// suite.addTest(BcweaverModule15Test.suite());
+// suite.addTestSuite(ReflectionWorldReferenceTypeTest.class);
+// suite.addTestSuite(PointcutExpressionTest.class);
+// suite.addTestSuite(JoinPointSignatureIteratorTest.class);
+// // gives incompatible class version error...
+// // suite.addTestSuite(ReflectionWorldAdvancedPointcutExpressionTests.class
+// // );
+// suite.addTestSuite(ReflectionWorldSpecificTest.class);
+// // $JUnit-END$
+// return suite;
+// }
+//
+//}
diff --git a/weaver/src/test/java/org/aspectj/weaver/BcweaverModule15Test.java b/weaver/src/test/java/org/aspectj/weaver/BcweaverModule15Test.java
new file mode 100644
index 000000000..8455315ff
--- /dev/null
+++ b/weaver/src/test/java/org/aspectj/weaver/BcweaverModule15Test.java
@@ -0,0 +1,41 @@
+//package org.aspectj.weaver;
+//
+///* *******************************************************************
+// * Copyright (c) 2005 Contributors.
+// * All rights reserved.
+// * This program and the accompanying materials are made available
+// * under the terms of the Eclipse Public License v1.0
+// * which accompanies this distribution and is available at
+// * http://eclipse.org/legal/epl-v10.html
+// *
+// * Contributors:
+// * Adrian Colyer Initial implementation
+// * ******************************************************************/
+//import junit.framework.Test;
+//import junit.framework.TestCase;
+//import junit.framework.TestSuite;
+//
+//import org.aspectj.weaver.bcel.BcelGenericSignatureToTypeXTestCase;
+//import org.aspectj.weaver.bcel.BcelWorldReferenceTypeTest;
+//import org.aspectj.weaver.patterns.WildTypePatternResolutionTestCase;
+//import org.aspectj.weaver.tools.Java15PointcutExpressionTest;
+//
+//public class BcweaverModule15Test extends TestCase {
+// public static Test suite() {
+// TestSuite suite = new TestSuite(BcweaverModule15Test.class.getName());
+// suite.addTestSuite(BcelGenericSignatureToTypeXTestCase.class);
+// suite.addTestSuite(BoundedReferenceTypeTestCase.class);
+// suite.addTest(Java15PointcutExpressionTest.suite());
+// suite.addTestSuite(Member15Test.class);
+// suite.addTestSuite(BcelWorldReferenceTypeTest.class);
+// suite.addTest(Java5ReflectionBasedReferenceTypeDelegateTest.suite());
+// suite.addTestSuite(TypeVariableTestCase.class);
+// suite.addTestSuite(TypeVariableReferenceTypeTestCase.class);
+// suite.addTestSuite(WildTypePatternResolutionTestCase.class);
+// return suite;
+// }
+//
+// public BcweaverModule15Test(String name) {
+// super(name);
+// }
+//}
diff --git a/weaver/testsrc/org/aspectj/weaver/BoundedReferenceTypeTestCase.java b/weaver/src/test/java/org/aspectj/weaver/BoundedReferenceTypeTestCase.java
index 403b2ecb1..403b2ecb1 100644
--- a/weaver/testsrc/org/aspectj/weaver/BoundedReferenceTypeTestCase.java
+++ b/weaver/src/test/java/org/aspectj/weaver/BoundedReferenceTypeTestCase.java
diff --git a/weaver/src/test/java/org/aspectj/weaver/CommonReferenceTypeTests.java b/weaver/src/test/java/org/aspectj/weaver/CommonReferenceTypeTests.java
new file mode 100644
index 000000000..8d683e8af
--- /dev/null
+++ b/weaver/src/test/java/org/aspectj/weaver/CommonReferenceTypeTests.java
@@ -0,0 +1,91 @@
+/* *******************************************************************
+ * Copyright (c) 2005 Contributors.
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Adrian Colyer Initial implementation
+ * ******************************************************************/
+package org.aspectj.weaver;
+
+import junit.framework.TestCase;
+
+// test cases for Adrian's additions to ReferenceType
+// XXX - couldn't find any unit test cases for the rest of the ReferenceType class
+public abstract class CommonReferenceTypeTests extends TestCase {
+
+ private World world;
+
+ public abstract World getWorld();
+
+ public void setUp() {
+ world = getWorld();
+ }
+
+ public void testUnresolvedTypeSignatureProcessing() {
+ world.setBehaveInJava5Way(true);
+ UnresolvedType ut = null;
+ ut = UnresolvedType.forName("java.util.List<java.util.List<java.lang.String>>[]").resolve(world);
+ ut = UnresolvedType.forSignature("[Pjava/util/List<Pjava/util/List<Ljava/lang/String;>;>;").resolve(world);
+ assertEquals("Signatures not equal ", "[Pjava/util/List<Pjava/util/List<Ljava/lang/String;>;>;", ut.getSignature());
+ assertEquals("Names not equal ", "java.util.List<java.util.List<java.lang.String>>[]", ut.getName());
+ }
+
+ public void testArrays() {
+ world.setBehaveInJava5Way(true);
+ UnresolvedType ut = null;
+ ut = UnresolvedType.forName("[Ljava.lang.String;");
+ assertEquals("[Ljava/lang/String;",ut.getSignature());
+ UnresolvedType reified = UnresolvedType.forSignature(ut.getSignature());
+ ResolvedType rt = world.resolve(reified);
+ assertEquals("[Ljava/lang/String;",rt.getSignature());
+ assertEquals("java.lang.String[]",rt.getName());
+ assertFalse(rt.isMissing());
+
+ ut = UnresolvedType.forName("[[[[Ljava.lang.String;");
+ assertEquals("[[[[Ljava/lang/String;",ut.getSignature());
+ reified = UnresolvedType.forSignature(ut.getSignature());
+ rt = world.resolve(reified);
+ assertEquals("[[[[Ljava/lang/String;",rt.getSignature());
+ assertEquals("java.lang.String[][][][]",rt.getName());
+ assertTrue(rt.isArray());
+ assertTrue(rt.getComponentType().isArray());
+ assertFalse(rt.isMissing());
+ }
+
+ public void testIsRawTrue() {
+ world.setBehaveInJava5Way(true);
+ UnresolvedType javaLangClass = UnresolvedType.forName("java.lang.Class");
+ ResolvedType rtx = world.resolve(javaLangClass);
+ assertTrue("Resolves to reference type", (rtx instanceof ReferenceType));
+ ReferenceType rt = (ReferenceType) rtx;
+ assertTrue("java.lang.Class is raw", rt.isRawType());
+ }
+
+ public void testIsRawFalse() {
+ world.setBehaveInJava5Way(true);
+ UnresolvedType javaLangObject = UnresolvedType.forName("java.lang.Object");
+ ResolvedType rtx = world.resolve(javaLangObject);
+ assertTrue("Resolves to reference type", (rtx instanceof ReferenceType));
+ ReferenceType rt = (ReferenceType) rtx;
+ assertFalse("java.lang.Object is not raw", rt.isRawType());
+ }
+
+ public void testIsGenericTrue() {
+ world.setBehaveInJava5Way(true);
+ UnresolvedType javaLangClass = UnresolvedType.forName("java.lang.Class");
+ ResolvedType rtx = world.resolve(javaLangClass);
+ assertTrue("java.lang.Class has underpinning generic type", rtx.getGenericType().isGenericType());
+ }
+
+ public void testIsGenericFalse() {
+ world.setBehaveInJava5Way(true);
+ UnresolvedType javaLangObject = UnresolvedType.forName("java.lang.Object");
+ ResolvedType rtx = world.resolve(javaLangObject);
+ assertFalse(rtx.isGenericType());
+ }
+
+}
diff --git a/weaver/testsrc/org/aspectj/weaver/CommonsTraceFactoryTest.java b/weaver/src/test/java/org/aspectj/weaver/CommonsTraceFactoryTest.java
index ecdaf63de..ecdaf63de 100644
--- a/weaver/testsrc/org/aspectj/weaver/CommonsTraceFactoryTest.java
+++ b/weaver/src/test/java/org/aspectj/weaver/CommonsTraceFactoryTest.java
diff --git a/weaver/testsrc/org/aspectj/weaver/CommonsTraceTest.java b/weaver/src/test/java/org/aspectj/weaver/CommonsTraceTest.java
index ac6a8cec3..ac6a8cec3 100644
--- a/weaver/testsrc/org/aspectj/weaver/CommonsTraceTest.java
+++ b/weaver/src/test/java/org/aspectj/weaver/CommonsTraceTest.java
diff --git a/weaver/testsrc/org/aspectj/weaver/DefaultTraceFactoryTest.java b/weaver/src/test/java/org/aspectj/weaver/DefaultTraceFactoryTest.java
index 16d14bfb6..16d14bfb6 100644
--- a/weaver/testsrc/org/aspectj/weaver/DefaultTraceFactoryTest.java
+++ b/weaver/src/test/java/org/aspectj/weaver/DefaultTraceFactoryTest.java
diff --git a/weaver/testsrc/org/aspectj/weaver/DefaultTraceTest.java b/weaver/src/test/java/org/aspectj/weaver/DefaultTraceTest.java
index a8313c4fb..a8313c4fb 100644
--- a/weaver/testsrc/org/aspectj/weaver/DefaultTraceTest.java
+++ b/weaver/src/test/java/org/aspectj/weaver/DefaultTraceTest.java
diff --git a/weaver/testsrc/org/aspectj/weaver/DumpTestCase.java b/weaver/src/test/java/org/aspectj/weaver/DumpTestCase.java
index affd39c2c..affd39c2c 100644
--- a/weaver/testsrc/org/aspectj/weaver/DumpTestCase.java
+++ b/weaver/src/test/java/org/aspectj/weaver/DumpTestCase.java
diff --git a/weaver/testsrc/org/aspectj/weaver/GenericSignatureParserTest.java b/weaver/src/test/java/org/aspectj/weaver/GenericSignatureParserTest.java
index e5948eb40..e5948eb40 100644
--- a/weaver/testsrc/org/aspectj/weaver/GenericSignatureParserTest.java
+++ b/weaver/src/test/java/org/aspectj/weaver/GenericSignatureParserTest.java
diff --git a/weaver/src/test/java/org/aspectj/weaver/Java5ReflectionBasedReferenceTypeDelegateTest.java b/weaver/src/test/java/org/aspectj/weaver/Java5ReflectionBasedReferenceTypeDelegateTest.java
new file mode 100644
index 000000000..9f6a2965e
--- /dev/null
+++ b/weaver/src/test/java/org/aspectj/weaver/Java5ReflectionBasedReferenceTypeDelegateTest.java
@@ -0,0 +1,154 @@
+/* *******************************************************************
+ * Copyright (c) 2005-2017 Contributors.
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andrew Clement Initial implementation
+ * ******************************************************************/
+
+package org.aspectj.weaver;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.reflect.Field;
+
+import org.aspectj.weaver.reflect.ReflectionBasedReferenceTypeDelegateTest;
+
+public class Java5ReflectionBasedReferenceTypeDelegateTest extends ReflectionBasedReferenceTypeDelegateTest {
+
+ public static Test suite() {
+ TestSuite suite = new TestSuite("TestJava5ReflectionBasedReferenceTypeDelegate");
+ suite.addTestSuite(Java5ReflectionBasedReferenceTypeDelegateTest.class);
+ return suite;
+ }
+
+ /**
+ * Let's play about with a generic type and ensure we can work with it in a reflective world.
+ */
+ public void testResolveGeneric() {
+ UnresolvedType collectionType = UnresolvedType.forName("java.util.Collection");
+ world.resolve(collectionType).getRawType().resolve(world);
+ ResolvedMember[] methods = world.resolve(collectionType).getDeclaredMethods();
+ int i = -1;
+ for (int j=0;j<methods.length;j++) {
+ ResolvedMember method = methods[j];
+ if (method.getName().equals("toArray") && method.getParameterSignature().equals("([TT;)")) {
+ i = j;
+ }
+ }
+ assertTrue("Couldn't find 'toArray' in the set of methods? ", i != -1);
+ // String expectedSignature = "java.lang.Object[] java.util.Collection.toArray(java.lang.Object[])";
+ String expectedSignature = "([Ljava/lang/Object;)[Ljava/lang/Object;";
+
+ assertTrue("Expected signature of '" + expectedSignature + "' but it was '" + methods[i].getSignatureErased(), methods[i]
+ .getSignatureErased().equals(expectedSignature));
+ }
+
+ /**
+ * Can we resolve the dreaded Enum type...
+ */
+ public void testResolveEnum() {
+ ResolvedType enumType = world.resolve("java.lang.Enum");
+ assertTrue("Should be the raw type but is " + enumType.typeKind, enumType.isRawType());
+ ResolvedType theGenericEnumType = enumType.getGenericType();
+ assertTrue("Should have a type variable ", theGenericEnumType.getTypeVariables().length > 0);
+ TypeVariable tv = theGenericEnumType.getTypeVariables()[0];
+ String expected = "TypeVar E extends java.lang.Enum<E>";
+ assertTrue("Type variable should be '" + expected + "' but is '" + tv + "'", tv.toString().equals(expected));
+ }
+
+ public void testResolveClass() {
+ world.resolve("java.lang.Class").getGenericType();
+ }
+
+ public void testGenericInterfaceSuperclass_ReflectionWorldResolution() {
+
+ UnresolvedType javaUtilMap = UnresolvedType.forName("java.util.Map");
+
+ ReferenceType rawType = (ReferenceType) world.resolve(javaUtilMap);
+ assertTrue("Should be the raw type ?!? " + rawType.getTypekind(), rawType.isRawType());
+
+ ReferenceType genericType = (ReferenceType) rawType.getGenericType();
+ assertTrue("Should be the generic type ?!? " + genericType.getTypekind(), genericType.isGenericType());
+
+ ResolvedType rt = rawType.getSuperclass();
+ assertTrue("Superclass for Map raw type should be Object but was " + rt, rt.equals(UnresolvedType.OBJECT));
+
+ ResolvedType rt2 = genericType.getSuperclass();
+ assertTrue("Superclass for Map generic type should be Object but was " + rt2, rt2.equals(UnresolvedType.OBJECT));
+ }
+
+ /**
+ * This is testing the optimization in the reflective annotation finder to verify that if you only want runtime
+ * annotation info then we use reflection and don't go digging through the classfile bytes.
+ */
+ public void testAnnotationFinderClassRetention() throws Exception {
+ ResolvedType type = world.resolve(AnnoTesting.class.getName());
+ ResolvedMember[] ms = type.getDeclaredMethods();
+ int findMethod = findMethod("a", ms);
+
+ ResolvedMember methodWithOnlyClassLevelAnnotation = ms[findMethod("a", ms)];
+ ResolvedMember methodWithOnlyRuntimeLevelAnnotation = ms[findMethod("b", ms)];
+ ResolvedMember methodWithClassAndRuntimeLevelAnnotations = ms[findMethod("c", ms)];
+ ResolvedMember methodWithClassAndRuntimeLevelAnnotations2 = ms[findMethod("d", ms)];
+
+ assertTrue(methodWithOnlyClassLevelAnnotation.hasAnnotation(world.resolve(AnnoClass.class.getName())));
+ assertTrue(methodWithOnlyRuntimeLevelAnnotation.hasAnnotation(world.resolve(AnnoRuntime.class.getName())));
+
+ // This is the tricky scenario.
+
+ // When asking about the runtime level annotations it should not go digging into bcel
+ assertTrue(methodWithClassAndRuntimeLevelAnnotations.hasAnnotation(world.resolve(AnnoRuntime.class.getName())));
+
+ Field annotationsField = ResolvedMemberImpl.class.getDeclaredField("annotationTypes");
+ annotationsField.setAccessible(true);
+ ResolvedType[] annoTypes = (ResolvedType[])annotationsField.get(methodWithClassAndRuntimeLevelAnnotations);
+
+ // Should only be the runtime one here
+ assertEquals(1, annoTypes.length);
+
+ // But when you do ask again and this time for class level, it should redo the unpack and pull both runtime and class out
+ assertTrue(methodWithClassAndRuntimeLevelAnnotations.hasAnnotation(world.resolve(AnnoClass.class.getName())));
+
+ annotationsField.setAccessible(true);
+ annoTypes = (ResolvedType[])annotationsField.get(methodWithClassAndRuntimeLevelAnnotations);
+
+ // Now both should be there
+ assertEquals(2, annoTypes.length);
+
+ assertTrue(methodWithClassAndRuntimeLevelAnnotations2.hasAnnotation(world.resolve(AnnoRuntime.class.getName())));
+ // now ask for 'all annotations' via another route, this should reunpack and get them all
+ ResolvedType[] annotations = methodWithClassAndRuntimeLevelAnnotations2.getAnnotationTypes();
+ assertEquals(2,annotations.length);
+ }
+
+ @Retention(RetentionPolicy.CLASS)
+ @interface AnnoClass {}
+
+ @Retention(RetentionPolicy.RUNTIME)
+ @interface AnnoRuntime {}
+
+ class AnnoTesting {
+
+ @AnnoClass
+ public void a() {}
+
+ @AnnoRuntime
+ public void b() {}
+
+ @AnnoClass @AnnoRuntime
+ public void c() {}
+
+ @AnnoClass @AnnoRuntime
+ public void d() {}
+
+ }
+
+} \ No newline at end of file
diff --git a/weaver/testsrc/org/aspectj/weaver/AllTracingTests.java b/weaver/src/test/java/org/aspectj/weaver/Jdk14TraceFactoryTest.java
index 81a952903..cec4d6a3d 100644
--- a/weaver/testsrc/org/aspectj/weaver/AllTracingTests.java
+++ b/weaver/src/test/java/org/aspectj/weaver/Jdk14TraceFactoryTest.java
@@ -10,21 +10,21 @@
*******************************************************************************/
package org.aspectj.weaver;
-import junit.framework.Test;
-import junit.framework.TestSuite;
+import junit.framework.TestCase;
-public class AllTracingTests {
+import org.aspectj.weaver.tools.Jdk14TraceFactory;
+import org.aspectj.weaver.tools.Trace;
- public static Test suite() {
- TestSuite suite = new TestSuite(AllTracingTests.class.getName());
- //$JUnit-BEGIN$
- suite.addTestSuite(TraceFactoryTest.class);
- suite.addTestSuite(DefaultTraceFactoryTest.class);
- suite.addTestSuite(DefaultTraceTest.class);
- suite.addTestSuite(CommonsTraceFactoryTest.class);
- suite.addTestSuite(CommonsTraceTest.class);
- //$JUnit-END$
- return suite;
+public class Jdk14TraceFactoryTest extends TestCase {
+
+ public void testJdk14TraceFactory() {
+ new Jdk14TraceFactory();
+ }
+
+ public void testGetTrace() {
+ Jdk14TraceFactory factory = new Jdk14TraceFactory();
+ Trace trace = factory.getTrace(getClass());
+ assertFalse("Tracing should be disbled by default",trace.isTraceEnabled());
}
}
diff --git a/weaver/src/test/java/org/aspectj/weaver/Jdk14TraceTest.java b/weaver/src/test/java/org/aspectj/weaver/Jdk14TraceTest.java
new file mode 100644
index 000000000..0c694cc9d
--- /dev/null
+++ b/weaver/src/test/java/org/aspectj/weaver/Jdk14TraceTest.java
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * Copyright (c) 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Matthew Webster - initial implementation
+ *******************************************************************************/
+package org.aspectj.weaver;
+
+import org.aspectj.weaver.tools.DefaultTrace;
+import org.aspectj.weaver.tools.Jdk14Trace;
+
+public class Jdk14TraceTest extends AbstractTraceTest {
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ trace = new Jdk14Trace(getClass());
+ trace.setTraceEnabled(true);
+ }
+
+ public void testJdk14Trace() {
+ new Jdk14Trace(getClass());
+ }
+
+ public void testSetTraceEnabled() {
+ DefaultTrace trace = new DefaultTrace(getClass());
+ trace.setTraceEnabled(true);
+ assertTrue(trace.isTraceEnabled());
+ }
+
+}
diff --git a/weaver/src/test/java/org/aspectj/weaver/JoinPointSignatureIteratorTest.java b/weaver/src/test/java/org/aspectj/weaver/JoinPointSignatureIteratorTest.java
new file mode 100644
index 000000000..143de7333
--- /dev/null
+++ b/weaver/src/test/java/org/aspectj/weaver/JoinPointSignatureIteratorTest.java
@@ -0,0 +1,107 @@
+/* *******************************************************************
+ * Copyright (c) 2009 Contributors.
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andy Clement
+ * ******************************************************************/
+package org.aspectj.weaver;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import junit.framework.TestCase;
+
+import org.aspectj.weaver.reflect.ReflectionWorld;
+
+/**
+ * @author Andy Clement
+ */
+public class JoinPointSignatureIteratorTest extends TestCase {
+
+ private World getWorld() {
+ return new ReflectionWorld(getClass().getClassLoader());
+ }
+
+ /**
+ * Checking the signatures for a dynamic proxy - which is created using erased information and so is completely generics unaware
+ */
+ public void testPr268419() {
+ World w = getWorld();
+ w.setBehaveInJava5Way(true);
+
+ // The proxy class here is not generated, it is simply loaded up. $Proxy1 is in the java5-testsrc folder, but it
+ // obeys the rules of a generated proxy in that it extends java.lang.reflect.Proxy
+ ResolvedType proxy = UnresolvedType.forName("$Proxy1").resolve(w);
+ assertNotNull(proxy);
+
+ // The test hierarchy here (messageservice and genericservice) contains 2 methods. One is generic
+ // and one is not. The aim of the test here is that the join point signatures generated for both
+ // should be the same because of the use of a proxy.
+
+ List l = proxy.getMethodsWithoutIterator(false, false, false);
+ for (Object object : l) {
+ ResolvedMember rm = (ResolvedMember) object;
+ if (expectedResults.containsKey(rm.toString())) {
+ System.out.println("\nChecking: " + rm);
+ int i = 0;
+ List/* String */sigs = (List) expectedResults.get(rm.toString());
+ Iterator jpsi = rm.getJoinPointSignatures(w);
+ while (jpsi.hasNext()) {
+ ResolvedMember sig = (ResolvedMember) jpsi.next();
+ assertEquals(sigs.get(i).toString(), sig.toString());
+ i++;
+ }
+ if (i != sigs.size()) {
+ fail("Expected " + sigs.size() + " signatures but got " + i);
+ }
+ } else {
+ if (rm.getName().equals("get1") || rm.getName().equals("get2")) {
+ fail("\nFound this unchecked get method " + rm);
+ // Iterator jpsi = rm.getJoinPointSignatures(w);
+ // while (jpsi.hasNext()) {
+ // ResolvedMember sig = (ResolvedMember) jpsi.next();
+ // System.out.println(sig);
+ // }
+ }
+ }
+ }
+ }
+
+ public static Map expectedResults = new HashMap();
+
+ static {
+ List sigs = new ArrayList();
+ sigs.add("java.lang.Object $Proxy1.get1(java.io.Serializable)");
+ sigs.add("java.lang.Object MessageService.get1(java.io.Serializable)");
+ sigs.add("java.lang.Object GenericService.get1(java.io.Serializable)");
+ sigs.add("java.lang.Object GenericService.get1(java.io.Serializable)");
+ expectedResults.put("java.lang.Object $Proxy1.get1(java.io.Serializable)", sigs);
+
+ sigs = new ArrayList();
+ sigs.add("java.lang.Object $Proxy1.get2(java.io.Serializable)");
+ sigs.add("java.lang.Object MessageService.get2(java.io.Serializable)");
+ sigs.add("java.lang.Object GenericService.get2(java.io.Serializable)");
+ sigs.add("java.lang.Object GenericService.get2(java.io.Serializable)");
+ expectedResults.put("java.lang.Object $Proxy1.get2(java.io.Serializable)", sigs);
+
+ sigs = new ArrayList();
+ sigs.add("java.lang.Object $Proxy1.get1(java.lang.Long)");
+ expectedResults.put("java.lang.Object $Proxy1.get1(java.lang.Long)", sigs);
+
+ sigs = new ArrayList();
+ sigs.add("java.lang.Object GenericService.get1(java.io.Serializable)");
+ expectedResults.put("java.lang.Object GenericService.get1(java.io.Serializable)", sigs);
+
+ sigs = new ArrayList();
+ sigs.add("java.lang.Object GenericService.get2(java.io.Serializable)");
+ expectedResults.put("java.lang.Object GenericService.get2(java.io.Serializable)", sigs);
+ }
+}
diff --git a/weaver/testsrc/org/aspectj/weaver/LocaleTest.java b/weaver/src/test/java/org/aspectj/weaver/LocaleTest.java
index e69a4df93..e69a4df93 100644
--- a/weaver/testsrc/org/aspectj/weaver/LocaleTest.java
+++ b/weaver/src/test/java/org/aspectj/weaver/LocaleTest.java
diff --git a/weaver/src/test/java/org/aspectj/weaver/Member15Test.java b/weaver/src/test/java/org/aspectj/weaver/Member15Test.java
new file mode 100644
index 000000000..6cb0ce83f
--- /dev/null
+++ b/weaver/src/test/java/org/aspectj/weaver/Member15Test.java
@@ -0,0 +1,155 @@
+/* *******************************************************************
+ * Copyright (c) 2005 Contributors.
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Adrian Colyer Initial implementation
+ * ******************************************************************/
+package org.aspectj.weaver;
+
+import org.aspectj.weaver.bcel.BcelWorld;
+
+import junit.framework.TestCase;
+
+/**
+ * @author colyer
+ * @author clement
+ */
+public class Member15Test extends TestCase {
+
+ public void testCanBeParameterizedRegularMethod() {
+ BcelWorld world = new BcelWorld();
+ ResolvedType javaLangClass = world.resolve(UnresolvedType.forName("java/lang/Class"));
+ ResolvedMember[] methods = javaLangClass.getDeclaredMethods();
+ ResolvedMember getAnnotations = null;
+ for (int i = 0; i < methods.length; i++) {
+ if (methods[i].getName().equals("getAnnotations")) {
+ getAnnotations = methods[i];
+ break;
+ }
+ }
+ if (getAnnotations != null) { // so can run on non-Java 5
+// System.out.println("got it");
+ assertFalse(getAnnotations.canBeParameterized());
+ }
+ }
+
+ public void testCanBeParameterizedGenericMethod() {
+ BcelWorld world = new BcelWorld();
+ world.setBehaveInJava5Way(true);
+ ResolvedType javaLangClass = world.resolve(UnresolvedType.forName("java.lang.Class"));
+ javaLangClass = javaLangClass.getGenericType();
+ if (javaLangClass == null) return; // for < 1.5
+ ResolvedMember[] methods = javaLangClass.getDeclaredMethods();
+ ResolvedMember asSubclass = null;
+ for (int i = 0; i < methods.length; i++) {
+ if (methods[i].getName().equals("asSubclass")) {
+ asSubclass = methods[i];
+ break;
+ }
+ }
+ if (asSubclass != null) { // so can run on non-Java 5
+// System.out.println("got it");
+ assertTrue(asSubclass.canBeParameterized());
+ }
+ }
+
+ public void testCanBeParameterizedMethodInGenericType() {
+ BcelWorld world = new BcelWorld();
+ world.setBehaveInJava5Way(true);
+ ResolvedType javaUtilList = world.resolve(UnresolvedType.forName("java.util.List"));
+ javaUtilList = javaUtilList.getGenericType();
+ if (javaUtilList == null) return; // for < 1.5
+ ResolvedMember[] methods = javaUtilList.getDeclaredMethods();
+ ResolvedMember add = null;
+ for (int i = 0; i < methods.length; i++) {
+ if (methods[i].getName().equals("add")) {
+ add = methods[i];
+ break;
+ }
+ }
+ if (add != null) { // so can run on non-Java 5
+// System.out.println("got it");
+ assertTrue(add.canBeParameterized());
+ }
+ }
+ /*
+ public void testGenericReferenceTypeCreation() {
+ UnresolvedType genericType = UnresolvedType.forGenericTypeSignature("Lorg/aspectj/weaver/MemberTestCase15$One;","<T:Ljava/lang/Object;>Ljava/lang/Object;");
+ assertEquals("Porg/aspectj/weaver/MemberTestCase15$One<TT;>;",genericType.getSignature());
+ assertEquals("Lorg/aspectj/weaver/MemberTestCase15$One;",genericType.getErasureSignature());
+ }
+
+ public void testMemberSignatureCreation() {
+ World world = new BcelWorld("../weaver5/bin/");
+ //new ReflectionWorld(false, getClass().getClassLoader());
+ world.setBehaveInJava5Way(true);
+ ResolvedType one = world.resolve("org.aspectj.weaver.MemberTestCase15$One<java.lang.String>");
+ assertNotNull(one);
+ assertFalse(one.isMissing());
+
+ // Look at the methods on the parameterized type One<String>
+ ResolvedMember member = findMethod("getter",one);
+ String erasedSignature = MemberImpl.typesToSignature(member.getReturnType(),member.getParameterTypes(),true);
+ assertEquals("()Ljava/lang/String;",erasedSignature);
+ String nonErasedSignature = MemberImpl.typesToSignature(member.getReturnType(),member.getParameterTypes(),false);
+ assertEquals("()Ljava/lang/String;",nonErasedSignature);
+ erasedSignature = MemberImpl.typesToSignature(member.getReturnType(),member.getParameterTypes(),true);
+ assertEquals("()Ljava/lang/String;",erasedSignature);
+ nonErasedSignature = MemberImpl.typesToSignature(member.getReturnType(),member.getParameterTypes(),false);
+ assertEquals("()Ljava/lang/String;",nonErasedSignature);
+
+ member = findMethod("getterTwo",one);
+ erasedSignature = MemberImpl.typesToSignature(member.getReturnType(),member.getParameterTypes(),true);
+ assertEquals("()Ljava/util/List;",erasedSignature);
+ nonErasedSignature = MemberImpl.typesToSignature(member.getReturnType(),member.getParameterTypes(),false);
+ assertEquals("()Pjava/util/List<Ljava/lang/String;>;",nonErasedSignature);
+ nonErasedSignature = MemberImpl.typesToSignature(member.getGenericReturnType(),member.getGenericParameterTypes(),true);
+ assertEquals("()Ljava/util/List;",nonErasedSignature);
+ nonErasedSignature = MemberImpl.typesToSignature(member.getGenericReturnType(),member.getGenericParameterTypes(),false);
+ assertEquals("()Pjava/util/List<Ljava/lang/String;>;",nonErasedSignature);
+
+ // Grab the generic type backing the parameterized type
+ ResolvedType oneGeneric = one.getGenericType();
+ assertTrue(oneGeneric.isGenericType());
+ member = findMethod("getterTwo",oneGeneric);
+ erasedSignature = MemberImpl.typesToSignature(member.getReturnType(),member.getParameterTypes(),true);
+ assertEquals("()Ljava/util/List;",erasedSignature);
+ erasedSignature = MemberImpl.typesToSignature(member.getReturnType(),member.getParameterTypes(),false);
+ assertEquals("()Ljava/util/List;",erasedSignature);
+ nonErasedSignature = MemberImpl.typesToSignature(member.getReturnType(),member.getParameterTypes(),false);
+ assertEquals("()Pjava/util/List<TT;>;",nonErasedSignature);
+ nonErasedSignature = MemberImpl.typesToSignature(member.getGenericReturnType(),member.getGenericParameterTypes(),false);
+ assertEquals("()Ljava/util/List;",nonErasedSignature);
+
+
+ ResolvedType oneRaw = oneGeneric.getRawType();
+ member = findMethod("getterTwo",oneRaw);
+ }
+
+ private ResolvedMember findMethod(String name, ResolvedType type) {
+ ResolvedMember[] members = type.getDeclaredMethods();
+ for (ResolvedMember member: members) {
+ if (member.getName().equals(name)) {
+ return member;
+ }
+ }
+ return null;
+ }
+
+ // testcode
+ class One<T> {
+ T t;
+ T getter() {
+ return null;
+ }
+ List<T> getterTwo() {
+ return null;
+ }
+ }
+ */
+}
diff --git a/weaver/testsrc/org/aspectj/weaver/MemberTestCase15.java b/weaver/src/test/java/org/aspectj/weaver/Member15TestCase.java
index 8014289e7..3b37d5ba8 100644
--- a/weaver/testsrc/org/aspectj/weaver/MemberTestCase15.java
+++ b/weaver/src/test/java/org/aspectj/weaver/Member15TestCase.java
@@ -19,7 +19,7 @@ import junit.framework.TestCase;
* @author colyer
*
*/
-public class MemberTestCase15 extends TestCase {
+public class Member15TestCase extends TestCase {
public void testCanBeParameterizedRegularMethod() {
BcelWorld world = new BcelWorld();
diff --git a/weaver/testsrc/org/aspectj/weaver/MemberTestCase.java b/weaver/src/test/java/org/aspectj/weaver/MemberTestCase.java
index c4755a3db..c4755a3db 100644
--- a/weaver/testsrc/org/aspectj/weaver/MemberTestCase.java
+++ b/weaver/src/test/java/org/aspectj/weaver/MemberTestCase.java
diff --git a/weaver/testsrc/org/aspectj/weaver/ParameterizedReferenceTypeTestCase.java b/weaver/src/test/java/org/aspectj/weaver/ParameterizedReferenceTypeTestCase.java
index 77379318d..8e04d8c53 100644
--- a/weaver/testsrc/org/aspectj/weaver/ParameterizedReferenceTypeTestCase.java
+++ b/weaver/src/test/java/org/aspectj/weaver/ParameterizedReferenceTypeTestCase.java
@@ -37,7 +37,9 @@ public class ParameterizedReferenceTypeTestCase extends TestCase {
if (methods[i].getName().equals("add")) {
if (methods[i].getParameterTypes().length == 1) {
add = methods[i];
- break;
+ System.out.println(add);
+// j8: boolean java.util.List<java.lang.String>.add(java.lang.Object)
+// break;
}
}
}
@@ -75,6 +77,7 @@ public class ParameterizedReferenceTypeTestCase extends TestCase {
protected void setUp() throws Exception {
super.setUp();
world = new BcelWorld();
+ world.setBehaveInJava5Way(true);
listOfString = (ReferenceType)
TypeFactory.createTypeFromSignature("Pjava/util/List<Ljava/lang/String;>;").resolve(world);
}
diff --git a/weaver/src/test/java/org/aspectj/weaver/ReferenceTypeTestCase.java b/weaver/src/test/java/org/aspectj/weaver/ReferenceTypeTestCase.java
new file mode 100644
index 000000000..5fbc530e7
--- /dev/null
+++ b/weaver/src/test/java/org/aspectj/weaver/ReferenceTypeTestCase.java
@@ -0,0 +1,854 @@
+/* *******************************************************************
+ * Copyright (c) 2005 Contributors.
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Adrian Colyer Initial implementation
+ * ******************************************************************/
+package org.aspectj.weaver;
+
+import java.rmi.RemoteException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Random;
+
+import junit.framework.TestCase;
+
+import org.aspectj.util.PartialOrder;
+import org.aspectj.weaver.bcel.BcelWorld;
+
+// test cases for Adrian's additions to ReferenceType
+// XXX - couldn't find any unit test cases for the rest of the ReferenceType class
+public class ReferenceTypeTestCase extends TestCase {
+
+ public void testIsRawTrue() {
+ BcelWorld world = new BcelWorld();
+ world.setBehaveInJava5Way(true);
+ UnresolvedType javaLangClass = UnresolvedType.forName("java.lang.Class");
+ ResolvedType rtx = world.resolve(javaLangClass);
+ assertTrue("Resolves to reference type", (rtx instanceof ReferenceType));
+ ReferenceType rt = (ReferenceType) rtx;
+ assertTrue("java.lang.Class is raw", rt.isRawType());
+ }
+
+ public void testIsRawFalse() {
+ BcelWorld world = new BcelWorld();
+ world.setBehaveInJava5Way(true);
+ UnresolvedType javaLangObject = UnresolvedType.forName("java.lang.Object");
+ ResolvedType rtx = world.resolve(javaLangObject);
+ assertTrue("Resolves to reference type", (rtx instanceof ReferenceType));
+ ReferenceType rt = (ReferenceType) rtx;
+ assertFalse("java.lang.Object is not raw", rt.isRawType());
+ }
+
+ public void testIsGenericTrue() {
+ BcelWorld world = new BcelWorld();
+ world.setBehaveInJava5Way(true);
+ UnresolvedType javaLangClass = UnresolvedType.forName("java.lang.Class");
+ ResolvedType rtx = world.resolve(javaLangClass);
+ assertTrue("java.lang.Class has underpinning generic type", rtx.getGenericType().isGenericType());
+ }
+
+ public void testIsGenericFalse() {
+ BcelWorld world = new BcelWorld();
+ world.setBehaveInJava5Way(true);
+ UnresolvedType javaLangObject = UnresolvedType.forName("java.lang.Object");
+ ResolvedType rtx = world.resolve(javaLangObject);
+ assertFalse(rtx.isGenericType());
+ }
+
+ BcelWorld world;
+
+ @Override
+ public void setUp() throws Exception {
+ super.setUp();
+ world = new BcelWorld();
+ world.setBehaveInJava5Way(true);
+ }
+
+ public void testCoercion01() {
+ ReferenceType listOfString = (ReferenceType) world.resolve(UnresolvedType
+ .forSignature("Pjava/util/List<Ljava/lang/String;>;"));
+ ReferenceType listOfInteger = (ReferenceType) world.resolve(UnresolvedType
+ .forSignature("Pjava/util/List<Ljava/lang/Integer;>;"));
+ assertFalse(listOfInteger.isAssignableFrom(listOfString));
+ assertFalse(listOfString.isAssignableFrom(listOfInteger));
+ assertFalse(listOfInteger.isCoerceableFrom(listOfString));
+ assertFalse(listOfString.isCoerceableFrom(listOfInteger));
+ }
+
+ public void testAssignable01() {
+ List list = new ArrayList();
+ List<String> listOfString = new ArrayList<String>();
+ List<?> listOfSomething = new ArrayList<Integer>();
+ List<? extends Number> listOfSomethingNumberish = new ArrayList<Integer>();
+ List<? super Double> listOfSomethingSuperDouble = new ArrayList<Number>();
+ // interfaces too List<? extends A,B>
+
+ ReferenceType ajList = resolve("Ljava/util/List;");
+ ReferenceType ajListOfString = resolve("Pjava/util/List<Ljava/lang/String;>;");
+ ReferenceType ajListOfSomething = resolve("Pjava/util/List<*>;");
+ ReferenceType ajListOfSomethingNumberish = resolve("Pjava/util/List<+Ljava/lang/Number;>;");
+ ReferenceType ajListOfSomethingSuperDouble = resolve("Pjava/util/List<-Ljava/lang/Double;>;");
+
+ // try and write the java equivalent, if it succeeds then check isAssignableFrom() is true
+ // if the java is only correct with a cast, check isCoerceableFrom()
+ list = listOfString;
+ assertTrue(ajList.isAssignableFrom(ajListOfString));
+ list = listOfSomething;
+ assertTrue(ajList.isAssignableFrom(ajListOfSomething));
+ list = listOfSomethingNumberish;
+ assertTrue(ajList.isAssignableFrom(ajListOfSomething));
+ list = listOfSomethingSuperDouble;
+ assertTrue(ajList.isAssignableFrom(ajListOfSomethingSuperDouble));
+
+ listOfString = list; // unchecked conversion to List<String>
+ assertFalse(ajListOfString.isAssignableFrom(ajList));
+ assertTrue(ajListOfString.isCoerceableFrom(ajListOfSomething));
+ // error: listOfString = listOfSomething;
+ assertFalse(ajListOfString.isAssignableFrom(ajListOfSomething));
+ // error: listOfString = listOfSomethingNumberish;
+ assertFalse(ajListOfString.isAssignableFrom(ajListOfSomethingNumberish));
+ // error: listOfString = listOfSomethingSuperDouble;
+ assertFalse(ajListOfString.isAssignableFrom(ajListOfSomethingSuperDouble));
+ // error: listOfString = (List<String>) listOfSomethingSuperDouble;
+ assertFalse(ajListOfString.isCoerceableFrom(ajListOfSomethingSuperDouble));
+
+ listOfSomething = list;
+ assertTrue(ajListOfSomething.isAssignableFrom(ajList));
+ listOfSomething = listOfString;
+ assertTrue(ajListOfSomething.isAssignableFrom(ajListOfString));
+ listOfSomething = listOfSomethingNumberish;
+ assertTrue(ajListOfSomething.isAssignableFrom(ajListOfSomething));
+ listOfSomething = listOfSomethingSuperDouble;
+ assertTrue(ajListOfSomething.isAssignableFrom(ajListOfSomethingSuperDouble));
+
+ listOfSomethingNumberish = list; // unchecked conversion
+ assertFalse(ajListOfSomethingNumberish.isAssignableFrom(ajList));
+ assertTrue(ajListOfSomethingNumberish.isCoerceableFrom(ajList));
+ // error: listOfSomethingNumberish = listOfString;
+ assertFalse(ajListOfSomethingNumberish.isAssignableFrom(ajListOfString));
+ assertFalse(ajListOfSomethingNumberish.isCoerceableFrom(ajListOfString));
+ // error: listOfSomethingNumberish = listOfSomething;
+ assertFalse(ajListOfSomethingNumberish.isAssignableFrom(ajListOfSomething));
+ listOfSomethingNumberish = (List<? extends Number>) listOfSomething;
+ assertTrue(ajListOfSomethingNumberish.isCoerceableFrom(ajListOfSomething));
+ // error: listOfSomethingNumberish = listOfSomethingSuperDouble;
+ assertFalse(ajListOfSomethingNumberish.isAssignableFrom(ajListOfSomethingSuperDouble));
+ // listOfSomethingNumberish = (List<? extends Number>) listOfSomethingSuperDouble;
+ // assertTrue(ajListOfSomethingNumberish.isCoerceableFrom(ajListOfSomethingSuperDouble));
+ }
+
+ class C<E extends Number> {
+ void m1(List<Integer> e) {
+ }
+
+ void m2(List<? extends Number> e) {
+ }
+
+ void m3(List<Number> e) {
+ }
+
+ void m4(List<?> e) {
+ }
+
+ void m5(List<E> e) {
+ }
+
+ void m6(List<? extends E> e) {
+ }
+
+ void m7(List<? extends List<? extends E>> e) {
+ }
+
+ void m8(List e) {
+ }
+
+ void m9(E e) {
+ }
+ }
+
+ class A1 {
+ }
+
+ class B1 extends A1 {
+ }
+
+ class C1 extends B1 {
+ }
+
+ class D1 extends C1 {
+ }
+
+ class D2<E2 extends C1> {
+ void m5(List<E2> e) {
+ }
+ }
+
+ public void testAssignable02() {
+ List list = new ArrayList();
+ ArrayList arraylist = null;
+ List<String> listOfString = new ArrayList<String>();
+ List<?> listOfSomething = new ArrayList<Integer>();
+ ArrayList<?> arrayListOfSomething = null;
+ List<Number> listOfNumber = null;
+ ArrayList<Number> arrayListOfNumber = null;
+ ArrayList<? extends Number> arrayListOfSomethingNumberish = null;
+ List<? extends Number> listOfSomethingNumberish = new ArrayList<Integer>();
+ List<? super Double> listOfSomethingSuperDouble = new ArrayList<Number>();
+ List<Integer> listOfInteger = new ArrayList<Integer>();
+ ArrayList<String> arrayListOfString;
+ ArrayList<Integer> arraylistOfInteger;
+ // interfaces too List<? extends A,B>
+
+ ReferenceType ajArrayListOfString = resolve("Pjava/util/ArrayList<Ljava/lang/String;>;");
+ ReferenceType ajArrayListOfInteger = resolve("Pjava/util/ArrayList<Ljava/lang/Integer;>;");
+ ReferenceType ajArrayListOfNumber = resolve("Pjava/util/ArrayList<Ljava/lang/Number;>;");
+ ReferenceType ajArrayListOfSomethingNumberish = resolve("Pjava/util/ArrayList<+Ljava/lang/Number;>;");
+ ReferenceType ajList = resolve("Ljava/util/List;");
+ ReferenceType ajArrayList = resolve("Ljava/util/ArrayList;");
+ ReferenceType ajListOfString = resolve("Pjava/util/List<Ljava/lang/String;>;");
+ ReferenceType ajListOfSomething = resolve("Pjava/util/List<*>;");
+ ReferenceType ajArrayListOfSomething = resolve("Pjava/util/ArrayList<*>;");
+ ReferenceType ajListOfSomethingNumberish = resolve("Pjava/util/List<+Ljava/lang/Number;>;");
+ ReferenceType ajListOfSomethingSuperDouble = resolve("Pjava/util/List<-Ljava/lang/Double;>;");
+ ReferenceType ajListOfInteger = resolve("Pjava/util/List<Ljava/lang/Integer;>;");
+ ReferenceType ajListOfNumber = resolve("Pjava/util/List<Ljava/lang/Number;>;");
+ // Effectively, whether the advice matches is based on whether what we pass at the joinpoint could
+ // be bound to the specification in the args() pointcut
+
+ // void around(): execution(* C.m1(..)) && args(List<Integer>){} //: Should match (it does)
+ assertTrue(ajListOfInteger.isAssignableFrom(ajListOfInteger));
+
+ // void around(): execution(* C.m1(..)) && args(ArrayList<Integer>){}//: Should runtime check (it does!)
+ ArrayList<Integer> x = (ArrayList<Integer>) listOfInteger;
+ assertFalse(ajArrayListOfInteger.isAssignableFrom(ajListOfInteger));
+ assertTrue(ajArrayListOfInteger.isCoerceableFrom(ajListOfInteger));
+
+ // void around(): execution(* C.m1(..)) && args(List<Number>){} // Should not match (it does not!)
+ // error: listOfNumber = listOfInteger;
+ assertFalse(ajListOfNumber.isAssignableFrom(ajListOfInteger));
+ assertFalse(ajListOfNumber.isCoerceableFrom(ajListOfInteger));
+
+ // void around(): execution(* C.m1(..)) && args(ArrayList<Number>){} // Should not match (it does not)
+ // error: arrayListOfNumber = listOfInteger;
+ assertFalse(ajArrayListOfNumber.isAssignableFrom(ajListOfInteger));
+ assertFalse(ajArrayListOfNumber.isCoerceableFrom(ajListOfInteger));
+
+ // void around(): execution(* C.m1(..)) && args(List<? extends Number>){} // Should match (it does)
+ listOfSomethingNumberish = listOfInteger;
+ assertTrue(ajListOfSomethingNumberish.isAssignableFrom(ajListOfInteger));
+
+ // void around(): execution(* C.m1(..)) && args(ArrayList<? extends Number>){}// Should runtime check (it does!)
+ arrayListOfSomethingNumberish = (ArrayList<? extends Number>) listOfInteger;
+ assertFalse(ajArrayListOfSomethingNumberish.isAssignableFrom(ajListOfInteger));
+ assertTrue(ajArrayListOfSomethingNumberish.isCoerceableFrom(ajListOfInteger));
+
+ // void around(): execution(* C.m1(..)) && args(List){}// Should match (it does)
+ list = listOfInteger;
+ assertTrue(ajList.isAssignableFrom(ajListOfInteger));
+
+ // void around(): execution(* C.m1(..)) && args(ArrayList){}//: Should runtime check (it does not match!)
+ arraylist = (ArrayList) listOfInteger;
+ assertFalse(ajArrayList.isAssignableFrom(ajListOfInteger));
+ assertTrue(ajArrayList.isCoerceableFrom(ajListOfInteger));
+
+ // void around(): execution(* C.m1(..)) && args(List<?>){}// Should match (it does)
+ listOfSomething = listOfInteger;
+ assertTrue(ajListOfSomething.isAssignableFrom(ajListOfInteger));
+
+ // void around(): execution(* C.m1(..)) && args(ArrayList<?>){}// Should runtime check (it does not match!)
+ arrayListOfSomething = (ArrayList<?>) listOfInteger;
+ assertFalse(ajArrayListOfSomething.isAssignableFrom(ajListOfInteger));
+ assertTrue(ajArrayListOfSomething.isCoerceableFrom(ajListOfInteger));
+
+ // void around(): execution(* C.m1(..)) && args(ArrayList<String>){}// Should not match (it does not match!)
+ // error: arrayListOfString = listOfInteger;
+ assertFalse(ajArrayListOfString.isAssignableFrom(ajListOfInteger));
+ assertFalse(ajArrayListOfString.isCoerceableFrom(ajListOfInteger));
+ }
+
+ public void testAssignable03_method_m2() {
+ List list = new ArrayList();
+ ArrayList arraylist = null;
+ List<String> listOfString = new ArrayList<String>();
+ List<?> listOfSomething = new ArrayList<Integer>();
+ ArrayList<?> arrayListOfSomething = null;
+ List<Number> listOfNumber = null;
+ ArrayList<Number> arrayListOfNumber = null;
+ ArrayList<Integer> arrayListOfInteger = null;
+ ArrayList<? extends Number> arrayListOfSomethingNumberish = null;
+ List<? extends Number> listOfSomethingNumberish = new ArrayList<Integer>();
+ List<? super Double> listOfSomethingSuperDouble = new ArrayList<Number>();
+ List<Integer> listOfInteger = new ArrayList<Integer>();
+ ArrayList<String> arrayListOfString;
+ ArrayList<Integer> arraylistOfInteger;
+ // interfaces too List<? extends A,B>
+
+ ReferenceType ajArrayListOfString = resolve("Pjava/util/ArrayList<Ljava/lang/String;>;");
+ ReferenceType ajArrayListOfInteger = resolve("Pjava/util/ArrayList<Ljava/lang/Integer;>;");
+ ReferenceType ajArrayListOfNumber = resolve("Pjava/util/ArrayList<Ljava/lang/Number;>;");
+ ReferenceType ajArrayListOfSomethingNumberish = resolve("Pjava/util/ArrayList<+Ljava/lang/Number;>;");
+ ReferenceType ajList = resolve("Ljava/util/List;");
+ ReferenceType ajArrayList = resolve("Ljava/util/ArrayList;");
+ ReferenceType ajListOfString = resolve("Pjava/util/List<Ljava/lang/String;>;");
+ ReferenceType ajListOfSomething = resolve("Pjava/util/List<*>;");
+ ReferenceType ajArrayListOfSomething = resolve("Pjava/util/ArrayList<*>;");
+ ReferenceType ajListOfSomethingNumberish = resolve("Pjava/util/List<+Ljava/lang/Number;>;");
+ ReferenceType ajListOfSomethingSuperDouble = resolve("Pjava/util/List<-Ljava/lang/Double;>;");
+ ReferenceType ajListOfInteger = resolve("Pjava/util/List<Ljava/lang/Integer;>;");
+ ReferenceType ajListOfNumber = resolve("Pjava/util/List<Ljava/lang/Number;>;");
+
+ // void m2(List<? extends Number> e) {}
+
+ // comment 11
+ // void around(): execution(* C.m2(..)) && args(List<Integer>){} //: Should not match (but it does) ERROR
+ listOfInteger = (List<Integer>) listOfSomethingNumberish;
+ assertFalse(ajListOfInteger.isAssignableFrom(ajListOfSomethingNumberish));
+ assertTrue(ajListOfInteger.isCoerceableFrom(ajListOfSomethingNumberish));
+
+ // void around(): execution(* C.m2(..)) && args(ArrayList<Integer>){}//: Should not match (but it does!) ERROR
+ arrayListOfInteger = (ArrayList<Integer>) listOfSomethingNumberish;
+ assertFalse(ajArrayListOfInteger.isAssignableFrom(ajListOfSomethingNumberish));
+ assertTrue(ajArrayListOfInteger.isCoerceableFrom(ajListOfSomethingNumberish));
+
+ // void around(): execution(* C.m2(..)) && args(List<Number>){} //: Should not match (but it does) ERROR
+ listOfNumber = (List<Number>) listOfSomethingNumberish;
+ assertFalse(ajListOfNumber.isAssignableFrom(ajListOfSomethingNumberish));
+ assertTrue(ajListOfNumber.isCoerceableFrom(ajListOfSomethingNumberish));
+
+ // void around(): execution(* C.m2(..)) && args(ArrayList<Number>){}//: Should not runtime check (but it does!) ERROR
+ arrayListOfNumber = (ArrayList<Number>) listOfSomethingNumberish;
+ assertFalse(ajArrayListOfNumber.isAssignableFrom(ajListOfSomethingNumberish));
+ assertTrue(ajArrayListOfNumber.isCoerceableFrom(ajListOfSomethingNumberish));
+
+ // void around(): execution(* C.m2(..)) && args(List<? extends Number>){}//: Should match (it does)
+ listOfSomethingNumberish = listOfSomethingNumberish;
+ assertTrue(ajListOfSomethingNumberish.isAssignableFrom(ajListOfSomethingNumberish));
+
+ // void around(): execution(* C.m2(..)) && args(ArrayList<? extends Number>){}//: Should runtime check (it does!)
+ arrayListOfSomethingNumberish = (ArrayList<? extends Number>) listOfSomethingNumberish;
+ assertFalse(ajArrayListOfSomethingNumberish.isAssignableFrom(ajListOfSomethingNumberish));
+ assertTrue(ajArrayListOfSomethingNumberish.isCoerceableFrom(ajListOfSomethingNumberish));
+
+ // void around(): execution(* C.m2(..)) && args(List){}//: Should match (it does)
+ list = listOfSomethingNumberish;
+ assertTrue(ajList.isAssignableFrom(ajListOfSomethingNumberish));
+
+ // void around(): execution(* C.m2(..)) && args(ArrayList){}//: Should runtime check (it does not match!) ERROR
+ arraylist = (ArrayList) listOfSomethingNumberish;
+ assertFalse(ajArrayList.isAssignableFrom(ajListOfSomethingNumberish));
+ assertTrue(ajArrayList.isCoerceableFrom(ajListOfSomethingNumberish));
+
+ // void around(): execution(* C.m2(..)) && args(List<?>){}//: Should match (it does)
+ listOfSomething = listOfSomethingNumberish;
+ assertTrue(ajListOfSomething.isAssignableFrom(ajListOfSomethingNumberish));
+
+ // void around(): execution(* C.m2(..)) && args(ArrayList<?>){}//: Should runtime check (it does!)
+ arrayListOfSomething = (ArrayList) listOfSomethingNumberish;
+ assertFalse(ajArrayListOfSomething.isAssignableFrom(ajListOfSomethingNumberish));
+ assertTrue(ajArrayListOfSomething.isCoerceableFrom(ajListOfSomethingNumberish));
+
+ // void around(): execution(* C.m2(..)) && args(ArrayList<String>){}//: Should not match (it does not match!)
+ // error: arrayListOfString = listOfSomethingNumberish;
+ assertFalse(ajArrayListOfString.isAssignableFrom(ajListOfSomethingNumberish));
+ assertFalse(ajArrayListOfString.isCoerceableFrom(ajListOfSomethingNumberish));
+ }
+
+ public void testAssignable04_method_m3() {
+ List list = new ArrayList();
+ ArrayList arraylist = null;
+ List<String> listOfString = new ArrayList<String>();
+ List<?> listOfSomething = new ArrayList<Integer>();
+ ArrayList<?> arrayListOfSomething = null;
+ List<Number> listOfNumber = null;
+ ArrayList<Number> arrayListOfNumber = null;
+ ArrayList<Integer> arrayListOfInteger = null;
+ ArrayList<? extends Number> arrayListOfSomethingNumberish = null;
+ List<? extends Number> listOfSomethingNumberish = new ArrayList<Integer>();
+ List<? super Double> listOfSomethingSuperDouble = new ArrayList<Number>();
+ List<Integer> listOfInteger = new ArrayList<Integer>();
+ ArrayList arrayList = null;
+ ArrayList<String> arrayListOfString;
+ ArrayList<Integer> arraylistOfInteger;
+ // interfaces too List<? extends A,B>
+
+ ReferenceType ajArrayListOfString = resolve("Pjava/util/ArrayList<Ljava/lang/String;>;");
+ ReferenceType ajArrayListOfInteger = resolve("Pjava/util/ArrayList<Ljava/lang/Integer;>;");
+ ReferenceType ajArrayListOfNumber = resolve("Pjava/util/ArrayList<Ljava/lang/Number;>;");
+ ReferenceType ajArrayListOfSomethingNumberish = resolve("Pjava/util/ArrayList<+Ljava/lang/Number;>;");
+ ReferenceType ajList = resolve("Ljava/util/List;");
+ ReferenceType ajArrayList = resolve("Ljava/util/ArrayList;");
+ ReferenceType ajListOfString = resolve("Pjava/util/List<Ljava/lang/String;>;");
+ ReferenceType ajListOfSomething = resolve("Pjava/util/List<*>;");
+ ReferenceType ajArrayListOfSomething = resolve("Pjava/util/ArrayList<*>;");
+ ReferenceType ajListOfSomethingNumberish = resolve("Pjava/util/List<+Ljava/lang/Number;>;");
+ ReferenceType ajListOfSomethingSuperDouble = resolve("Pjava/util/List<-Ljava/lang/Double;>;");
+ ReferenceType ajListOfInteger = resolve("Pjava/util/List<Ljava/lang/Integer;>;");
+ ReferenceType ajListOfNumber = resolve("Pjava/util/List<Ljava/lang/Number;>;");
+
+ // void m3(List<Number> e) { }
+
+ // void around(): execution(* C.m3(..)) && args(List<Integer>){} //: Should not match (it does not)
+ // error: listOfInteger = listOfNumber;
+ assertFalse(ajListOfInteger.isAssignableFrom(ajListOfNumber));
+ assertFalse(ajListOfInteger.isCoerceableFrom(ajListOfNumber));
+
+ // void around(): execution(* C.m3(..)) && args(ArrayList<Integer>){}//: Should not match (it does not)
+ // error: arrayListOfInteger = listOfNumber;
+ assertFalse(ajArrayListOfInteger.isAssignableFrom(ajListOfNumber));
+ assertFalse(ajArrayListOfInteger.isCoerceableFrom(ajListOfNumber));
+
+ // void around(): execution(* C.m3(..)) && args(List<Number>){}//: Should match (it does)
+ listOfNumber = listOfNumber;
+ assertTrue(ajListOfNumber.isAssignableFrom(ajListOfNumber));
+
+ // void around(): execution(* C.m3(..)) && args(ArrayList<Number>){}//: Should runtime match (it does)
+ arrayListOfNumber = (ArrayList<Number>) listOfNumber;
+ assertFalse(ajArrayListOfNumber.isAssignableFrom(ajListOfNumber));
+ assertTrue(ajArrayListOfNumber.isCoerceableFrom(ajListOfNumber));
+
+ // void around(): execution(* C.m3(..)) && args(List<? extends Number>){}//: Should match (it does)
+ listOfSomethingNumberish = listOfNumber;
+ assertTrue(ajListOfSomethingNumberish.isAssignableFrom(ajListOfNumber));
+
+ // void around(): execution(* C.m3(..)) && args(ArrayList<? extends Number>){}//: Should runtime check (it does!)
+ arrayListOfSomethingNumberish = (ArrayList<? extends Number>) listOfNumber;
+ assertFalse(ajArrayListOfSomethingNumberish.isAssignableFrom(ajListOfNumber));
+ assertTrue(ajArrayListOfSomethingNumberish.isCoerceableFrom(ajListOfNumber));
+
+ // void around(): execution(* C.m3(..)) && args(List){}//: Should match (it does)
+ list = listOfNumber;
+ assertTrue(ajList.isAssignableFrom(ajListOfNumber));
+
+ // void around(): execution(* C.m3(..)) && args(ArrayList){}//: Should runtime check (it does not match!) ERROR
+ arrayList = (ArrayList) listOfNumber;
+ assertFalse(ajArrayList.isAssignableFrom(ajListOfNumber));
+ assertTrue(ajArrayList.isCoerceableFrom(ajListOfNumber));
+
+ // void around(): execution(* C.m3(..)) && args(List<?>){}//: Should match (it does)
+ listOfSomething = listOfNumber;
+ assertTrue(ajListOfSomething.isAssignableFrom(ajListOfNumber));
+
+ // void around(): execution(* C.m3(..)) && args(ArrayList<?>){}//: Should runtime check (it does!)
+ arrayListOfSomething = (ArrayList<?>) listOfNumber;
+ assertFalse(ajArrayListOfSomething.isAssignableFrom(ajListOfNumber));
+ assertTrue(ajArrayListOfSomething.isCoerceableFrom(ajListOfNumber));
+
+ // void around(): execution(* C.m3(..)) && args(ArrayList<String>){}//: Should not match (it does not match!)
+ // error: arrayListOfString = listOfNumber;
+ assertFalse(ajArrayListOfString.isAssignableFrom(ajListOfNumber));
+ assertFalse(ajArrayListOfString.isCoerceableFrom(ajListOfNumber));
+
+ }
+
+ static class ClassA<T> {
+ }
+
+ static interface IMarker<H> {
+ }
+
+ static class ClassB<T> implements IMarker<ClassA<T>> {
+ }
+
+ static class ClassC<T> implements IMarker<T> {
+ }
+
+ public void testAssignability_pr267559() {
+ ClassB cb = new ClassB();
+ ClassB cb2 = new ClassB();
+
+ ReferenceType rcb = resolve("Lorg/aspectj/weaver/ReferenceTypeTestCase$ClassB;");
+ ReferenceType rcb2 = resolve("Lorg/aspectj/weaver/ReferenceTypeTestCase$ClassB;");
+ boolean b = rcb.isAssignableFrom(rcb2);
+ assertTrue(b);
+ b = rcb2.isAssignableFrom(rcb);
+ assertTrue(b);
+
+ rcb = resolve("Porg/aspectj/weaver/ReferenceTypeTestCase$IMarker<Porg/aspectj/weaver/ReferenceTypeTestCase$ClassA<TT;>;>;");
+ rcb2 = resolve("Lorg/aspectj/weaver/ReferenceTypeTestCase$ClassB;");
+ b = rcb.isAssignableFrom(rcb2);
+ assertTrue(b);
+ }
+
+ public void testAssignable03_method_m4() {
+ List list = new ArrayList();
+ ArrayList arraylist = null;
+ List<String> listOfString = new ArrayList<String>();
+ List<?> listOfSomething = new ArrayList<Integer>();
+ ArrayList<?> arrayListOfSomething = null;
+ List<Number> listOfNumber = null;
+ ArrayList<Number> arrayListOfNumber = null;
+ ArrayList<? extends Number> arrayListOfSomethingNumberish = null;
+ List<? extends Number> listOfSomethingNumberish = new ArrayList<Integer>();
+ List<? super Double> listOfSomethingSuperDouble = new ArrayList<Number>();
+ List<Integer> listOfInteger = new ArrayList<Integer>();
+ ArrayList<String> arrayListOfString;
+ ArrayList<Integer> arraylistOfInteger;
+ // interfaces too List<? extends A,B>
+
+ ReferenceType ajArrayListOfString = resolve("Pjava/util/ArrayList<Ljava/lang/String;>;");
+ ReferenceType ajArrayListOfInteger = resolve("Pjava/util/ArrayList<Ljava/lang/Integer;>;");
+ ReferenceType ajArrayListOfNumber = resolve("Pjava/util/ArrayList<Ljava/lang/Number;>;");
+ ReferenceType ajArrayListOfSomethingNumberish = resolve("Pjava/util/ArrayList<+Ljava/lang/Number;>;");
+ ReferenceType ajList = resolve("Ljava/util/List;");
+ ReferenceType ajArrayList = resolve("Ljava/util/ArrayList;");
+ ReferenceType ajListOfString = resolve("Pjava/util/List<Ljava/lang/String;>;");
+ ReferenceType ajListOfSomething = resolve("Pjava/util/List<*>;");
+ ReferenceType ajArrayListOfSomething = resolve("Pjava/util/ArrayList<*>;");
+ ReferenceType ajListOfSomethingNumberish = resolve("Pjava/util/List<+Ljava/lang/Number;>;");
+ ReferenceType ajListOfSomethingSuperDouble = resolve("Pjava/util/List<-Ljava/lang/Double;>;");
+ ReferenceType ajListOfInteger = resolve("Pjava/util/List<Ljava/lang/Integer;>;");
+ ReferenceType ajListOfNumber = resolve("Pjava/util/List<Ljava/lang/Number;>;");
+
+ // void m4(List<?> e) {}
+
+ // void around(): execution(* C.m4(..)) && args(List<Integer>){} //: Should match with unchecked warning
+ listOfInteger = (List<Integer>) listOfSomething;
+ assertFalse(ajListOfInteger.isAssignableFrom(ajListOfSomething));
+ assertTrue(ajListOfInteger.isCoerceableFrom(ajListOfSomething));
+
+ // void around(): execution(* C.m4(..)) && args(ArrayList<Integer>){} // Should match with unchecked warning
+ arraylistOfInteger = (ArrayList<Integer>) listOfSomething;
+ assertFalse(ajArrayListOfInteger.isAssignableFrom(ajListOfSomething));
+ assertTrue(ajArrayListOfInteger.isCoerceableFrom(ajListOfSomething));
+
+ // void around(): execution(* C.m4(..)) && args(List<Number>){} // Should match with unchecked warning
+ listOfNumber = (List<Number>) listOfSomething;
+ assertFalse(ajListOfNumber.isAssignableFrom(ajListOfSomething));
+ assertTrue(ajListOfNumber.isCoerceableFrom(ajListOfSomething));
+
+ // void around(): execution(* C.m4(..)) && args(ArrayList<Number>){} // Should match with unchecked warning
+ arrayListOfNumber = (ArrayList<Number>) listOfSomething;
+ assertFalse(ajArrayListOfNumber.isAssignableFrom(ajListOfSomething));
+ assertTrue(ajArrayListOfNumber.isCoerceableFrom(ajListOfSomething));
+
+ // void around(): execution(* C.m4(..)) && args(List<? extends Number>){} // Should match with unchecked warning
+ listOfSomethingNumberish = (List<? extends Number>) listOfSomething;
+ assertFalse(ajListOfSomethingNumberish.isAssignableFrom(ajListOfSomething));
+ assertTrue(ajListOfSomethingNumberish.isCoerceableFrom(ajListOfSomething));
+
+ // void around(): execution(* C.m4(..)) && args(ArrayList<? extends Number>){} // Should match with unchecked warning
+ arrayListOfSomethingNumberish = (ArrayList<? extends Number>) listOfSomething;
+ assertFalse(ajArrayListOfSomethingNumberish.isAssignableFrom(ajListOfSomething));
+ assertTrue(ajArrayListOfSomethingNumberish.isCoerceableFrom(ajListOfSomething));
+
+ // void around(): execution(* C.m4(..)) && args(List){} // Should match
+ list = listOfSomething;
+ assertTrue(ajList.isAssignableFrom(ajListOfSomething));
+
+ // void around(): execution(* C.m4(..)) && args(ArrayList){} // Should runtime check
+ arraylist = (ArrayList) listOfSomething;
+ assertFalse(ajArrayList.isAssignableFrom(ajListOfSomething));
+ assertTrue(ajArrayList.isCoerceableFrom(ajListOfSomething));
+
+ // void around(): execution(* C.m4(..)) && args(List<?>){}//: Should match
+ list = listOfSomething;
+ assertTrue(ajList.isAssignableFrom(ajListOfSomething));
+
+ // void around(): execution(* C.m4(..)) && args(ArrayList<?>){} // Should runtime check
+ arrayListOfSomething = (ArrayList<?>) listOfSomething;
+ assertFalse(ajArrayListOfSomething.isAssignableFrom(ajListOfSomething));
+ assertTrue(ajArrayListOfSomething.isCoerceableFrom(ajListOfSomething));
+
+ // void around(): execution(* C.m4(..)) && args(ArrayList<String>){} // Should match with unchecked warning
+ arrayListOfString = (ArrayList<String>) listOfSomething;
+ assertFalse(ajArrayListOfString.isAssignableFrom(ajListOfSomething));
+ assertTrue(ajArrayListOfString.isCoerceableFrom(ajListOfSomething));
+ }
+
+ // copy of the real one in BcelClassWeaver
+ public static class IfaceInitList implements PartialOrder.PartialComparable {
+ final ResolvedType onType;
+ List<ConcreteTypeMunger> list = new ArrayList<ConcreteTypeMunger>();
+
+ IfaceInitList(ResolvedType onType) {
+ this.onType = onType;
+ }
+
+ public int compareTo(Object other) {
+ IfaceInitList o = (IfaceInitList) other;
+ if (onType.isAssignableFrom(o.onType)) {
+ return +1;
+ } else if (o.onType.isAssignableFrom(onType)) {
+ return -1;
+ } else {
+ return 0;
+ }
+ }
+
+ public int fallbackCompareTo(Object other) {
+ return 0;
+ }
+ }
+
+ public void testExpensiveAssignableChecks_309336() {
+ List objects = new ArrayList();
+ ReferenceType rcb = resolve("Lorg/aspectj/weaver/ReferenceTypeTestCase$Foo;");
+ ReferenceType i = (ReferenceType) rcb.getDeclaredInterfaces()[0];
+ while (i != null && i.isInterface()) {
+ objects.add(Math.abs(new Random(12).nextInt(objects.size() + 1)), new IfaceInitList(i));
+ ResolvedType[] rt = i.getDeclaredInterfaces();
+ i = rt == null || rt.length == 0 ? null : (ReferenceType) rt[0];
+ }
+ for (int loop = 0; loop < 10; loop++) {
+ // ReferenceType.r = 0;
+ long stime = System.nanoTime();
+ for (int j = 0; j < 10; j++) {
+ List objects2 = new ArrayList();
+ objects2.addAll(objects);
+ PartialOrder.sort(objects2);
+ }
+ long etime = System.nanoTime();
+ System.err.println("Took " + ((etime - stime) / 1000000) + "ms: calls ");// + ReferenceType.r);
+ }
+ // could do with asserting something... basically we are just checking we didn't run out of memory doing the sorts above!
+ }
+
+ public interface Operator14<T, E1 extends Throwable, E2 extends Throwable, E3 extends Throwable, E4 extends Throwable, E5 extends Throwable, E6 extends Throwable, E7 extends Throwable, E8 extends Throwable, E9 extends Throwable, E10 extends Throwable, E11 extends Throwable, E12 extends Throwable, E13 extends Throwable, E14 extends Throwable> {
+ T execute(String aArg) throws E1, E2, E3, E4, E5, E6, E7, E8, E9, E10, E11, E12, E13, E14, RemoteException;
+ }
+
+ public interface Operator13<T, E1 extends Throwable, E2 extends Throwable, E3 extends Throwable, E4 extends Throwable, E5 extends Throwable, E6 extends Throwable, E7 extends Throwable, E8 extends Throwable, E9 extends Throwable, E10 extends Throwable, E11 extends Throwable, E12 extends Throwable, E13 extends Throwable>
+ extends Operator14<T, E1, E2, E3, E4, E5, E6, E7, E8, E9, E10, E11, E12, E13, E13> {
+ }
+
+ public interface Operator12<T, E1 extends Throwable, E2 extends Throwable, E3 extends Throwable, E4 extends Throwable, E5 extends Throwable, E6 extends Throwable, E7 extends Throwable, E8 extends Throwable, E9 extends Throwable, E10 extends Throwable, E11 extends Throwable, E12 extends Throwable>
+ extends Operator13<T, E1, E2, E3, E4, E5, E6, E7, E8, E9, E10, E11, E12, E12> {
+ }
+
+ public interface Operator11<T, E1 extends Throwable, E2 extends Throwable, E3 extends Throwable, E4 extends Throwable, E5 extends Throwable, E6 extends Throwable, E7 extends Throwable, E8 extends Throwable, E9 extends Throwable, E10 extends Throwable, E11 extends Throwable>
+ extends Operator12<T, E1, E2, E3, E4, E5, E6, E7, E8, E9, E10, E11, E11> {
+ }
+
+ public interface Operator10<T, E1 extends Throwable, E2 extends Throwable, E3 extends Throwable, E4 extends Throwable, E5 extends Throwable, E6 extends Throwable, E7 extends Throwable, E8 extends Throwable, E9 extends Throwable, E10 extends Throwable>
+ extends Operator11<T, E1, E2, E3, E4, E5, E6, E7, E8, E9, E10, E10> {
+
+ }
+
+ public interface Operator9<T, E1 extends Throwable, E2 extends Throwable, E3 extends Throwable, E4 extends Throwable, E5 extends Throwable, E6 extends Throwable, E7 extends Throwable, E8 extends Throwable, E9 extends Throwable>
+ extends Operator10<T, E1, E2, E3, E4, E5, E6, E7, E8, E9, E9> {
+ }
+
+ public interface Operator8<T, E1 extends Throwable, E2 extends Throwable, E3 extends Throwable, E4 extends Throwable, E5 extends Throwable, E6 extends Throwable, E7 extends Throwable, E8 extends Throwable>
+ extends Operator9<T, E1, E2, E3, E4, E5, E6, E7, E8, E8> {
+ }
+
+ public interface Operator7<T, E1 extends Throwable, E2 extends Throwable, E3 extends Throwable, E4 extends Throwable, E5 extends Throwable, E6 extends Throwable, E7 extends Throwable>
+ extends Operator8<T, E1, E2, E3, E4, E5, E6, E7, E7> {
+ }
+
+ public interface Operator6<T, E1 extends Throwable, E2 extends Throwable, E3 extends Throwable, E4 extends Throwable, E5 extends Throwable, E6 extends Throwable>
+ extends Operator7<T, E1, E2, E3, E4, E5, E6, E6> {
+
+ }
+
+ public interface Operator5<T, E1 extends Throwable, E2 extends Throwable, E3 extends Throwable, E4 extends Throwable, E5 extends Throwable>
+ extends Operator6<T, E1, E2, E3, E4, E5, E5> {
+ }
+
+ public interface Operator4<T, E1 extends Throwable, E2 extends Throwable, E3 extends Throwable, E4 extends Throwable> extends
+ Operator5<T, E1, E2, E3, E4, E4> {
+ }
+
+ public interface Operator3<T, E1 extends Throwable, E2 extends Throwable, E3 extends Throwable> extends
+ Operator4<T, E1, E2, E3, E3> {
+ }
+
+ public interface Operator2<T, E1 extends Throwable, E2 extends Throwable> extends Operator3<T, E1, E2, E2> {
+
+ }
+
+ public interface Operator1<T, E1 extends Throwable> extends Operator2<T, E1, E1> {
+ }
+
+ public interface Operator<T> extends Operator1<T, RuntimeException> {
+ }
+
+ class Foo implements Operator<String> {
+ public String execute(String aArg) throws NullPointerException, RemoteException {
+ System.out.println("Doh!");
+ return aArg;
+ }
+ }
+
+ // public void testAssignable_method_m5() {
+ // List list = new ArrayList();
+ // ArrayList arraylist = null;
+ // List<String> listOfString = new ArrayList<String>();
+ // List<?> listOfSomething = new ArrayList<Integer>();
+ // ArrayList<?> arrayListOfSomething = null;
+ // List<Number> listOfNumber = null;
+ // ArrayList<Number> arrayListOfNumber = null;
+ // ArrayList<? extends Number> arrayListOfSomethingNumberish = null;
+ // List<? extends Number> listOfSomethingNumberish = new ArrayList<Integer>();
+ // List<? super Double> listOfSomethingSuperDouble = new ArrayList<Number>();
+ // List<Integer> listOfInteger = new ArrayList<Integer>();
+ // ArrayList<String> arrayListOfString;
+ // ArrayList<Integer> arraylistOfInteger;
+ // // interfaces too List<? extends A,B>
+ //
+ // ReferenceType ajArrayListOfString = resolve("Pjava/util/ArrayList<Ljava/lang/String;>;");
+ // ReferenceType ajArrayListOfInteger = resolve("Pjava/util/ArrayList<Ljava/lang/Integer;>;");
+ // ReferenceType ajArrayListOfNumber = resolve("Pjava/util/ArrayList<Ljava/lang/Number;>;");
+ // ReferenceType ajArrayListOfSomethingNumberish = resolve("Pjava/util/ArrayList<+Ljava/lang/Number;>;");
+ // ReferenceType ajList = resolve("Ljava/util/List;");
+ // ReferenceType ajArrayList = resolve("Ljava/util/ArrayList;");
+ // ReferenceType ajListOfString = resolve("Pjava/util/List<Ljava/lang/String;>;");
+ // ReferenceType ajListOfSomething = resolve("Pjava/util/List<*>;");
+ // ReferenceType ajArrayListOfSomething = resolve("Pjava/util/ArrayList<*>;");
+ // ReferenceType ajListOfSomethingNumberish = resolve("Pjava/util/List<+Ljava/lang/Number;>;");
+ // ReferenceType ajListOfSomethingSuperDouble = resolve("Pjava/util/List<-Ljava/lang/Double;>;");
+ // ReferenceType ajListOfInteger = resolve("Pjava/util/List<Ljava/lang/Integer;>;");
+ // ReferenceType ajListOfNumber = resolve("Pjava/util/List<Ljava/lang/Number;>;");
+ // ReferenceType ajListOfEextendsNumber = resolve("Pjava/util/List<+TE")
+ //
+ // // class C<E extends Number> {
+ // // void m5(List<E> e) { }
+ // //
+ // // void around(): execution(* C.m5(..)) && args(List<Integer>){} Should not match (but it does) ERROR
+ //
+ // // void around(): execution(* C.m5(..)) && args(ArrayList<Integer>){}//: Should not match (but it does!) ERROR
+ // // void around(): execution(* C.m5(..)) && args(List<Number>){}//: Should not match (but it does!) ERROR
+ // // void around(): execution(* C.m5(..)) && args(ArrayList<Number>){}//: Should not match (it does) ERROR
+ // // void around(): execution(* C.m5(..)) && args(List<? extends Number>){}//: Should match (it does)
+ // // void around(): execution(* C.m5(..)) && args(ArrayList<? extends Number>){}//: Should runtime check (it does!)
+ // // void around(): execution(* C.m5(..)) && args(List){}//: Should match (it does)
+ // // void around(): execution(* C.m5(..)) && args(ArrayList){}//: Should runtime check (it does not match!) ERROR
+ // // void around(): execution(* C.m5(..)) && args(List<?>){}//: Should match (it does)
+ // // void around(): execution(* C.m5(..)) && args(ArrayList<?>){}//: Should runtime check (it does not match!)
+ // // void around(): execution(* C.m5(..)) && args(ArrayList<String>){}//: Should not match (it does not match!)
+ // //
+ // // // void around(): execution(* D2.m5(..)) && args(List<D1>){} //: Should
+ // // not match (but it does) ERROR
+ // // // void around(): execution(* D2.m5(..)) && args(ArrayList<D1>){}//:
+ // // Should not match (but it does!) ERROR
+ // // // void around(): execution(* D2.m5(..)) && args(List<C1>){}//: Should
+ // // not match (but it does!) ERROR
+ // // // void around(): execution(* D2.m5(..)) && args(ArrayList<C1>){}//:
+ // // Should not match (it does) ERROR
+ // // // void around(): execution(* D2.m5(..)) && args(List<? extends B1>){}//:
+ // // Should match (it does)
+ // // // void around(): execution(* D2.m5(..)) && args(ArrayList<? extends
+ // // B1>){}//: Should runtime check (it does!)
+ // // // void around(): execution(* D2.m5(..)) && args(List<? extends C1>){}//:
+ // // Should match (it does)
+ // // // void around(): execution(* D2.m5(..)) && args(ArrayList<? extends
+ // // C1>){}//: Should runtime check (it does!)
+ // // // void around(): execution(* D2.m5(..)) && args(List){}//: Should match
+ // // (it does)
+ // // // void around(): execution(* D2.m5(..)) && args(ArrayList){}//: Should
+ // // runtime check (it does not match!) ERROR
+ // // // void around(): execution(* D2.m5(..)) && args(List<?>){}//: Should
+ // // match (it does)
+ // // // void around(): execution(* D2.m5(..)) && args(ArrayList<?>){}//:
+ // // Should runtime check (it does not match!)
+ // // // void around(): execution(* D2.m5(..)) && args(ArrayList<String>){}//:
+ // // Should not match (it does not match!)
+ // //
+ // // // void around(): execution(* C.m6(..)) && args(List<Integer>){} //:
+ // // Should not match (but it does) ERROR
+ // // // void around(): execution(* C.m6(..)) && args(ArrayList<Integer>){}//:
+ // // Should not match (but it does!) ERROR
+ // // // void around(): execution(* C.m6(..)) && args(List<Number>){}//: Should
+ // // not match (but it does!) ERROR
+ // // // void around(): execution(* C.m6(..)) && args(ArrayList<Number>){}//:
+ // // Should not match (it does) ERROR
+ // // // void around(): execution(* C.m6(..)) && args(List<? extends
+ // // Number>){}//: Should match (it does)
+ // // // void around(): execution(* C.m6(..)) && args(ArrayList<? extends
+ // // Number>){}//: Should runtime check (it does!)
+ // // // void around(): execution(* C.m6(..)) && args(List){}//: Should match
+ // // (it does)
+ // // // void around(): execution(* C.m6(..)) && args(ArrayList){}//: Should
+ // // runtime check (it does not match!)
+ // // // void around(): execution(* C.m6(..)) && args(List<?>){}//: Should
+ // // match (it does)
+ // // // void around(): execution(* C.m6(..)) && args(ArrayList<?>){}//: Should
+ // // runtime check (it does not match!)
+ // // // void around(): execution(* C.m6(..)) && args(ArrayList<String>){}//:
+ // // Should not match (it does not match!)
+ // //
+ // // // void around(): execution(* C.m7(..)) && args(List<List<Integer>>){}
+ // // //: Should not match (but it does) ERROR
+ // // // void around(): execution(* C.m7(..)) &&
+ // // args(ArrayList<List<Integer>>){}//: Should not match (but it does!) ERROR
+ // // // void around(): execution(* C.m7(..)) && args(List<List<Number>>){}//:
+ // // Should not match (but it does!) ERROR
+ // // // void around(): execution(* C.m7(..)) &&
+ // // args(ArrayList<List<Number>>){}//: Should not match (but it does) ERROR
+ // // // void around(): execution(* C.m7(..)) && args(List<? extends
+ // // List<Number>>){}//: Should not match (but it does) ERROR
+ // // // void around(): execution(* C.m7(..)) && args(ArrayList< ? extends
+ // // List<Number>>){}//: Should not match (but it does!) ERROR
+ // // // void around(): execution(* C.m7(..)) && args(List< ? extends List<?
+ // // extends Number>>){}//: Should match (it does!)
+ // // // void around(): execution(* C.m7(..)) && args(ArrayList< ? extends
+ // // List<? extends Number>>){}//: Should match (it does!)
+ // // // void around(): execution(* C.m7(..)) && args(List){}//: Should match
+ // // (it does)
+ // // // void around(): execution(* C.m7(..)) && args(ArrayList){}//: Should
+ // // runtime check (it does not match!)
+ // // // void around(): execution(* C.m7(..)) && args(List<?>){}//: Should
+ // // match (it does)
+ // // // void around(): execution(* C.m7(..)) && args(ArrayList<?>){}//: Should
+ // // runtime check (it does!)
+ // // // void around(): execution(* C.m7(..)) &&
+ // // args(ArrayList<List<String>>){}//: Should not match (it does not match!)
+ // //
+ // // // void around(): execution(* C.m8(..)) && args(List<Integer>){} //:
+ // // Should match with unchecked conversion (it does)
+ // // // void around(): execution(* C.m8(..)) && args(ArrayList<Integer>){}//:
+ // // Should runtime check with unchecked conversion (it does!)
+ // // // void around(): execution(* C.m8(..)) && args(List<Number>){}//: Should
+ // // match with unchecked conversion (it does!)
+ // // // void around(): execution(* C.m8(..)) && args(ArrayList<Number>){}//:
+ // // Should runtime check with unchecked conversion (it does)
+ // // // void around(): execution(* C.m8(..)) && args(List<? extends
+ // // Number>){}//: Should match with unchecked conversion (it does!)
+ // // // void around(): execution(* C.m8(..)) && args(ArrayList<? extends
+ // // Number>){}//: Should runtime check with unchecked conversion (it does)
+ // // // void around(): execution(* C.m8(..)) && args(List){}//: Should match
+ // // (it does)
+ // // // void around(): execution(* C.m8(..)) && args(ArrayList){}//: Should
+ // // runtime check (it does!)
+ // // // void around(): execution(* C.m8(..)) && args(List<?>){}//: Should
+ // // match (it does)
+ // // // void around(): execution(* C.m8(..)) && args(ArrayList<?>){}//: Should
+ // // runtime check (it does!)
+ // // // void around(): execution(* C.m8(..)) && args(ArrayList<String>){}//:
+ // // Should not match (it does not match!)
+ // //
+ // // // void around(): execution(* C.m9(..)) && args(List<Integer>){} //:
+ // // Should not match (but it does) ERROR
+ // // // void around(): execution(* C.m9(..)) && args(ArrayList<Integer>){}//:
+ // // Should not match (it does not match!)
+ // // // void around(): execution(* C.m9(..)) && args(Number){}//: Should match
+ // // (it does!)
+ // // // void around(): execution(* C.m9(..)) && args(Integer){}//: Should
+ // // runtime check (it does)
+ // // // void around(): execution(* C.m9(..)) && args(List<? extends
+ // // Number>){}//: Should not match (but it does) ERROR
+ // // // void around(): execution(* C.m9(..)) && args(ArrayList<? extends
+ // // Number>){}//: Should not match (it does not match!)
+ // // // void around(): execution(* C.m9(..)) && args(List){}//: Should not
+ // // match (but it does) ERROR
+ // // // void around(): execution(* C.m9(..)) && args(ArrayList){}//: Should
+ // // not match (it does not match!)
+ // // // void around(): execution(* C.m9(..)) && args(List<?>){}//: Should not
+ // // match (but it does) ERROR
+ // // // void around(): execution(* C.m9(..)) && args(ArrayList<?>){}//: Should
+ // // not match (it does not match!)
+ // // // void around(): execution(* C.m9(..)) && args(String){}//: Should not
+ // // match (it does not match!)
+ //
+ // }
+
+ private ReferenceType resolve(String sig) {
+ return (ReferenceType) world.resolve(UnresolvedType.forSignature(sig));
+ }
+}
diff --git a/weaver/testsrc/org/aspectj/weaver/ResolvedMemberSignaturesTestCase15.java b/weaver/src/test/java/org/aspectj/weaver/ResolvedMemberSignatures15TestCase.java
index 95ce63e3f..04697b884 100644
--- a/weaver/testsrc/org/aspectj/weaver/ResolvedMemberSignaturesTestCase15.java
+++ b/weaver/src/test/java/org/aspectj/weaver/ResolvedMemberSignatures15TestCase.java
@@ -17,7 +17,7 @@ import org.aspectj.weaver.bcel.BcelWorld;
import junit.framework.TestCase;
-public class ResolvedMemberSignaturesTestCase15 extends TestCase {
+public class ResolvedMemberSignatures15TestCase extends TestCase {
World world;
UnresolvedType baseType;
@@ -29,26 +29,26 @@ public class ResolvedMemberSignaturesTestCase15 extends TestCase {
Member toFind = new MemberImpl(Member.METHOD,baseType,
(Modifier.PUBLIC | Modifier.STATIC),
UnresolvedType.forSignature("V"),
- "onlyBase",
- new UnresolvedType[0]
- );
+ "onlyBase", UnresolvedType.NONE);
ResolvedMember[] foundMembers = ResolvedMemberImpl.getJoinPointSignatures(toFind, world);
assertEquals("found 1 member",1,foundMembers.length);
assertEquals("Lfluffy/Base;",foundMembers[0].getDeclaringType().getSignature());
- toFind = new MemberImpl(Member.METHOD,derivedType,
+ toFind = new MemberImpl(Member.METHOD, derivedType,
(Modifier.PUBLIC | Modifier.STATIC),
UnresolvedType.forSignature("V"),
- "onlyBase",
- new UnresolvedType[0]
- );
+ "onlyBase", UnresolvedType.NONE);
foundMembers = ResolvedMemberImpl.getJoinPointSignatures(toFind, world);
// this looks odd but we need both because of the way calls to inherited static methods
// are rendered in bytecode when written as obj.foo(); - the bytecode says it is a call
// to obj.getClass().foo() even if the static method is defined in a super type.
assertEquals("found 2 members",2,foundMembers.length);
- assertEquals("Lfluffy/Derived;",foundMembers[0].getDeclaringType().getSignature());
- assertEquals("Lfluffy/Base;",foundMembers[1].getDeclaringType().getSignature());
+ StringBuilder s= new StringBuilder();
+ for (ResolvedMember rm: foundMembers) {
+ s.append(rm.toString()+" ");
+ }
+ assertEquals("Expected derived but was "+foundMembers[0]+". All="+s,"Lfluffy/Derived;",foundMembers[0].getDeclaringType().getSignature());
+ assertEquals("Expected base but was "+foundMembers[1]+". All="+s,"Lfluffy/Base;",foundMembers[1].getDeclaringType().getSignature());
}
public void testBothStaticMethod() {
@@ -123,21 +123,15 @@ public class ResolvedMemberSignaturesTestCase15 extends TestCase {
public void testBothMethod() {
Member toFind = new MemberImpl(Member.METHOD,baseType,
- Modifier.PUBLIC,
- UnresolvedType.forSignature("V"),
- "bothNonStatic",
- new UnresolvedType[0]
- );
+ Modifier.PUBLIC, UnresolvedType.forSignature("V"),
+ "bothNonStatic", UnresolvedType.NONE);
ResolvedMember[] foundMembers = ResolvedMemberImpl.getJoinPointSignatures(toFind, world);
assertEquals("found 1 member",1,foundMembers.length);
assertEquals("Lfluffy/Base;",foundMembers[0].getDeclaringType().getSignature());
toFind = new MemberImpl(Member.METHOD,derivedType,
- Modifier.PUBLIC,
- UnresolvedType.forSignature("V"),
- "bothNonStatic",
- new UnresolvedType[0]
- );
+ Modifier.PUBLIC, UnresolvedType.forSignature("V"),
+ "bothNonStatic", UnresolvedType.NONE);
foundMembers = ResolvedMemberImpl.getJoinPointSignatures(toFind, world);
assertEquals("found 2 members",2,foundMembers.length);
assertEquals("Lfluffy/Derived;",foundMembers[0].getDeclaringType().getSignature());
@@ -279,6 +273,7 @@ public class ResolvedMemberSignaturesTestCase15 extends TestCase {
protected void setUp() throws Exception {
world = new BcelWorld();
+ world.setBehaveInJava5Way(true);
baseType = UnresolvedType.forSignature("Lfluffy/Base;");
derivedType = UnresolvedType.forSignature("Lfluffy/Derived;");
}
diff --git a/weaver/testsrc/org/aspectj/weaver/TestShadow.java b/weaver/src/test/java/org/aspectj/weaver/TestShadow.java
index 2cdfd84bf..2cdfd84bf 100644
--- a/weaver/testsrc/org/aspectj/weaver/TestShadow.java
+++ b/weaver/src/test/java/org/aspectj/weaver/TestShadow.java
diff --git a/weaver/testsrc/org/aspectj/weaver/TraceFactoryTest.java b/weaver/src/test/java/org/aspectj/weaver/TraceFactoryTest.java
index 24ec997fe..24ec997fe 100644
--- a/weaver/testsrc/org/aspectj/weaver/TraceFactoryTest.java
+++ b/weaver/src/test/java/org/aspectj/weaver/TraceFactoryTest.java
diff --git a/weaver/testsrc/org/aspectj/weaver/TypeVariableReferenceTypeTestCase.java b/weaver/src/test/java/org/aspectj/weaver/TypeVariableReferenceTypeTestCase.java
index 9e4985491..367a4fc93 100644
--- a/weaver/testsrc/org/aspectj/weaver/TypeVariableReferenceTypeTestCase.java
+++ b/weaver/src/test/java/org/aspectj/weaver/TypeVariableReferenceTypeTestCase.java
@@ -22,24 +22,20 @@ import org.aspectj.weaver.bcel.BcelWorld;
public class TypeVariableReferenceTypeTestCase extends TestCase {
ReferenceType javaLangClass;
+ ReferenceType jlNumber;
ReferenceType javaLangObject;
BoundedReferenceType extendsClass;
BoundedReferenceType superClass;
BoundedReferenceType extendsWithExtras;
BcelWorld world;
- public void testConstructionByNameAndVariable() {
- TypeVariable tv = new TypeVariable("T", javaLangClass);
- TypeVariableReferenceType tvrt = new TypeVariableReferenceType(tv, world);
- assertEquals("T", tvrt.getTypeVariable().getName());
- assertEquals(javaLangClass, tvrt.getTypeVariable().getUpperBound());
- }
-
@Override
protected void setUp() throws Exception {
super.setUp();
- world = new BcelWorld();
+ world = new BcelWorld("../bin");
+ world.setBehaveInJava5Way(true);
javaLangClass = (ReferenceType) world.resolve(UnresolvedType.forName("java/lang/Class"));
+ jlNumber = (ReferenceType) world.resolve(UnresolvedType.forSignature("Ljava/lang/Number;"));
javaLangObject = (ReferenceType) world.resolve(UnresolvedType.OBJECT);
extendsClass = new BoundedReferenceType(javaLangClass, true, world);
superClass = new BoundedReferenceType(javaLangClass, false, world);
@@ -47,4 +43,39 @@ public class TypeVariableReferenceTypeTestCase extends TestCase {
.resolve(UnresolvedType.forName("java/util/List")) });
}
+ public void testConstructionByNameAndVariable() {
+ TypeVariable tv = new TypeVariable("T", javaLangClass);
+ TypeVariableReferenceType tvrt = new TypeVariableReferenceType(tv, world);
+ assertEquals("T", tvrt.getTypeVariable().getName());
+ assertEquals(javaLangClass, tvrt.getTypeVariable().getUpperBound());
+ }
+
+ public void testBounds() {
+ // Load up the testclass from below
+ ResolvedType testerClass = world.resolve(Tester1.class.getName());
+ ResolvedType genericTesterClass = testerClass.getGenericType();
+
+ // Check the declaration type variable
+ TypeVariable[] typevars = genericTesterClass.getTypeVariables();
+ TypeVariable typevar = typevars[0];
+ assertEquals(jlNumber, typevar.getUpperBound());
+ assertEquals("T", typevar.getName());
+ ResolvedMember member = genericTesterClass.getDeclaredMethods()[1];
+
+ // getParameterTypes() returning the erased parameter
+ UnresolvedType param = member.getParameterTypes()[0];
+ assertEquals(jlNumber, param);
+
+ // Check the type variable reference
+ TypeVariableReferenceType tvReference = (TypeVariableReferenceType) member.getGenericParameterTypes()[0];
+ assertEquals("T", tvReference.getTypeVariableName());
+ assertEquals(jlNumber, tvReference.getUpperBound());
+ assertEquals(jlNumber, tvReference.getDelegate().getResolvedTypeX());
+ }
+
+ class Tester1<T extends Number> {
+ public void method(T t) {
+ }
+ }
+
}
diff --git a/weaver/testsrc/org/aspectj/weaver/TypeVariableTestCase.java b/weaver/src/test/java/org/aspectj/weaver/TypeVariableTestCase.java
index e213b6104..8ef8f70c1 100644
--- a/weaver/testsrc/org/aspectj/weaver/TypeVariableTestCase.java
+++ b/weaver/src/test/java/org/aspectj/weaver/TypeVariableTestCase.java
@@ -23,18 +23,18 @@ public class TypeVariableTestCase extends TestCase {
private UnresolvedType javaIoSerializable;
private World world;
- public void testDefaultBounds() {
- TypeVariable typevariable = new TypeVariable("T");
- assertNull(typevariable.getUpperBound());
- assertEquals("Object", UnresolvedType.OBJECT, typevariable.getFirstBound());
- assertEquals("no additional bounds", 0, typevariable.getSuperInterfaces().length);
- }
-
public void testName() {
TypeVariable tv = new TypeVariable("T");
assertEquals("T", tv.getName());
}
+ public void testDefaultBounds() {
+ TypeVariable tv = new TypeVariable("T");
+ assertEquals("Object", UnresolvedType.OBJECT, tv.getFirstBound());
+ assertNull(tv.getUpperBound());
+ assertEquals("no additional bounds", 0, tv.getSuperInterfaces().length);
+ }
+
public void testUpperBound() {
TypeVariable tv = new TypeVariable("N", javaLangNumber);
assertEquals("java.lang.Number", javaLangNumber, tv.getUpperBound());
@@ -44,6 +44,10 @@ public class TypeVariableTestCase extends TestCase {
TypeVariable tv = new TypeVariable("E", UnresolvedType.OBJECT, new UnresolvedType[] { javaUtilList });
assertEquals("1 additional bound", 1, tv.getSuperInterfaces().length);
assertEquals("java.util.List", javaUtilList, tv.getSuperInterfaces()[0]);
+
+ tv = new TypeVariable("E", null, new UnresolvedType[] { javaUtilList });
+ assertEquals("1 additional bound", 1, tv.getSuperInterfaces().length);
+ assertEquals("java.util.List", javaUtilList, tv.getSuperInterfaces()[0]);
}
public void testResolution() {
@@ -86,6 +90,8 @@ public class TypeVariableTestCase extends TestCase {
assertFalse(tv.canBeBoundTo(javaLangDouble.resolve(world)));
}
+ // ---
+
@Override
protected void setUp() throws Exception {
super.setUp();
diff --git a/weaver/testsrc/org/aspectj/weaver/TypeXTestCase.java b/weaver/src/test/java/org/aspectj/weaver/TypeXTestCase.java
index dc4c2e3d1..dc4c2e3d1 100644
--- a/weaver/testsrc/org/aspectj/weaver/TypeXTestCase.java
+++ b/weaver/src/test/java/org/aspectj/weaver/TypeXTestCase.java
diff --git a/weaver/src/test/java/org/aspectj/weaver/Weaver5ModuleTests.java b/weaver/src/test/java/org/aspectj/weaver/Weaver5ModuleTests.java
new file mode 100644
index 000000000..d54732b08
--- /dev/null
+++ b/weaver/src/test/java/org/aspectj/weaver/Weaver5ModuleTests.java
@@ -0,0 +1,37 @@
+//package org.aspectj.weaver;
+///*******************************************************************************
+// * Copyright (c) 2005 Contributors.
+// * All rights reserved.
+// * This program and the accompanying materials are made available
+// * under the terms of the Eclipse Public License v1.0
+// * which accompanies this distribution and is available at
+// * http://eclipse.org/legal/epl-v10.html
+// *
+// * Contributors: (See CVS logs)
+// *
+// *******************************************************************************/
+//
+//import junit.framework.Test;
+//import junit.framework.TestCase;
+//import junit.framework.TestSuite;
+//
+//import org.aspectj.testing.util.TestUtil;
+//
+///**
+// */
+//public class Weaver5ModuleTests extends TestCase {
+//
+// public static Test suite() {
+// TestSuite suite = new TestSuite(Weaver5ModuleTests.class.getName());
+// if (TestUtil.is15VMOrGreater()) {
+// TestUtil.loadTestsReflectively(suite, "org.aspectj.weaver.AllWeaver5Tests", false);
+// } else {
+// suite.addTest(TestUtil.testNamed("all tests require 1.5"));
+// }
+// return suite;
+// }
+// public static void main(String[] args) {
+// junit.textui.TestRunner.main(new String[] {Weaver5ModuleTests.class.getName()});
+// }
+//
+//}
diff --git a/weaver/testsrc/org/aspectj/weaver/WeaverMessagesTestCase.java b/weaver/src/test/java/org/aspectj/weaver/WeaverMessagesTestCase.java
index 7326971d3..7326971d3 100644
--- a/weaver/testsrc/org/aspectj/weaver/WeaverMessagesTestCase.java
+++ b/weaver/src/test/java/org/aspectj/weaver/WeaverMessagesTestCase.java
diff --git a/weaver/testsrc/org/aspectj/weaver/BcweaverTests.java b/weaver/src/test/java/org/aspectj/weaver/WeaverTestCase.java
index c14b59f32..152cae782 100644
--- a/weaver/testsrc/org/aspectj/weaver/BcweaverTests.java
+++ b/weaver/src/test/java/org/aspectj/weaver/WeaverTestCase.java
@@ -20,7 +20,7 @@ import junit.framework.TestSuite;
import org.aspectj.util.FileUtil;
-public class BcweaverTests extends TestCase {
+public abstract class WeaverTestCase extends TestCase {
public static final String TESTDATA_PATH = "../weaver/testdata";
public static final String OUTDIR_PATH = "../weaver/out";
@@ -43,21 +43,7 @@ public class BcweaverTests extends TestCase {
}
}
- public static Test suite() {
- TestSuite suite = new TestSuite(BcweaverTests.class.getName());
- // abstract
- // suite.addTestSuite(AbstractWorldTestCase.class);
- // $JUnit-BEGIN$
- suite.addTestSuite(MemberTestCase.class);
- suite.addTestSuite(TypeXTestCase.class);
- suite.addTestSuite(WeaverMessagesTestCase.class);
- suite.addTestSuite(DumpTestCase.class);
- suite.addTest(AllTracingTests.suite());
- // $JUnit-END$
- return suite;
- }
-
- public BcweaverTests(String name) {
+ public WeaverTestCase(String name) {
super(name);
}
diff --git a/weaver/testsrc/org/aspectj/weaver/bcel/AfterReturningWeaveTestCase.java b/weaver/src/test/java/org/aspectj/weaver/bcel/AfterReturningWeaveTestCase.java
index 8ccafe4de..8ccafe4de 100644
--- a/weaver/testsrc/org/aspectj/weaver/bcel/AfterReturningWeaveTestCase.java
+++ b/weaver/src/test/java/org/aspectj/weaver/bcel/AfterReturningWeaveTestCase.java
diff --git a/weaver/testsrc/org/aspectj/weaver/bcel/AfterThrowingWeaveTestCase.java b/weaver/src/test/java/org/aspectj/weaver/bcel/AfterThrowingWeaveTestCase.java
index b0c3f04ce..b0c3f04ce 100644
--- a/weaver/testsrc/org/aspectj/weaver/bcel/AfterThrowingWeaveTestCase.java
+++ b/weaver/src/test/java/org/aspectj/weaver/bcel/AfterThrowingWeaveTestCase.java
diff --git a/weaver/testsrc/org/aspectj/weaver/bcel/AfterWeaveTestCase.java b/weaver/src/test/java/org/aspectj/weaver/bcel/AfterWeaveTestCase.java
index a51c69b9a..a51c69b9a 100644
--- a/weaver/testsrc/org/aspectj/weaver/bcel/AfterWeaveTestCase.java
+++ b/weaver/src/test/java/org/aspectj/weaver/bcel/AfterWeaveTestCase.java
diff --git a/weaver/testsrc/org/aspectj/weaver/bcel/ArgsWeaveTestCase.java b/weaver/src/test/java/org/aspectj/weaver/bcel/ArgsWeaveTestCase.java
index 1108c3574..1108c3574 100644
--- a/weaver/testsrc/org/aspectj/weaver/bcel/ArgsWeaveTestCase.java
+++ b/weaver/src/test/java/org/aspectj/weaver/bcel/ArgsWeaveTestCase.java
diff --git a/weaver/testsrc/org/aspectj/weaver/bcel/AroundArgsWeaveTestCase.java b/weaver/src/test/java/org/aspectj/weaver/bcel/AroundArgsWeaveTestCase.java
index 4088755b5..4088755b5 100644
--- a/weaver/testsrc/org/aspectj/weaver/bcel/AroundArgsWeaveTestCase.java
+++ b/weaver/src/test/java/org/aspectj/weaver/bcel/AroundArgsWeaveTestCase.java
diff --git a/weaver/testsrc/org/aspectj/weaver/bcel/AroundWeaveTestCase.java b/weaver/src/test/java/org/aspectj/weaver/bcel/AroundWeaveTestCase.java
index a9d1fe9b4..a9d1fe9b4 100644
--- a/weaver/testsrc/org/aspectj/weaver/bcel/AroundWeaveTestCase.java
+++ b/weaver/src/test/java/org/aspectj/weaver/bcel/AroundWeaveTestCase.java
diff --git a/weaver/testsrc/org/aspectj/weaver/bcel/BcelGenericSignatureToTypeXTestCase.java b/weaver/src/test/java/org/aspectj/weaver/bcel/BcelGenericSignatureToTypeXTestCase.java
index 9ba0b1943..58f774840 100644
--- a/weaver/testsrc/org/aspectj/weaver/bcel/BcelGenericSignatureToTypeXTestCase.java
+++ b/weaver/src/test/java/org/aspectj/weaver/bcel/BcelGenericSignatureToTypeXTestCase.java
@@ -37,24 +37,6 @@ public class BcelGenericSignatureToTypeXTestCase extends TestCase {
return null;
}
- // public final GenericSignature.MethodTypeSignature getGenericMethodTypeSignature(JavaClass jClass) {
- // Signature sig = jClass.getSignatureAttribute();
- // if (sig != null) {
- // GenericSignatureParser parser = new GenericSignatureParser();
- // MethodTypeSignature mSig = parser.parseAsMethodSignature(sig);
- // return mSig;
- // }
- // return null;
- // }
-
- // public FieldTypeSignature asFieldTypeSignature() {
- // if (fieldSig == null) {
- // GenericSignatureParser parser = new GenericSignatureParser();
- // fieldSig = parser.parseAsFieldSignature(getSignature());
- // }
- // return fieldSig;
- // }
-
public void testEnumFromHell() throws Exception {
BcelWorld world = new BcelWorld();
JavaClass javaLangEnum = Repository.lookupClass("java/lang/Enum");
@@ -78,7 +60,6 @@ public class BcelGenericSignatureToTypeXTestCase extends TestCase {
UnresolvedType resolved = BcelGenericSignatureToTypeXConverter.classTypeSignature2TypeX(cSig.superclassSignature,
cSig.formalTypeParameters, world);
assertEquals("Ljava/lang/Object;", resolved.getSignature());
- // UnresolvedType resolvedInt =
BcelGenericSignatureToTypeXConverter.classTypeSignature2TypeX(cSig.superInterfaceSignatures[0], cSig.formalTypeParameters,
world);
diff --git a/weaver/testsrc/org/aspectj/weaver/bcel/BcelTestUtils.java b/weaver/src/test/java/org/aspectj/weaver/bcel/BcelTestUtils.java
index bc9f47a85..bc9f47a85 100644
--- a/weaver/testsrc/org/aspectj/weaver/bcel/BcelTestUtils.java
+++ b/weaver/src/test/java/org/aspectj/weaver/bcel/BcelTestUtils.java
diff --git a/weaver/src/test/java/org/aspectj/weaver/bcel/BcelWorldReferenceTypeTest.java b/weaver/src/test/java/org/aspectj/weaver/bcel/BcelWorldReferenceTypeTest.java
new file mode 100644
index 000000000..0ab70023e
--- /dev/null
+++ b/weaver/src/test/java/org/aspectj/weaver/bcel/BcelWorldReferenceTypeTest.java
@@ -0,0 +1,23 @@
+/* *******************************************************************
+ * Copyright (c) 2002-2008 Contributors
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * PARC initial implementation
+ * ******************************************************************/
+package org.aspectj.weaver.bcel;
+
+import org.aspectj.weaver.CommonReferenceTypeTests;
+import org.aspectj.weaver.World;
+
+public class BcelWorldReferenceTypeTest extends CommonReferenceTypeTests {
+
+ public World getWorld() {
+ return new BcelWorld();
+ }
+
+}
diff --git a/weaver/testsrc/org/aspectj/weaver/bcel/BeforeWeaveTestCase.java b/weaver/src/test/java/org/aspectj/weaver/bcel/BeforeWeaveTestCase.java
index a43689777..a43689777 100644
--- a/weaver/testsrc/org/aspectj/weaver/bcel/BeforeWeaveTestCase.java
+++ b/weaver/src/test/java/org/aspectj/weaver/bcel/BeforeWeaveTestCase.java
diff --git a/weaver/testsrc/org/aspectj/weaver/bcel/CheckerTestCase.java b/weaver/src/test/java/org/aspectj/weaver/bcel/CheckerTestCase.java
index b503e9593..b503e9593 100644
--- a/weaver/testsrc/org/aspectj/weaver/bcel/CheckerTestCase.java
+++ b/weaver/src/test/java/org/aspectj/weaver/bcel/CheckerTestCase.java
diff --git a/weaver/testsrc/org/aspectj/weaver/bcel/ClassLoaderRepositoryTests.java b/weaver/src/test/java/org/aspectj/weaver/bcel/ClassLoaderRepositoryTest.java
index 664b0c783..1d668def2 100644
--- a/weaver/testsrc/org/aspectj/weaver/bcel/ClassLoaderRepositoryTests.java
+++ b/weaver/src/test/java/org/aspectj/weaver/bcel/ClassLoaderRepositoryTest.java
@@ -28,7 +28,7 @@ import junit.framework.TestCase;
import org.aspectj.apache.bcel.util.ClassLoaderRepository;
/** NOT YET INCLUDED IN A FULL TEST RUN - WORK IN PROGRESS CHECKING CLASSLOADERREPOSITORY OPTIMIZATIONS */
-public class ClassLoaderRepositoryTests extends TestCase {
+public class ClassLoaderRepositoryTest extends TestCase {
private File f;
private ZipFile zf;
private Enumeration entries;
diff --git a/weaver/testsrc/org/aspectj/weaver/bcel/FieldSetTestCase.java b/weaver/src/test/java/org/aspectj/weaver/bcel/FieldSetTestCase.java
index c81827229..c81827229 100644
--- a/weaver/testsrc/org/aspectj/weaver/bcel/FieldSetTestCase.java
+++ b/weaver/src/test/java/org/aspectj/weaver/bcel/FieldSetTestCase.java
diff --git a/weaver/testsrc/org/aspectj/weaver/bcel/HierarchyDependsTestCase.java b/weaver/src/test/java/org/aspectj/weaver/bcel/HierarchyDependsTestCase.java
index 062f3dbef..062f3dbef 100644
--- a/weaver/testsrc/org/aspectj/weaver/bcel/HierarchyDependsTestCase.java
+++ b/weaver/src/test/java/org/aspectj/weaver/bcel/HierarchyDependsTestCase.java
diff --git a/weaver/testsrc/org/aspectj/weaver/bcel/IdWeaveTestCase.java b/weaver/src/test/java/org/aspectj/weaver/bcel/IdWeaveTestCase.java
index cf16b73b1..cf16b73b1 100644
--- a/weaver/testsrc/org/aspectj/weaver/bcel/IdWeaveTestCase.java
+++ b/weaver/src/test/java/org/aspectj/weaver/bcel/IdWeaveTestCase.java
diff --git a/weaver/testsrc/org/aspectj/weaver/bcel/JImageTestCase.java b/weaver/src/test/java/org/aspectj/weaver/bcel/JImageTestCase.java
index 9b465ebe8..6e89c675c 100644
--- a/weaver/testsrc/org/aspectj/weaver/bcel/JImageTestCase.java
+++ b/weaver/src/test/java/org/aspectj/weaver/bcel/JImageTestCase.java
@@ -49,10 +49,13 @@ public class JImageTestCase extends TestCase {
}
public void testOnJava9() {
- assertTrue(LangUtil.is19VMOrGreater());
+ if (!LangUtil.is19VMOrGreater()) {
+ System.out.println("SKIPPING JIMAGE TESTS AS NOT ON 1.9 OR LATER");
+ }
}
- public void testBasicStructureAndCapabilities() {
+ public void testBasicStructureAndCapabilities() {
+ if (!LangUtil.is19VMOrGreater()) return;
// Should be one entry for finding JRT contents
List<Entry> entries = cpm.getEntries();
assertEquals(1,entries.size());
@@ -64,6 +67,7 @@ public class JImageTestCase extends TestCase {
}
public void testBehaviour() throws Exception {
+ if (!LangUtil.is19VMOrGreater()) return;
JImageEntry jie = getJImageEntry();
Map<String, Path> packageCache = JImageEntry.getPackageCache();
diff --git a/weaver/testsrc/org/aspectj/weaver/bcel/MegaZipTestCase.java b/weaver/src/test/java/org/aspectj/weaver/bcel/MegaZipTestCase.java
index 797c153d5..ba71761b4 100644
--- a/weaver/testsrc/org/aspectj/weaver/bcel/MegaZipTestCase.java
+++ b/weaver/src/test/java/org/aspectj/weaver/bcel/MegaZipTestCase.java
@@ -19,7 +19,7 @@ import java.util.ArrayList;
import java.util.List;
import org.aspectj.weaver.AdviceKind;
-import org.aspectj.weaver.BcweaverTests;
+import org.aspectj.weaver.WeaverTestCase;
import org.aspectj.weaver.Member;
import org.aspectj.weaver.MemberImpl;
import org.aspectj.weaver.Shadow;
@@ -36,12 +36,12 @@ public class MegaZipTestCase extends WeaveTestCase {
public void setUp() throws Exception {
super.setUp();
- outDir = BcweaverTests.getOutdir();
+ outDir = WeaverTestCase.getOutdir();
}
public void tearDown() throws Exception {
super.tearDown();
- BcweaverTests.removeOutDir();
+ WeaverTestCase.removeOutDir();
outDir = null;
}
@@ -79,7 +79,7 @@ public class MegaZipTestCase extends WeaveTestCase {
public void zipTest(String fileName) throws IOException {
long startTime = System.currentTimeMillis();
- File inFile = new File(BcweaverTests.TESTDATA_PATH, fileName);
+ File inFile = new File(WeaverTestCase.TESTDATA_PATH, fileName);
File outFile = new File(outDir, fileName);
outFile.delete();
diff --git a/weaver/testsrc/org/aspectj/weaver/bcel/MoveInstructionsWeaveTestCase.java b/weaver/src/test/java/org/aspectj/weaver/bcel/MoveInstructionsWeaveTestCase.java
index bd7c2ae65..bd7c2ae65 100644
--- a/weaver/testsrc/org/aspectj/weaver/bcel/MoveInstructionsWeaveTestCase.java
+++ b/weaver/src/test/java/org/aspectj/weaver/bcel/MoveInstructionsWeaveTestCase.java
diff --git a/weaver/testsrc/org/aspectj/weaver/bcel/NonstaticWeaveTestCase.java b/weaver/src/test/java/org/aspectj/weaver/bcel/NonstaticWeaveTestCase.java
index 1f67a6249..1f67a6249 100644
--- a/weaver/testsrc/org/aspectj/weaver/bcel/NonstaticWeaveTestCase.java
+++ b/weaver/src/test/java/org/aspectj/weaver/bcel/NonstaticWeaveTestCase.java
diff --git a/weaver/testsrc/org/aspectj/weaver/bcel/PatternWeaveTestCase.java b/weaver/src/test/java/org/aspectj/weaver/bcel/PatternWeaveTestCase.java
index 2d9af5395..2d9af5395 100644
--- a/weaver/testsrc/org/aspectj/weaver/bcel/PatternWeaveTestCase.java
+++ b/weaver/src/test/java/org/aspectj/weaver/bcel/PatternWeaveTestCase.java
diff --git a/weaver/testsrc/org/aspectj/weaver/bcel/PointcutResidueTestCase.java b/weaver/src/test/java/org/aspectj/weaver/bcel/PointcutResidueTestCase.java
index 7f6f5f163..7f6f5f163 100644
--- a/weaver/testsrc/org/aspectj/weaver/bcel/PointcutResidueTestCase.java
+++ b/weaver/src/test/java/org/aspectj/weaver/bcel/PointcutResidueTestCase.java
diff --git a/weaver/testsrc/org/aspectj/weaver/bcel/TjpWeaveTestCase.java b/weaver/src/test/java/org/aspectj/weaver/bcel/TjpWeaveTestCase.java
index b24b3f6d0..b24b3f6d0 100644
--- a/weaver/testsrc/org/aspectj/weaver/bcel/TjpWeaveTestCase.java
+++ b/weaver/src/test/java/org/aspectj/weaver/bcel/TjpWeaveTestCase.java
diff --git a/weaver/testsrc/org/aspectj/weaver/bcel/TraceJarWeaveTestCase.java b/weaver/src/test/java/org/aspectj/weaver/bcel/TraceJarWeaveTestCase.java
index 45535407b..45535407b 100644
--- a/weaver/testsrc/org/aspectj/weaver/bcel/TraceJarWeaveTestCase.java
+++ b/weaver/src/test/java/org/aspectj/weaver/bcel/TraceJarWeaveTestCase.java
diff --git a/weaver/testsrc/org/aspectj/weaver/bcel/UtilityTestCase.java b/weaver/src/test/java/org/aspectj/weaver/bcel/UtilityTestCase.java
index 8083c1532..8083c1532 100644
--- a/weaver/testsrc/org/aspectj/weaver/bcel/UtilityTestCase.java
+++ b/weaver/src/test/java/org/aspectj/weaver/bcel/UtilityTestCase.java
diff --git a/weaver/testsrc/org/aspectj/weaver/bcel/WeaveOrderTestCase.java b/weaver/src/test/java/org/aspectj/weaver/bcel/WeaveOrderTestCase.java
index f22805f11..f22805f11 100644
--- a/weaver/testsrc/org/aspectj/weaver/bcel/WeaveOrderTestCase.java
+++ b/weaver/src/test/java/org/aspectj/weaver/bcel/WeaveOrderTestCase.java
diff --git a/weaver/testsrc/org/aspectj/weaver/bcel/WeaveTestCase.java b/weaver/src/test/java/org/aspectj/weaver/bcel/WeaveTestCase.java
index d39299ace..088a9a9d0 100644
--- a/weaver/testsrc/org/aspectj/weaver/bcel/WeaveTestCase.java
+++ b/weaver/src/test/java/org/aspectj/weaver/bcel/WeaveTestCase.java
@@ -29,7 +29,7 @@ import org.aspectj.testing.util.TestUtil;
import org.aspectj.util.FileUtil;
import org.aspectj.util.LangUtil;
import org.aspectj.weaver.Advice;
-import org.aspectj.weaver.BcweaverTests;
+import org.aspectj.weaver.WeaverTestCase;
import org.aspectj.weaver.ShadowMunger;
import org.aspectj.weaver.patterns.FormalBinding;
import org.aspectj.weaver.patterns.PerClause;
@@ -63,14 +63,14 @@ public abstract class WeaveTestCase extends TestCase {
@Override
public void setUp() throws Exception {
- outDir = BcweaverTests.getOutdir();
+ outDir = WeaverTestCase.getOutdir();
outDirPath = outDir.getAbsolutePath();
}
@Override
public void tearDown() throws Exception {
super.tearDown();
- BcweaverTests.removeOutDir();
+ WeaverTestCase.removeOutDir();
outDir = null;
outDirPath = null;
}
@@ -90,7 +90,7 @@ public abstract class WeaveTestCase extends TestCase {
}
// static String classDir = "../weaver/bin";
- static String classDir = BcweaverTests.TESTDATA_PATH + File.separator + "bin";
+ static String classDir = WeaverTestCase.TESTDATA_PATH + File.separator + "bin";
public void weaveTest(String name, String outName, List<ShadowMunger> planners) throws IOException {
BcelWeaver weaver = new BcelWeaver(world);
@@ -175,7 +175,7 @@ public abstract class WeaveTestCase extends TestCase {
realCheckClass(gen, outDir, expectedFile);
}
- static final File TESTDATA_DIR = new File(BcweaverTests.TESTDATA_PATH);
+ static final File TESTDATA_DIR = new File(WeaverTestCase.TESTDATA_PATH);
void genClass(LazyClassGen gen, String outDir, String expectedFile) throws IOException {
// ClassGen b = getJavaClass(outDir, className);
@@ -271,7 +271,7 @@ public abstract class WeaveTestCase extends TestCase {
}
public String getTraceJar() {
- return BcweaverTests.TESTDATA_PATH + "/tracing.jar";
+ return WeaverTestCase.TESTDATA_PATH + "/tracing.jar";
}
// ----
diff --git a/weaver/testsrc/org/aspectj/weaver/bcel/WorldTestCase.java b/weaver/src/test/java/org/aspectj/weaver/bcel/WorldTestCase.java
index 3d21b57ad..65d079543 100644
--- a/weaver/testsrc/org/aspectj/weaver/bcel/WorldTestCase.java
+++ b/weaver/src/test/java/org/aspectj/weaver/bcel/WorldTestCase.java
@@ -15,7 +15,7 @@ package org.aspectj.weaver.bcel;
import java.lang.reflect.Modifier;
import org.aspectj.weaver.Advice;
-import org.aspectj.weaver.BcweaverTests;
+import org.aspectj.weaver.WeaverTestCase;
import org.aspectj.weaver.CommonWorldTests;
import org.aspectj.weaver.Member;
import org.aspectj.weaver.MemberImpl;
@@ -31,7 +31,7 @@ import org.aspectj.weaver.World;
*/
public class WorldTestCase extends CommonWorldTests {
- private final BcelWorld world = new BcelWorld(BcweaverTests.TESTDATA_PATH + "/tracing.jar");
+ private final BcelWorld world = new BcelWorld(WeaverTestCase.TESTDATA_PATH + "/tracing.jar");
protected World getWorld() {
return world;
diff --git a/weaver/testsrc/org/aspectj/weaver/bcel/ZipFileWeaver.java b/weaver/src/test/java/org/aspectj/weaver/bcel/ZipFileWeaver.java
index 3be5ae332..3be5ae332 100644
--- a/weaver/testsrc/org/aspectj/weaver/bcel/ZipFileWeaver.java
+++ b/weaver/src/test/java/org/aspectj/weaver/bcel/ZipFileWeaver.java
diff --git a/weaver/testsrc/org/aspectj/weaver/bcel/ZipTestCase.java b/weaver/src/test/java/org/aspectj/weaver/bcel/ZipTestCase.java
index e9ef568b1..71f3bc926 100644
--- a/weaver/testsrc/org/aspectj/weaver/bcel/ZipTestCase.java
+++ b/weaver/src/test/java/org/aspectj/weaver/bcel/ZipTestCase.java
@@ -18,7 +18,7 @@ import java.util.Collection;
import junit.framework.TestCase;
-import org.aspectj.weaver.BcweaverTests;
+import org.aspectj.weaver.WeaverTestCase;
public class ZipTestCase extends TestCase {
@@ -34,11 +34,11 @@ public class ZipTestCase extends TestCase {
}
public void setUp() {
- outDir = BcweaverTests.getOutdir();
+ outDir = WeaverTestCase.getOutdir();
}
public void tearDown() {
- BcweaverTests.removeOutDir();
+ WeaverTestCase.removeOutDir();
outDir = null;
}
@@ -70,8 +70,8 @@ public class ZipTestCase extends TestCase {
world.addPath(new File(aspectjar).toString());
}
}
- weaver.addLibraryJarFile(new File(BcweaverTests.TESTDATA_PATH + "/Regex.jar")); // ???
- world.addPath(new File(BcweaverTests.TESTDATA_PATH + "/Regex.jar").getPath());
+ weaver.addLibraryJarFile(new File(WeaverTestCase.TESTDATA_PATH + "/Regex.jar")); // ???
+ world.addPath(new File(WeaverTestCase.TESTDATA_PATH + "/Regex.jar").getPath());
Collection<String> woven = weaver.weave(outFile);
long stopTime = System.currentTimeMillis();
@@ -84,17 +84,17 @@ public class ZipTestCase extends TestCase {
}
public void testSmall() throws IOException {
- zipTest(BcweaverTests.TESTDATA_PATH + "/Regex.jar", null);
+ zipTest(WeaverTestCase.TESTDATA_PATH + "/Regex.jar", null);
}
public void testSmallWithAspects() throws IOException {
System.out.println("could take 4 seconds...");
- zipTest(BcweaverTests.TESTDATA_PATH + "/Regex.jar", BcweaverTests.TESTDATA_PATH + "/megatrace.jar");
+ zipTest(WeaverTestCase.TESTDATA_PATH + "/Regex.jar", WeaverTestCase.TESTDATA_PATH + "/megatrace.jar");
}
public void testSmallWithAspectsNoWeave() throws IOException {
System.out.println("could take 4 seconds...");
- zipTest(BcweaverTests.TESTDATA_PATH + "/Regex.jar", BcweaverTests.TESTDATA_PATH + "/megatraceNoweave.jar", true);
+ zipTest(WeaverTestCase.TESTDATA_PATH + "/Regex.jar", WeaverTestCase.TESTDATA_PATH + "/megatraceNoweave.jar", true);
}
public void testBig() throws IOException {
@@ -104,18 +104,18 @@ public class ZipTestCase extends TestCase {
public void testBigWithEasyNoTrace() throws IOException {
System.out.println("could take 4 seconds...");
- zipTest("../lib/bcel/bcel.jar", BcweaverTests.TESTDATA_PATH + "/megatrace0easy.jar");
+ zipTest("../lib/bcel/bcel.jar", WeaverTestCase.TESTDATA_PATH + "/megatrace0easy.jar");
}
// this is something we test every now and again.
public void xtestBigWithHardNoTrace() throws IOException {
System.out.println("could take 24 seconds...");
- zipTest("../lib/bcel/bcel.jar", BcweaverTests.TESTDATA_PATH + "/megatrace0hard.jar");
+ zipTest("../lib/bcel/bcel.jar", WeaverTestCase.TESTDATA_PATH + "/megatrace0hard.jar");
}
public void xtestBigWithAspects() throws IOException {
System.out.println("could take 40 seconds...");
- zipTest("../lib/bcel/bcel.jar", BcweaverTests.TESTDATA_PATH + "/megatrace.jar");
+ zipTest("../lib/bcel/bcel.jar", WeaverTestCase.TESTDATA_PATH + "/megatrace.jar");
}
}
diff --git a/weaver/testsrc/org/aspectj/weaver/patterns/AnnotationPatternMatchingTestCase.java b/weaver/src/test/java/org/aspectj/weaver/patterns/AnnotationPatternMatchingTestCase.java
index e8999bafd..753e7a6b0 100644
--- a/weaver/testsrc/org/aspectj/weaver/patterns/AnnotationPatternMatchingTestCase.java
+++ b/weaver/src/test/java/org/aspectj/weaver/patterns/AnnotationPatternMatchingTestCase.java
@@ -21,7 +21,7 @@ import org.aspectj.bridge.IMessage;
import org.aspectj.bridge.IMessage.Kind;
import org.aspectj.bridge.IMessageHandler;
import org.aspectj.util.LangUtil;
-import org.aspectj.weaver.BcweaverTests;
+import org.aspectj.weaver.WeaverTestCase;
import org.aspectj.weaver.ResolvedMember;
import org.aspectj.weaver.ResolvedType;
import org.aspectj.weaver.bcel.BcelWorld;
@@ -64,7 +64,7 @@ public class AnnotationPatternMatchingTestCase extends TestCase {
private ResolvedType loadType(String name) {
if (world == null) {
- world = new BcelWorld(BcweaverTests.TESTDATA_PATH + "/testcode.jar");
+ world = new BcelWorld(WeaverTestCase.TESTDATA_PATH + "/testcode.jar");
world.setBehaveInJava5Way(true);
}
return world.resolve(name);
diff --git a/weaver/testsrc/org/aspectj/weaver/patterns/AnnotationPatternTestCase.java b/weaver/src/test/java/org/aspectj/weaver/patterns/AnnotationPatternTestCase.java
index 2d0820999..899b40b8e 100644
--- a/weaver/testsrc/org/aspectj/weaver/patterns/AnnotationPatternTestCase.java
+++ b/weaver/src/test/java/org/aspectj/weaver/patterns/AnnotationPatternTestCase.java
@@ -15,7 +15,7 @@ import org.aspectj.bridge.AbortException;
import org.aspectj.util.LangUtil;
import org.aspectj.weaver.AnnotatedElement;
import org.aspectj.weaver.AnnotationAJ;
-import org.aspectj.weaver.BcweaverTests;
+import org.aspectj.weaver.WeaverTestCase;
import org.aspectj.weaver.ResolvedType;
import org.aspectj.weaver.UnresolvedType;
import org.aspectj.weaver.bcel.BcelWorld;
@@ -337,7 +337,7 @@ public class AnnotationPatternTestCase extends TestCase {
}
public TestScope makeSimpleScope() {
- BcelWorld bWorld = new BcelWorld(BcweaverTests.TESTDATA_PATH + "/testcode.jar"); // testcode contains Foo/Boo/Goo/etc
+ BcelWorld bWorld = new BcelWorld(WeaverTestCase.TESTDATA_PATH + "/testcode.jar"); // testcode contains Foo/Boo/Goo/etc
bWorld.setBehaveInJava5Way(true);
return new TestScope(new String[] { "int", "java.lang.String", "Foo", "Boo", "Goo" }, new String[] { "a", "b", "foo",
"boo", "goo" }, bWorld);
diff --git a/weaver/testsrc/org/aspectj/weaver/patterns/ConcretizationTestCase.java b/weaver/src/test/java/org/aspectj/weaver/patterns/ConcretizationTestCase.java
index 8c3fd0d9c..8c3fd0d9c 100644
--- a/weaver/testsrc/org/aspectj/weaver/patterns/ConcretizationTestCase.java
+++ b/weaver/src/test/java/org/aspectj/weaver/patterns/ConcretizationTestCase.java
diff --git a/weaver/testsrc/org/aspectj/weaver/patterns/WildTypePatternResolutionTestCase.java b/weaver/src/test/java/org/aspectj/weaver/patterns/WildTypePatternResolutionTestCase.java
index e4039d063..5eda5d577 100644
--- a/weaver/testsrc/org/aspectj/weaver/patterns/WildTypePatternResolutionTestCase.java
+++ b/weaver/src/test/java/org/aspectj/weaver/patterns/WildTypePatternResolutionTestCase.java
@@ -14,6 +14,7 @@ package org.aspectj.weaver.patterns;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
+
import junit.framework.TestCase;
import org.aspectj.weaver.BoundedReferenceType;
@@ -313,16 +314,14 @@ public class WildTypePatternResolutionTestCase extends TestCase {
ResolvedType listOfDouble = TypeFactory.createParameterizedType(javaUtilList, new UnresolvedType[] { UnresolvedType
.forName("java.lang.Double").resolve(world) }, world);
- boolean matchesListOfNumber = wtp.matches(listOfNumber, TypePattern.STATIC).alwaysTrue();
- assertFalse("does not match list of number", matchesListOfNumber);
+ assertFalse("does not match list of number", wtp.matches(listOfNumber, TypePattern.STATIC).alwaysTrue());
assertFalse("does not match list of double", wtp.matches(listOfDouble, TypePattern.STATIC).alwaysTrue());
ResolvedType extendsNumber = TypeFactory.createTypeFromSignature("+Ljava/lang/Number;").resolve(world);
ResolvedType listOfExtendsNumber = TypeFactory.createParameterizedType(javaUtilList,
new UnresolvedType[] { extendsNumber }, world);
- boolean matchesListOfQmarkExtendsNumber = wtp.matches(listOfExtendsNumber, TypePattern.STATIC).alwaysTrue();
- assertTrue("failed to correctly match list of ? extends number", matchesListOfQmarkExtendsNumber);
+ assertTrue("matches list of ? extends number", wtp.matches(listOfExtendsNumber, TypePattern.STATIC).alwaysTrue());
ResolvedType extendsDouble = TypeFactory.createTypeFromSignature("+Ljava/lang/Double;").resolve(world);
ResolvedType listOfExtendsDouble = TypeFactory.createParameterizedType(javaUtilList,
diff --git a/weaver/testsrc/org/aspectj/weaver/patterns/bcel/BcelAndOrNotTestCase.java b/weaver/src/test/java/org/aspectj/weaver/patterns/bcel/BcelAndOrNotTestCase.java
index d72960fea..d72960fea 100644
--- a/weaver/testsrc/org/aspectj/weaver/patterns/bcel/BcelAndOrNotTestCase.java
+++ b/weaver/src/test/java/org/aspectj/weaver/patterns/bcel/BcelAndOrNotTestCase.java
diff --git a/weaver/testsrc/org/aspectj/weaver/patterns/bcel/BcelBindingTestCase.java b/weaver/src/test/java/org/aspectj/weaver/patterns/bcel/BcelBindingTestCase.java
index fac53dee1..fac53dee1 100644
--- a/weaver/testsrc/org/aspectj/weaver/patterns/bcel/BcelBindingTestCase.java
+++ b/weaver/src/test/java/org/aspectj/weaver/patterns/bcel/BcelBindingTestCase.java
diff --git a/weaver/testsrc/org/aspectj/weaver/patterns/bcel/BcelModifiersPatternTestCase.java b/weaver/src/test/java/org/aspectj/weaver/patterns/bcel/BcelModifiersPatternTestCase.java
index 06b89dc15..06b89dc15 100644
--- a/weaver/testsrc/org/aspectj/weaver/patterns/bcel/BcelModifiersPatternTestCase.java
+++ b/weaver/src/test/java/org/aspectj/weaver/patterns/bcel/BcelModifiersPatternTestCase.java
diff --git a/weaver/testsrc/org/aspectj/weaver/patterns/bcel/BcelParserTestCase.java b/weaver/src/test/java/org/aspectj/weaver/patterns/bcel/BcelParserTestCase.java
index 8d8f14d28..6dc837709 100644
--- a/weaver/testsrc/org/aspectj/weaver/patterns/bcel/BcelParserTestCase.java
+++ b/weaver/src/test/java/org/aspectj/weaver/patterns/bcel/BcelParserTestCase.java
@@ -11,7 +11,7 @@
* ******************************************************************/
package org.aspectj.weaver.patterns.bcel;
-import org.aspectj.weaver.BcweaverTests;
+import org.aspectj.weaver.WeaverTestCase;
import org.aspectj.weaver.World;
import org.aspectj.weaver.bcel.BcelWorld;
import org.aspectj.weaver.patterns.ParserTestCase;
@@ -19,7 +19,7 @@ import org.aspectj.weaver.patterns.ParserTestCase;
public class BcelParserTestCase extends ParserTestCase {
public World getWorld() {
- return new BcelWorld(BcweaverTests.TESTDATA_PATH + "/testcode.jar");
+ return new BcelWorld(WeaverTestCase.TESTDATA_PATH + "/testcode.jar");
}
}
diff --git a/weaver/testsrc/org/aspectj/weaver/patterns/bcel/BcelSignaturePatternTestCase.java b/weaver/src/test/java/org/aspectj/weaver/patterns/bcel/BcelSignaturePatternTestCase.java
index e7f0f9890..e7f0f9890 100644
--- a/weaver/testsrc/org/aspectj/weaver/patterns/bcel/BcelSignaturePatternTestCase.java
+++ b/weaver/src/test/java/org/aspectj/weaver/patterns/bcel/BcelSignaturePatternTestCase.java
diff --git a/weaver/testsrc/org/aspectj/weaver/patterns/bcel/BcelTypePatternListTestCase.java b/weaver/src/test/java/org/aspectj/weaver/patterns/bcel/BcelTypePatternListTestCase.java
index 935533d3c..935533d3c 100644
--- a/weaver/testsrc/org/aspectj/weaver/patterns/bcel/BcelTypePatternListTestCase.java
+++ b/weaver/src/test/java/org/aspectj/weaver/patterns/bcel/BcelTypePatternListTestCase.java
diff --git a/weaver/testsrc/org/aspectj/weaver/patterns/bcel/BcelTypePatternTestCase.java b/weaver/src/test/java/org/aspectj/weaver/patterns/bcel/BcelTypePatternTestCase.java
index 47b2ce3af..47b2ce3af 100644
--- a/weaver/testsrc/org/aspectj/weaver/patterns/bcel/BcelTypePatternTestCase.java
+++ b/weaver/src/test/java/org/aspectj/weaver/patterns/bcel/BcelTypePatternTestCase.java
diff --git a/weaver/testsrc/org/aspectj/weaver/patterns/bcel/BcelWithinTestCase.java b/weaver/src/test/java/org/aspectj/weaver/patterns/bcel/BcelWithinTestCase.java
index 8da1c172f..8da1c172f 100644
--- a/weaver/testsrc/org/aspectj/weaver/patterns/bcel/BcelWithinTestCase.java
+++ b/weaver/src/test/java/org/aspectj/weaver/patterns/bcel/BcelWithinTestCase.java
diff --git a/weaver/testsrc/org/aspectj/weaver/reflect/ReflectionBasedReferenceTypeDelegateTest.java b/weaver/src/test/java/org/aspectj/weaver/reflect/ReflectionBasedReferenceTypeDelegateTest.java
index 8047bbd4c..72c7c85f7 100644
--- a/weaver/testsrc/org/aspectj/weaver/reflect/ReflectionBasedReferenceTypeDelegateTest.java
+++ b/weaver/src/test/java/org/aspectj/weaver/reflect/ReflectionBasedReferenceTypeDelegateTest.java
@@ -24,7 +24,7 @@ import org.aspectj.weaver.ResolvedType;
import org.aspectj.weaver.UnresolvedType;
import org.aspectj.weaver.bcel.BcelWorld;
-public class ReflectionBasedReferenceTypeDelegateTest extends TestCase {
+public abstract class ReflectionBasedReferenceTypeDelegateTest extends TestCase {
protected ReflectionWorld world;
private ResolvedType objectType;
@@ -100,14 +100,6 @@ public class ReflectionBasedReferenceTypeDelegateTest extends TestCase {
assertEquals(world.resolve("reflect.tests.C"), d.getSuperclass());
}
- public void testArrayArgsSig() throws Exception {
- Method invokeMethod = Method.class.getMethod("invoke", new Class[] { Object.class, Object[].class });
- ResolvedMember reflectionMethod = ReflectionBasedReferenceTypeDelegateFactory.createResolvedMethod(invokeMethod, world);
- String exp = "(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;";
- assertTrue("Expected: \n" + exp + "\n but got:\n" + reflectionMethod.getSignature(), reflectionMethod.getSignature()
- .equals(exp));
- }
-
protected int findMethod(String name, ResolvedMember[] methods) {
for (int i = 0; i < methods.length; i++) {
if (name.equals(methods[i].getName())) {
@@ -307,6 +299,14 @@ public class ReflectionBasedReferenceTypeDelegateTest extends TestCase {
}
}
+ public void testArrayArgsSig() throws Exception {
+ Method invokeMethod = Method.class.getMethod("invoke", new Class[] { Object.class, Object[].class });
+ ResolvedMember reflectionMethod = ReflectionBasedReferenceTypeDelegateFactory.createResolvedMethod(invokeMethod, world);
+ String exp = "(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;";
+ assertTrue("Expected: \n" + exp + "\n but got:\n" + reflectionMethod.getSignature(), reflectionMethod.getSignature()
+ .equals(exp));
+ }
+
// todo: array of int
protected void setUp() throws Exception {
diff --git a/weaver/src/test/java/org/aspectj/weaver/reflect/ReflectionWorldReferenceTypeTest.java b/weaver/src/test/java/org/aspectj/weaver/reflect/ReflectionWorldReferenceTypeTest.java
new file mode 100644
index 000000000..720c88289
--- /dev/null
+++ b/weaver/src/test/java/org/aspectj/weaver/reflect/ReflectionWorldReferenceTypeTest.java
@@ -0,0 +1,27 @@
+/* *******************************************************************
+ * Copyright (c) 2002-2008 Contributors
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andy Clement
+ * ******************************************************************/
+package org.aspectj.weaver.reflect;
+
+import org.aspectj.weaver.CommonReferenceTypeTests;
+import org.aspectj.weaver.World;
+
+public class ReflectionWorldReferenceTypeTest extends CommonReferenceTypeTests {
+
+ protected boolean getSupportsAutoboxing() {
+ return true;
+ }
+
+ public World getWorld() {
+ return new ReflectionWorld(false, getClass().getClassLoader());
+ }
+
+}
diff --git a/weaver/src/test/java/org/aspectj/weaver/reflect/ReflectionWorldTest.java b/weaver/src/test/java/org/aspectj/weaver/reflect/ReflectionWorldTest.java
new file mode 100644
index 000000000..ede4e26d1
--- /dev/null
+++ b/weaver/src/test/java/org/aspectj/weaver/reflect/ReflectionWorldTest.java
@@ -0,0 +1,290 @@
+/* *******************************************************************
+ * Copyright (c) 2005,2017 Contributors.
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://eclipse.org/legal/epl-v10.html
+ * ******************************************************************/
+package org.aspectj.weaver.reflect;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.lang.reflect.Type;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.List;
+import java.util.Map;
+
+import org.aspectj.bridge.IMessageHandler;
+import org.aspectj.weaver.ReferenceType;
+import org.aspectj.weaver.ResolvedMember;
+import org.aspectj.weaver.ResolvedType;
+import org.aspectj.weaver.UnresolvedType;
+import org.aspectj.weaver.WeakClassLoaderReference;
+import org.aspectj.weaver.World;
+import org.aspectj.weaver.bcel.BcelWorld;
+
+import junit.framework.TestCase;
+
+/**
+ * @author Andy Clement
+ * @author Adrian Colyer
+ */
+public class ReflectionWorldTest extends TestCase {
+
+ public void testDelegateCreation() {
+ World world = new ReflectionWorld(getClass().getClassLoader());
+ ResolvedType rt = world.resolve("java.lang.Object");
+ assertNotNull(rt);
+ assertEquals("Ljava/lang/Object;", rt.getSignature());
+ }
+
+ // Removed for now. In Spring the reflection worlds are customized by introducing new
+ // PCD handlers. It means more thought needs to be put into reusing worlds.
+ public void xtestReflectionWorldFactory() throws Exception {
+ ClassLoader parent = getClass().getClassLoader();
+ ClassLoader cl1 = new URLClassLoader(new URL[] {}, parent);
+ ClassLoader cl2 = new URLClassLoader(new URL[] {}, parent);
+
+ WeakClassLoaderReference wcl1 = new WeakClassLoaderReference(cl1);
+ WeakClassLoaderReference wcl2 = new WeakClassLoaderReference(cl2);
+ ReflectionWorld a = ReflectionWorld.getReflectionWorldFor(wcl1);
+
+ ResolvedType stringClass1 = a.resolve(String.class);
+ assertNotNull(stringClass1);
+
+ ReflectionWorld b = ReflectionWorld.getReflectionWorldFor(wcl1);
+
+ // They should be the same because the classloader has not gone away
+ assertTrue(a==b);
+
+ cl1 = null;
+ for (int i=0;i<100;i++) {
+ System.gc(); // How robust is it that this should be causing the reference to be collected?
+ }
+ b = ReflectionWorld.getReflectionWorldFor(wcl1);
+
+ assertFalse(a==b);
+
+ cl1 = new URLClassLoader(new URL[] {}, parent);
+ wcl1 = new WeakClassLoaderReference(cl1);
+ a = ReflectionWorld.getReflectionWorldFor(wcl1);
+ b = ReflectionWorld.getReflectionWorldFor(wcl2);
+ assertFalse(a==b);
+
+ Field declaredField = ReflectionWorld.class.getDeclaredField("rworlds");
+ declaredField.setAccessible(true);
+ Map worlds = (Map)declaredField.get(null);
+ assertEquals(2, worlds.size());
+
+ cl2 = null;
+ for (int i=0;i<100;i++) {
+ System.gc(); // How robust is it that this should be causing the reference to be collected?
+ }
+ ReflectionWorld.getReflectionWorldFor(wcl1); // need to call this to trigger tidyup
+ assertEquals(1, worlds.size());
+
+ cl1 = null;
+ for (int i=0;i<100;i++) {
+ System.gc(); // How robust is it that this should be causing the reference to be collected?
+ }
+ ReflectionWorld.getReflectionWorldFor(wcl1); // need to call this to trigger tidyup
+ assertEquals(0, worlds.size());
+
+ cl1 = new URLClassLoader(new URL[] {}, parent);
+ wcl1 = new WeakClassLoaderReference(cl1);
+ ReflectionWorld reflectionWorldFor = ReflectionWorld.getReflectionWorldFor(wcl1);
+ assertEquals(1, worlds.size());
+ ReflectionWorld.cleanUpWorlds();
+ assertEquals(0, worlds.size());
+ }
+
+ public void testArrayTypes() {
+ IReflectionWorld world = new ReflectionWorld(getClass().getClassLoader());
+ String[] strArray = new String[1];
+ ResolvedType rt = world.resolve(strArray.getClass());
+ assertTrue(rt.isArray());
+ }
+
+ public void testPrimitiveTypes() {
+ IReflectionWorld world = new ReflectionWorld(getClass().getClassLoader());
+ assertEquals("int", UnresolvedType.INT, world.resolve(int.class));
+ assertEquals("void", UnresolvedType.VOID, world.resolve(void.class));
+ }
+
+ static class AbstractSuperClass<A,B> {}
+ static interface InterfaceOne {}
+ static interface InterfaceTwo<A> {}
+ static class ID {}
+ static abstract class AbstractTestClass<T> extends AbstractSuperClass<T,ID> implements InterfaceOne, InterfaceTwo<T> {
+
+ }
+ static class TestType {}
+// static class ConcreteClass extends AbstractTestClass<TestType> {
+ static class ConcreteClass extends AbstractTestClass<List<TestType>> {
+ }
+
+ static class Bar extends ConcreteClass {}
+
+ public void testGenerics() {
+ ReflectionWorld world = new ReflectionWorld(getClass().getClassLoader());
+// world.lookupOrCreateName(UnresolvedType.forName(AbstractTestClass.class.getName()));
+// ResolvedType resolvedType = world.resolve(AbstractTestClass.class);
+ JavaLangTypeToResolvedTypeConverter converter = new JavaLangTypeToResolvedTypeConverter(world);
+ ResolvedType resolvedType2 = converter.fromType(ConcreteClass.class);
+ }
+
+ public void xtestTypeConversions_509327() throws Exception {
+ ReflectionWorld rWorld = new ReflectionWorld(getClass().getClassLoader());
+ JavaLangTypeToResolvedTypeConverter converter = new JavaLangTypeToResolvedTypeConverter(rWorld);
+
+ // Check basic conversion of String to String
+ Method method = TestClass.class.getDeclaredMethod("m");
+ Type stringType = method.getGenericReturnType();
+ assertEquals("java.lang.String",stringType.getTypeName());
+ ResolvedType stringResolvedType = converter.fromType(stringType);
+ assertEquals("java.lang.String",stringResolvedType.getName());
+
+ // public String m() { return ""; }
+ method = TestClass2.class.getDeclaredMethod("m");
+ stringType = method.getGenericReturnType();
+ assertEquals("java.lang.String",stringType.getTypeName());
+ stringResolvedType = converter.fromType(stringType);
+ assertEquals("java.lang.String",stringResolvedType.getName());
+
+ // Verify that the conversion process creates the same thing as the bcel unpacking
+
+ // Here the return type is a non-static inner of a generic class
+ // public Inner m2() { return null; }
+ method = TestClass2.class.getDeclaredMethod("m2");
+ Type innerType = method.getGenericReturnType();
+ assertEquals("org.aspectj.weaver.reflect.ReflectionWorldTest.org.aspectj.weaver.reflect.ReflectionWorldTest$TestClass2<T>.Inner",innerType.getTypeName());
+ ResolvedType rType_Inner = converter.fromType(innerType);
+ assertEquals("Lorg/aspectj/weaver/reflect/ReflectionWorldTest$TestClass2$Inner;",rType_Inner.getSignature());
+ assertEquals(UnresolvedType.TypeKind.SIMPLE,rType_Inner.getTypekind());
+ ResolvedType rType_Outer = rType_Inner.getOuterClass();
+ assertEquals("Lorg/aspectj/weaver/reflect/ReflectionWorldTest$TestClass2;",rType_Outer.getSignature());
+
+ BcelWorld bWorld = new BcelWorld(getClass().getClassLoader(), IMessageHandler.THROW, null);
+ bWorld.setBehaveInJava5Way(true);
+ UnresolvedType javaUtilHashMap = UnresolvedType.forName("java.util.HashMap");
+ ReferenceType rawType = (ReferenceType) bWorld.resolve(javaUtilHashMap);
+ assertNotNull(rawType);
+
+ // Now use bcel to resolve the same m2 method, and compare the signatures of the return types
+ ResolvedType bResolved_TestClass2 = bWorld.resolve(UnresolvedType.forName(TestClass2.class.getName()));
+ assertNotNull(bResolved_TestClass2);
+ ResolvedMember bMethod_m2 = findMethod(bResolved_TestClass2,"m2");
+ ResolvedType bType_Inner = (ResolvedType) bMethod_m2.getReturnType();
+ assertEquals("Lorg/aspectj/weaver/reflect/ReflectionWorldTest$TestClass2$Inner;",bType_Inner.getSignature());
+ assertEquals(UnresolvedType.TypeKind.SIMPLE,bType_Inner.getTypekind());
+ ResolvedType bType_Outer = bType_Inner.getOuterClass();
+ assertEquals("Lorg/aspectj/weaver/reflect/ReflectionWorldTest$TestClass2;",bType_Outer.getSignature());
+
+ assertEquals(bType_Inner.getSignature(),rType_Inner.getSignature());
+ assertEquals(bType_Outer.getSignature(),rType_Outer.getSignature());
+ }
+
+
+ public void xtestTypeConversions_509327_2() throws Exception {
+ ReflectionWorld world = new ReflectionWorld(getClass().getClassLoader());
+ JavaLangTypeToResolvedTypeConverter converter = new JavaLangTypeToResolvedTypeConverter(world);
+ BcelWorld bWorld = new BcelWorld(getClass().getClassLoader(), IMessageHandler.THROW, null);
+ bWorld.setBehaveInJava5Way(true);
+
+ // Slightly more advanced, now the method is returning a parameterized form of the outer
+ // generic class
+
+ // public TestClass2<String>.Inner m3() { return new TestClass2<String>.Inner("Foo"); }
+ Method method = TestClass2.class.getDeclaredMethod("m3");
+ Type type_ParameterizedInner = method.getGenericReturnType();
+ assertEquals("org.aspectj.weaver.reflect.ReflectionWorldTest.org.aspectj.weaver.reflect.ReflectionWorldTest$TestClass2<java.lang.String>.Inner",type_ParameterizedInner.getTypeName());
+ ResolvedType rType_ParameterizedInner = converter.fromType(type_ParameterizedInner);
+ // NOTE: DECLARED PARAMETERIZATION OF OUTER IS LOST
+ assertEquals("Lorg/aspectj/weaver/reflect/ReflectionWorldTest$TestClass2$Inner;",rType_ParameterizedInner.getSignature());
+
+ ResolvedType bResolved_TestClass2 = bWorld.resolve(UnresolvedType.forName(TestClass2.class.getName()));
+ assertNotNull(bResolved_TestClass2);
+ ResolvedMember bMethod_m3 = findMethod(bResolved_TestClass2,"m3");
+ ResolvedType bType_Inner = (ResolvedType) bMethod_m3.getReturnType();
+ // NOTE: DECLARED PARAMETERIZATION OF OUTER IS LOST
+ assertEquals("Lorg/aspectj/weaver/reflect/ReflectionWorldTest$TestClass2$Inner;",bType_Inner.getSignature());
+
+ assertEquals(UnresolvedType.TypeKind.SIMPLE,bType_Inner.getTypekind());
+ ResolvedType bType_Outer = bType_Inner.getOuterClass();
+
+ // Fields seem to lose it too, although the backinggenericmember has the info
+// ResolvedMember bField_f = findField(bResolved_TestClass2,"f");
+// ResolvedMember backingGenericMember = bField_f.getBackingGenericMember();
+// System.out.println(backingGenericMember);
+// System.out.println(backingGenericMember.getGenericReturnType());
+// System.out.println(bField_f);
+// System.out.println(bField_f.getSignature());
+// System.out.println(bField_f.getGenericReturnType());
+ }
+
+// public void testbar() throws Exception {
+// ReflectionWorld world = new ReflectionWorld(getClass().getClassLoader());
+// JavaLangTypeToResolvedTypeConverter converter = new JavaLangTypeToResolvedTypeConverter(world);
+//
+// // public TestClass2<String>.Inner m3() { return new TestClass2<String>.Inner("Foo"); }
+// Method method = TestClass2.class.getDeclaredMethod("m3");
+// Type type_ParameterizedInner = method.getGenericReturnType();
+// assertEquals("org.aspectj.weaver.reflect.ReflectionWorldTest.org.aspectj.weaver.reflect.ReflectionWorldTest$TestClass2<java.lang.String>.Inner",type_ParameterizedInner.getTypeName());
+// ResolvedType rType_ParameterizedInner = converter.fromType(type_ParameterizedInner);
+// System.out.println(rType_ParameterizedInner);
+// System.out.println(type_ParameterizedInner.getTypeName());
+// }
+//
+// public void testfoo() {
+// ReflectionWorld world = new ReflectionWorld(getClass().getClassLoader());
+// JavaLangTypeToResolvedTypeConverter converter = new JavaLangTypeToResolvedTypeConverter(world);
+// BcelWorld bWorld = new BcelWorld(getClass().getClassLoader(), IMessageHandler.THROW, null);
+// bWorld.setBehaveInJava5Way(true);
+//
+//
+// ResolvedType bResolved_TestClass2 = bWorld.resolve(UnresolvedType.forName(TestClass2.class.getName()));
+// ResolvedMember bField_f = findField(bResolved_TestClass2,"f");
+// System.out.println(bField_f);
+// System.out.println(bField_f.getGenericReturnType());
+// System.out.println(bField_f.getReturnType());
+// System.out.println(bField_f.getBackingGenericMember().getGenericReturnType());
+// }
+
+ static class TestClass {
+ public String m() { return ""; }
+ }
+
+ static class TestClass2<T> {
+ class Inner {
+ T t;
+ Inner(T t) {
+ this.t = t;
+ }
+ }
+ public String m() { return ""; }
+ public Inner m2() { return null; }
+ public TestClass2<String> f;
+ public TestClass2<String>.Inner m3() { return new TestClass2<String>.Inner("Foo"); }
+ }
+
+ private ResolvedMember findMethod(ResolvedType resolvedType, String methodName) {
+ for (ResolvedMember method: resolvedType.getDeclaredMethods()) {
+ if (method.getName().equals(methodName)) {
+ return method;
+ }
+ }
+ return null;
+ }
+
+ private ResolvedMember findField(ResolvedType resolvedType, String fieldName) {
+ for (ResolvedMember field: resolvedType.getDeclaredFields()) {
+ if (field.getName().equals(fieldName)) {
+ return field;
+ }
+ }
+ return null;
+ }
+
+}
diff --git a/weaver/src/test/java/org/aspectj/weaver/tools/Java15PointcutExpressionTest.java b/weaver/src/test/java/org/aspectj/weaver/tools/Java15PointcutExpressionTest.java
new file mode 100644
index 000000000..f651a2f29
--- /dev/null
+++ b/weaver/src/test/java/org/aspectj/weaver/tools/Java15PointcutExpressionTest.java
@@ -0,0 +1,746 @@
+/* *******************************************************************
+ * Copyright (c) 2005 Contributors.
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Adrian Colyer Initial implementation
+ * ******************************************************************/
+package org.aspectj.weaver.tools;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+import java.util.StringTokenizer;
+
+import org.aspectj.lang.annotation.Pointcut;
+import org.aspectj.weaver.ResolvedType;
+import org.aspectj.weaver.internal.tools.PointcutExpressionImpl;
+import org.aspectj.weaver.patterns.AbstractPatternNodeVisitor;
+import org.aspectj.weaver.patterns.AndAnnotationTypePattern;
+import org.aspectj.weaver.patterns.AnnotationPatternList;
+import org.aspectj.weaver.patterns.AnyAnnotationTypePattern;
+import org.aspectj.weaver.patterns.BindingAnnotationTypePattern;
+import org.aspectj.weaver.patterns.ExactAnnotationTypePattern;
+import org.aspectj.weaver.patterns.KindedPointcut;
+import org.aspectj.weaver.patterns.NotAnnotationTypePattern;
+import org.aspectj.weaver.patterns.OrAnnotationTypePattern;
+import org.aspectj.weaver.patterns.SignaturePattern;
+import org.aspectj.weaver.patterns.TypePattern;
+import org.aspectj.weaver.patterns.TypePatternList;
+import org.aspectj.weaver.patterns.WildAnnotationTypePattern;
+
+import test.A1AnnotatedType;
+import test.A2AnnotatedType;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+/**
+ * Test parameter pointcut parsing. Extended by Andy Clement to cover parameter annotation matching.
+ *
+ */
+public class Java15PointcutExpressionTest extends TestCase {
+
+ public static Test suite() {
+ TestSuite suite = new TestSuite("Java15PointcutExpressionTest");
+ suite.addTestSuite(Java15PointcutExpressionTest.class);
+ return suite;
+ }
+
+ private PointcutParser parser;
+ private Method a;
+ private Method b;
+ private Method c;
+ private Method d;
+
+ /**
+ * Parse some expressions and ensure we capture the parameter annotations and parameter type annotations correctly.
+ * Buckle up, this will get complicated ;)
+ */
+ public void testParseParameterAnnotationExpressions() {
+ PointcutParser p = PointcutParser.getPointcutParserSupportingAllPrimitivesAndUsingSpecifiedClassloaderForResolution(this.getClass().getClassLoader());
+ PointcutExpression pexpr = null;
+
+ pexpr = p.parsePointcutExpression("execution(public void foo(@MA *))");
+ checkParameterAnnotations(pexpr,0,null,"@MA","exact[@MA:t]");
+
+ pexpr = p.parsePointcutExpression("execution(public void foo(@MA (*)))");
+ checkParameterAnnotations(pexpr,0,"@MA",null,"exact[@MA:p]");
+
+ pexpr = p.parsePointcutExpression("execution(public void foo(@MA @MB *))");
+ checkParameterAnnotations(pexpr,0,null,"@MA @MB","(exact[@MA:t] and exact[@MB:t])");
+
+ pexpr = p.parsePointcutExpression("execution(public void foo(@MA (@MB *)))");
+ checkParameterAnnotations(pexpr,0,"@MA","@MB","(exact[@MA:p] and exact[@MB:t])");
+
+ pexpr = p.parsePointcutExpression("execution(public void foo(@MA @MB (@MC *)))");
+ checkParameterAnnotations(pexpr,0,"@MA @MB","@MC","((exact[@MA:p] and exact[@MB:p]) and exact[@MC:t])");
+
+ pexpr = p.parsePointcutExpression("execution(public void foo(@MA (@MB @MC @MD *)))");
+ checkParameterAnnotations(pexpr,0,"@MA","@MB @MC @MD","(exact[@MA:p] and ((exact[@MB:t] and exact[@MC:t]) and exact[@MD:t]))");
+
+ pexpr = p.parsePointcutExpression("execution(public void foo(@(MA || MB) (@MC @MD *)))");
+ checkParameterAnnotations(pexpr,0,null/*Should be MA MB */,"@MC @MD","(wild[(MA || MB)] and (exact[@MC:t] and exact[@MD:t]))"); // I dont think WildAnnotationTypePatterns work properly...
+
+ pexpr = p.parsePointcutExpression("execution(public void foo(@MA (@MB *),(@MC *),@MD (*)))");
+ checkParameterAnnotations(pexpr,0,"@MA","@MB","(exact[@MA:p] and exact[@MB:t])");
+ checkParameterAnnotations(pexpr,1,null,"@MC","exact[@MC:t]");
+ checkParameterAnnotations(pexpr,2,"@MD",null,"exact[@MD:p]");
+
+ }
+
+ public void testMatchingAnnotationValueExpressions() throws SecurityException, NoSuchMethodException {
+ PointcutParser p = PointcutParser.getPointcutParserSupportingAllPrimitivesAndUsingSpecifiedClassloaderForResolution(this.getClass().getClassLoader());
+ PointcutExpression pexpr = null;
+ ShadowMatch match = null;
+
+ Method n = test.AnnoValues.class.getMethod("none");
+ Method r = test.AnnoValues.class.getMethod("redMethod");
+ Method g = test.AnnoValues.class.getMethod("greenMethod");
+ Method b = test.AnnoValues.class.getMethod("blueMethod");
+ Method d = test.AnnoValues.class.getMethod("defaultMethod");
+
+ pexpr = p.parsePointcutExpression("execution(@test.A3(test.Color.RED) public void *(..))");
+ assertTrue("Should match", pexpr.matchesMethodExecution(n).neverMatches()); // default value RED
+ assertTrue("Should match", pexpr.matchesMethodExecution(r).alwaysMatches());
+ assertTrue("Should not match", pexpr.matchesMethodExecution(g).neverMatches());
+ assertTrue("Should not match", pexpr.matchesMethodExecution(b).neverMatches());
+ assertTrue("Should match", pexpr.matchesMethodExecution(d).alwaysMatches());
+
+ pexpr = p.parsePointcutExpression("execution(@test.A3(test.Color.GREEN) public void *(..))");
+ assertTrue("Should not match", pexpr.matchesMethodExecution(n).neverMatches()); // default value RED
+ assertTrue("Should not match", pexpr.matchesMethodExecution(r).neverMatches());
+ assertTrue("Should match", pexpr.matchesMethodExecution(g).alwaysMatches());
+ assertTrue("Should not match", pexpr.matchesMethodExecution(b).neverMatches());
+ assertTrue("Should not match", pexpr.matchesMethodExecution(d).neverMatches());
+
+ pexpr = p.parsePointcutExpression("execution(@test.A3(test.Color.BLUE) public void *(..))");
+ assertTrue("Should not match", pexpr.matchesMethodExecution(n).neverMatches()); // default value RED
+ assertTrue("Should not match", pexpr.matchesMethodExecution(r).neverMatches());
+ assertTrue("Should not match", pexpr.matchesMethodExecution(g).neverMatches());
+ assertTrue("Should match", pexpr.matchesMethodExecution(b).alwaysMatches());
+ assertTrue("Should not match", pexpr.matchesMethodExecution(d).neverMatches());
+
+ pexpr = p.parsePointcutExpression("execution(@test.A3 public void *(..))");
+ assertTrue("Should match", pexpr.matchesMethodExecution(n).neverMatches()); // default value RED
+ assertTrue("Should match", pexpr.matchesMethodExecution(r).alwaysMatches());
+ assertTrue("Should match", pexpr.matchesMethodExecution(g).alwaysMatches());
+ assertTrue("Should match", pexpr.matchesMethodExecution(b).alwaysMatches());
+ assertTrue("Should match", pexpr.matchesMethodExecution(d).alwaysMatches());
+
+ }
+
+ private static final Set<PointcutPrimitive> DEFAULT_SUPPORTED_PRIMITIVES = new HashSet<PointcutPrimitive>();
+
+ static {
+ DEFAULT_SUPPORTED_PRIMITIVES.add(PointcutPrimitive.EXECUTION);
+ DEFAULT_SUPPORTED_PRIMITIVES.add(PointcutPrimitive.ARGS);
+ DEFAULT_SUPPORTED_PRIMITIVES.add(PointcutPrimitive.REFERENCE);
+ DEFAULT_SUPPORTED_PRIMITIVES.add(PointcutPrimitive.THIS);
+ DEFAULT_SUPPORTED_PRIMITIVES.add(PointcutPrimitive.TARGET);
+ DEFAULT_SUPPORTED_PRIMITIVES.add(PointcutPrimitive.WITHIN);
+ DEFAULT_SUPPORTED_PRIMITIVES.add(PointcutPrimitive.AT_ANNOTATION);
+ DEFAULT_SUPPORTED_PRIMITIVES.add(PointcutPrimitive.AT_WITHIN);
+ DEFAULT_SUPPORTED_PRIMITIVES.add(PointcutPrimitive.AT_ARGS);
+ DEFAULT_SUPPORTED_PRIMITIVES.add(PointcutPrimitive.AT_TARGET);
+ }
+
+ public void testPerformanceOfPointcutParsing() {
+ String expression = "execution(public * rewards.internal.*.*Repository+.*(..))";
+ long stime1 = System.currentTimeMillis();
+ PointcutParser parser = PointcutParser.getPointcutParserSupportingSpecifiedPrimitivesAndUsingContextClassloaderForResolution(DEFAULT_SUPPORTED_PRIMITIVES);
+ long stime2 = System.currentTimeMillis();
+ PointcutExpression pointcutExpression = parser.parsePointcutExpression(expression, null, new PointcutParameter[0]);
+ long etime = System.currentTimeMillis();
+ System.out.println("Time to get a parser "+(stime2-stime1)+"ms");
+ System.out.println("Time taken to parse expression is "+(etime-stime2)+"ms");
+ }
+
+
+ public void testPerformanceOfPointcutParsingWithBean() {
+ String expression = "execution(public * rewards.internal.*.*Repository+.*(..))";
+ PointcutParser parser = PointcutParser.getPointcutParserSupportingAllPrimitivesAndUsingSpecifiedClassloaderForResolution(this.getClass().getClassLoader());
+ BeanDesignatorHandler beanHandler = new BeanDesignatorHandler();
+ parser.registerPointcutDesignatorHandler(beanHandler);
+ long stime = System.currentTimeMillis();
+ PointcutExpression pointcutExpression = parser.parsePointcutExpression(expression, null, new PointcutParameter[0]);
+ long etime = System.currentTimeMillis();
+ System.out.println("Time taken to parse expression is "+(etime-stime)+"ms");
+ }
+
+ private class BeanDesignatorHandler implements PointcutDesignatorHandler {
+
+ private String askedToParse;
+ public boolean simulateDynamicTest = false;
+
+ public String getDesignatorName() {
+ return "bean";
+ }
+
+ /* (non-Javadoc)
+ * @see org.aspectj.weaver.tools.PointcutDesignatorHandler#parse(java.lang.String)
+ */
+ public ContextBasedMatcher parse(String expression) {
+ this.askedToParse = expression;
+ return null;
+// return new BeanPointcutExpression(expression,this.simulateDynamicTest);
+ }
+
+ public String getExpressionLastAskedToParse() {
+ return this.askedToParse;
+ }
+ }
+
+
+ /**
+ * Test matching of pointcuts against expressions. A reflection world is being used on the backend here (not a Bcel one).
+ */
+ public void testMatchingParameterAnnotationExpressions() throws SecurityException, NoSuchMethodException {
+ PointcutParser p = PointcutParser.getPointcutParserSupportingAllPrimitivesAndUsingSpecifiedClassloaderForResolution(this.getClass().getClassLoader());
+ PointcutExpression pexpr = null;
+ ShadowMatch match = null;
+
+ Method a = test.A.class.getMethod("a",new Class[] {String.class}); // public void a(String s) {}
+ Method b = test.A.class.getMethod("b",new Class[] {String.class}); // public void b(@A1 String s) {}
+ Method c = test.A.class.getMethod("c",new Class[] {String.class}); // public void c(@A1 @A2 String s) {}
+// Method d = test.A.class.getMethod("d",new Class[] {String.class,String.class});// public void d(@A1 String s,@A2 String t) {}
+
+ Method e = test.A.class.getMethod("e",new Class[] {A1AnnotatedType.class}); // public void e(A1AnnotatedType s) {}
+ Method f = test.A.class.getMethod("f",new Class[] {A2AnnotatedType.class}); // public void f(A2AnnotatedType s) {}
+ Method g = test.A.class.getMethod("g",new Class[] {A1AnnotatedType.class}); // public void g(@A2 A1AnnotatedType s) {}
+ Method h = test.A.class.getMethod("h",new Class[] {A1AnnotatedType.class}); // public void h(@A1 A1AnnotatedType s) {}
+// Method i = test.A.class.getMethod("i",new Class[] {A1AnnotatedType.class,String.class}); // public void i(A1AnnotatedType s,@A2 String t) {}
+// Method j = test.A.class.getMethod("j",new Class[] {String.class}); // public void j(@A1 @A2 String s) {}
+
+ pexpr = p.parsePointcutExpression("execution(public void *(@test.A1 *))");
+ assertTrue("Should not match", pexpr.matchesMethodExecution(a).neverMatches());
+ assertTrue("Should not match", pexpr.matchesMethodExecution(b).neverMatches());
+ assertTrue("Should not match", pexpr.matchesMethodExecution(c).neverMatches());
+
+ pexpr = p.parsePointcutExpression("execution(public void *(@test.A1 (*)))");
+ assertTrue("Should not match", pexpr.matchesMethodExecution(a).neverMatches());
+ assertTrue("Should match", pexpr.matchesMethodExecution(b).alwaysMatches());
+ assertTrue("Should match", pexpr.matchesMethodExecution(c).alwaysMatches());
+
+ pexpr = p.parsePointcutExpression("execution(public void *(@test.A1 *))");
+ assertTrue("Should match", pexpr.matchesMethodExecution(e).alwaysMatches());
+ assertTrue("Should not match", pexpr.matchesMethodExecution(f).neverMatches());
+ assertTrue("Should match", pexpr.matchesMethodExecution(g).alwaysMatches());
+ assertTrue("Should match", pexpr.matchesMethodExecution(h).alwaysMatches());
+
+ pexpr = p.parsePointcutExpression("execution(public void *(@test.A1 (*)))");
+ assertTrue("Should not match", pexpr.matchesMethodExecution(e).neverMatches());
+ assertTrue("Should not match", pexpr.matchesMethodExecution(f).neverMatches());
+ assertTrue("Should not match", pexpr.matchesMethodExecution(g).neverMatches());
+ assertTrue("Should match", pexpr.matchesMethodExecution(h).alwaysMatches());
+
+ pexpr = p.parsePointcutExpression("execution(public void *(@(test.A1 || test.A2) (*)))");
+ assertTrue("Should not match", pexpr.matchesMethodExecution(a).neverMatches());
+ assertTrue("Should match", pexpr.matchesMethodExecution(b).alwaysMatches());
+ assertTrue("Should match", pexpr.matchesMethodExecution(c).alwaysMatches());
+ assertTrue("Should match", pexpr.matchesMethodExecution(g).alwaysMatches());
+ assertTrue("Should match", pexpr.matchesMethodExecution(h).alwaysMatches());
+
+ pexpr = p.parsePointcutExpression("execution(public void *(@(test.A1 && test.A2) (*),..))");
+ assertTrue("Should not match", pexpr.matchesMethodExecution(a).neverMatches());
+ assertTrue("Should not match", pexpr.matchesMethodExecution(b).neverMatches());
+ assertTrue("Should not match", pexpr.matchesMethodExecution(c).neverMatches());
+ assertTrue("Should not match", pexpr.matchesMethodExecution(g).neverMatches());
+ assertTrue("Should not match", pexpr.matchesMethodExecution(h).neverMatches());
+// assertTrue("Should match", pexpr.matchesMethodExecution(j).alwaysMatches()); // should match but does not, broken implementation, old bug - see WildAnnotationTypePattern.match
+
+
+
+ }
+
+ private void checkParameterAnnotations(PointcutExpression pe,int parameterNumber,String expectedParameterAnnotations,String expectedParameterTypeAnnotations,String expectedNodeStructure) {
+ org.aspectj.weaver.patterns.Pointcut p = ((PointcutExpressionImpl)pe).getUnderlyingPointcut();
+ KindedPointcut kindedP = (KindedPointcut)p;
+ SignaturePattern sp = kindedP.getSignature();
+ TypePatternList tpl = sp.getParameterTypes();
+ TypePattern[] tps = tpl.getTypePatterns();
+
+ // A visitor over the annotation pattern for the parameter will break it down into parameter vs parameter type annotations
+ MyPatternNodeVisitor mpnv = new MyPatternNodeVisitor();
+ tps[parameterNumber].getAnnotationPattern().accept(mpnv,null);
+
+ if (expectedNodeStructure==null) {
+ // The caller hasn't worked it out yet!!
+ System.out.println(mpnv.getStringRepresentation());
+ } else if (!mpnv.getStringRepresentation().equals(expectedNodeStructure)) {
+ System.out.println(mpnv.getStringRepresentation());
+ fail("Expected annotation pattern node structure for expression "+pe.getPointcutExpression()+
+ " was '"+expectedNodeStructure+"' but it turned out to be '"+mpnv.getStringRepresentation()+"'");
+ }
+
+ tps[parameterNumber].getAnnotationPattern().toString();
+
+ // parameter type annotation checking
+ Set<String> expected = new HashSet<String>();
+ expected.addAll(mpnv.getParameterTypeAnnotations());
+
+ StringTokenizer st = new StringTokenizer(expectedParameterTypeAnnotations==null?"":expectedParameterTypeAnnotations);
+ while (st.hasMoreTokens()) {
+ String nextToken = st.nextToken();
+ if (!expected.contains(nextToken))
+ fail("In pointcut expression "+pe.getPointcutExpression()+" parameter "+parameterNumber+". The annotation type pattern did not include parameter type annotation "+nextToken+". It's full set was "+mpnv.getParameterTypeAnnotations());
+ expected.remove(nextToken);
+ }
+ if (expected.size()>0) { // we have excess ones!
+ StringBuffer excessTokens = new StringBuffer();
+ for (Iterator iterator = expected.iterator(); iterator.hasNext();) {
+ String string = (String) iterator.next();
+ excessTokens.append(string).append(" ");
+ }
+ fail("In pointcut expression "+pe.getPointcutExpression()+" parameter "+parameterNumber+". The annotation type pattern has these unexpected parameter type annotations "+excessTokens.toString());
+ }
+
+ // parameter annotation checking
+ expected = new HashSet<String>();
+ expected.addAll(mpnv.getParameterAnnotations());
+
+ st = new StringTokenizer(expectedParameterAnnotations==null?"":expectedParameterAnnotations);
+ while (st.hasMoreTokens()) {
+ String nextToken = st.nextToken();
+ if (!expected.contains(nextToken))
+ fail("In pointcut expression "+pe.getPointcutExpression()+" parameter "+parameterNumber+". The annotation type pattern did not include parameter annotation "+nextToken+". It's full set was "+mpnv.getParameterAnnotations());
+ expected.remove(nextToken);
+ }
+ if (expected.size()>0) { // we have excess ones!
+ StringBuffer excessTokens = new StringBuffer();
+ for (Iterator iterator = expected.iterator(); iterator.hasNext();) {
+ String string = (String) iterator.next();
+ excessTokens.append(string).append(" ");
+ }
+ fail("In pointcut expression "+pe.getPointcutExpression()+" parameter "+parameterNumber+". The annotation type pattern has these unexpected parameter annotations "+excessTokens.toString());
+ }
+
+ }
+
+ static class MyPatternNodeVisitor extends AbstractPatternNodeVisitor {
+ private StringBuffer stringRep = new StringBuffer();
+ private List<String> parameterAnnotations = new ArrayList<String>();
+ private List<String> parameterTypeAnnotations = new ArrayList<String>();
+
+ public String getStringRepresentation() { return stringRep.toString(); }
+ public List<String> getParameterAnnotations() { return parameterAnnotations; }
+ public List<String> getParameterTypeAnnotations() { return parameterTypeAnnotations; }
+
+ public Object visit(AndAnnotationTypePattern node, Object data) {
+ stringRep.append("(");
+ node.getLeft().accept(this, data);
+ stringRep.append(" and ");
+ node.getRight().accept(this, data);
+ stringRep.append(")");
+ return node;
+ }
+ public Object visit(AnyAnnotationTypePattern node, Object data) {
+ stringRep.append("any");
+ return node;
+ }
+ public Object visit(ExactAnnotationTypePattern node, Object data) {
+ stringRep.append("exact["+stringify(node.getResolvedAnnotationType())+":"+(node.isForParameterAnnotationMatch()?"p":"t")+"]");
+ if (node.isForParameterAnnotationMatch()) {
+ parameterAnnotations.add(stringify(node.getResolvedAnnotationType()));
+ } else {
+ parameterTypeAnnotations.add(stringify(node.getResolvedAnnotationType()));
+ }
+ return node;
+ }
+ private String stringify(ResolvedType resolvedAnnotationType) {
+ return "@"+resolvedAnnotationType.getSimpleName();
+ }
+
+ public Object visit(BindingAnnotationTypePattern node, Object data) {
+ stringRep.append("binding");
+
+ return node;
+ }
+ public Object visit(NotAnnotationTypePattern node, Object data) {
+ stringRep.append("not");
+ return node;
+ }
+ public Object visit(OrAnnotationTypePattern node, Object data) {
+ stringRep.append("(");
+ node.getLeft().accept(this, data);
+ stringRep.append(" or ");
+ node.getRight().accept(this, data);
+ stringRep.append(")");
+ return node;
+ }
+ public Object visit(WildAnnotationTypePattern node, Object data) {
+ stringRep.append("wild[");
+ stringRep.append(node.getTypePattern().toString());
+ stringRep.append("]");
+ return node;
+ }
+ public Object visit(AnnotationPatternList node, Object data) {
+ stringRep.append("list");
+
+ return node;
+ }
+
+
+ }
+
+
+
+ public void testAtThis() {
+ PointcutExpression atThis = parser.parsePointcutExpression("@this(org.aspectj.weaver.tools.Java15PointcutExpressionTest.MyAnnotation)");
+ ShadowMatch sMatch1 = atThis.matchesMethodExecution(a);
+ ShadowMatch sMatch2 = atThis.matchesMethodExecution(b);
+ assertTrue("maybe matches A",sMatch1.maybeMatches());
+ assertTrue("maybe matches B",sMatch2.maybeMatches());
+ JoinPointMatch jp1 = sMatch1.matchesJoinPoint(new A(), new A(), new Object[0]);
+ assertFalse("does not match",jp1.matches());
+ JoinPointMatch jp2 = sMatch2.matchesJoinPoint(new B(), new B(), new Object[0]);
+ assertTrue("matches",jp2.matches());
+ }
+
+ public void testAtTarget() {
+ PointcutExpression atTarget = parser.parsePointcutExpression("@target(org.aspectj.weaver.tools.Java15PointcutExpressionTest.MyAnnotation)");
+ ShadowMatch sMatch1 = atTarget.matchesMethodExecution(a);
+ ShadowMatch sMatch2 = atTarget.matchesMethodExecution(b);
+ assertTrue("maybe matches A",sMatch1.maybeMatches());
+ assertTrue("maybe matches B",sMatch2.maybeMatches());
+ JoinPointMatch jp1 = sMatch1.matchesJoinPoint(new A(), new A(), new Object[0]);
+ assertFalse("does not match",jp1.matches());
+ JoinPointMatch jp2 = sMatch2.matchesJoinPoint(new B(), new B(), new Object[0]);
+ assertTrue("matches",jp2.matches());
+ }
+
+ public void testAtThisWithBinding() {
+ PointcutParameter param = parser.createPointcutParameter("a",MyAnnotation.class);
+ B myB = new B();
+ MyAnnotation bAnnotation = B.class.getAnnotation(MyAnnotation.class);
+ PointcutExpression atThis = parser.parsePointcutExpression("@this(a)",A.class,new PointcutParameter[] {param});
+ ShadowMatch sMatch1 = atThis.matchesMethodExecution(a);
+ ShadowMatch sMatch2 = atThis.matchesMethodExecution(b);
+ assertTrue("maybe matches A",sMatch1.maybeMatches());
+ assertTrue("maybe matches B",sMatch2.maybeMatches());
+ JoinPointMatch jp1 = sMatch1.matchesJoinPoint(new A(), new A(), new Object[0]);
+ assertFalse("does not match",jp1.matches());
+ JoinPointMatch jp2 = sMatch2.matchesJoinPoint(myB, myB, new Object[0]);
+ assertTrue("matches",jp2.matches());
+ assertEquals(1,jp2.getParameterBindings().length);
+ assertEquals("should be myB's annotation",bAnnotation,jp2.getParameterBindings()[0].getBinding());
+ }
+
+ public void testAtTargetWithBinding() {
+ PointcutParameter param = parser.createPointcutParameter("a",MyAnnotation.class);
+ B myB = new B();
+ MyAnnotation bAnnotation = B.class.getAnnotation(MyAnnotation.class);
+ PointcutExpression atThis = parser.parsePointcutExpression("@target(a)",A.class,new PointcutParameter[] {param});
+ ShadowMatch sMatch1 = atThis.matchesMethodExecution(a);
+ ShadowMatch sMatch2 = atThis.matchesMethodExecution(b);
+ assertTrue("maybe matches A",sMatch1.maybeMatches());
+ assertTrue("maybe matches B",sMatch2.maybeMatches());
+ JoinPointMatch jp1 = sMatch1.matchesJoinPoint(new A(), new A(), new Object[0]);
+ assertFalse("does not match",jp1.matches());
+ JoinPointMatch jp2 = sMatch2.matchesJoinPoint(myB, myB, new Object[0]);
+ assertTrue("matches",jp2.matches());
+ assertEquals(1,jp2.getParameterBindings().length);
+ assertEquals("should be myB's annotation",bAnnotation,jp2.getParameterBindings()[0].getBinding());
+ }
+
+ public void testAtArgs() {
+ PointcutExpression atArgs = parser.parsePointcutExpression("@args(..,org.aspectj.weaver.tools.Java15PointcutExpressionTest.MyAnnotation)");
+ ShadowMatch sMatch1 = atArgs.matchesMethodExecution(a);
+ ShadowMatch sMatch2 = atArgs.matchesMethodExecution(c);
+ assertTrue("never matches A",sMatch1.neverMatches());
+ assertTrue("maybe matches C",sMatch2.maybeMatches());
+ JoinPointMatch jp2 = sMatch2.matchesJoinPoint(new B(), new B(), new Object[]{new A(),new B()});
+ assertTrue("matches",jp2.matches());
+
+ atArgs = parser.parsePointcutExpression("@args(org.aspectj.weaver.tools.Java15PointcutExpressionTest.MyAnnotation,org.aspectj.weaver.tools.Java15PointcutExpressionTest.MyAnnotation)");
+ sMatch1 = atArgs.matchesMethodExecution(a);
+ sMatch2 = atArgs.matchesMethodExecution(c);
+ assertTrue("never matches A",sMatch1.neverMatches());
+ assertTrue("maybe matches C",sMatch2.maybeMatches());
+ JoinPointMatch jp1 = sMatch2.matchesJoinPoint(new A(), new A(), new Object[] {new A(), new B()});
+ assertFalse("does not match",jp1.matches());
+ jp2 = sMatch2.matchesJoinPoint(new B(), new B(), new Object[] {new B(),new B()});
+ assertTrue("matches",jp2.matches());
+ }
+
+ public void testAtArgs2() {
+ PointcutExpression atArgs = parser.parsePointcutExpression("@args(*, org.aspectj.weaver.tools.Java15PointcutExpressionTest.MyAnnotation)");
+ ShadowMatch sMatch1 = atArgs.matchesMethodExecution(c);
+ ShadowMatch sMatch2 = atArgs.matchesMethodExecution(d);
+ assertTrue("maybe matches c",sMatch1.maybeMatches());
+ assertTrue("maybe matches d",sMatch2.maybeMatches());
+ JoinPointMatch jp1 = sMatch1.matchesJoinPoint(new B(), new B(), new Object[] {new A(), new B()});
+ assertTrue("matches",jp1.matches());
+ JoinPointMatch jp2 = sMatch2.matchesJoinPoint(new B(), new B(), new Object[] {new A(),new A()});
+ assertFalse("does not match",jp2.matches());
+ }
+
+ public void testAtArgsWithBinding() {
+ PointcutParameter p1 = parser.createPointcutParameter("a",MyAnnotation.class);
+ PointcutParameter p2 = parser.createPointcutParameter("b", MyAnnotation.class);
+ PointcutExpression atArgs = parser.parsePointcutExpression("@args(..,a)",A.class,new PointcutParameter[] {p1});
+ ShadowMatch sMatch2 = atArgs.matchesMethodExecution(c);
+ assertTrue("maybe matches C",sMatch2.maybeMatches());
+ JoinPointMatch jp2 = sMatch2.matchesJoinPoint(new B(), new B(), new Object[]{new A(),new B()});
+ assertTrue("matches",jp2.matches());
+ assertEquals(1,jp2.getParameterBindings().length);
+ MyAnnotation bAnnotation = B.class.getAnnotation(MyAnnotation.class);
+ assertEquals("annotation on B",bAnnotation,jp2.getParameterBindings()[0].getBinding());
+
+ atArgs = parser.parsePointcutExpression("@args(a,b)",A.class,new PointcutParameter[] {p1,p2});
+ sMatch2 = atArgs.matchesMethodExecution(c);
+ assertTrue("maybe matches C",sMatch2.maybeMatches());
+ jp2 = sMatch2.matchesJoinPoint(new B(), new B(), new Object[] {new B(),new B()});
+ assertTrue("matches",jp2.matches());
+ assertEquals(2,jp2.getParameterBindings().length);
+ assertEquals("annotation on B",bAnnotation,jp2.getParameterBindings()[0].getBinding());
+ assertEquals("annotation on B",bAnnotation,jp2.getParameterBindings()[1].getBinding());
+ }
+
+ public void testAtWithin() {
+ PointcutExpression atWithin = parser.parsePointcutExpression("@within(org.aspectj.weaver.tools.Java15PointcutExpressionTest.MyAnnotation)");
+ ShadowMatch sMatch1 = atWithin.matchesMethodExecution(a);
+ ShadowMatch sMatch2 = atWithin.matchesMethodExecution(b);
+ assertTrue("does not match a",sMatch1.neverMatches());
+ assertTrue("matches b",sMatch2.alwaysMatches());
+ }
+
+ public void testAtWithinWithBinding() {
+ PointcutParameter p1 = parser.createPointcutParameter("x",MyAnnotation.class);
+ PointcutExpression atWithin = parser.parsePointcutExpression("@within(x)",B.class,new PointcutParameter[] {p1});
+ ShadowMatch sMatch1 = atWithin.matchesMethodExecution(a);
+ ShadowMatch sMatch2 = atWithin.matchesMethodExecution(b);
+ assertTrue("does not match a",sMatch1.neverMatches());
+ assertTrue("matches b",sMatch2.alwaysMatches());
+ JoinPointMatch jpm = sMatch2.matchesJoinPoint(new B(), new B(), new Object[0]);
+ assertTrue(jpm.matches());
+ assertEquals(1,jpm.getParameterBindings().length);
+ MyAnnotation bAnnotation = B.class.getAnnotation(MyAnnotation.class);
+ assertEquals("annotation on B",bAnnotation,jpm.getParameterBindings()[0].getBinding());
+ }
+
+ public void testAtWithinCode() {
+ PointcutExpression atWithinCode = parser.parsePointcutExpression("@withincode(org.aspectj.weaver.tools.Java15PointcutExpressionTest.MyAnnotation)");
+ ShadowMatch sMatch1 = atWithinCode.matchesMethodCall(a,b);
+ ShadowMatch sMatch2 = atWithinCode.matchesMethodCall(a,a);
+ assertTrue("does not match from b",sMatch1.neverMatches());
+ assertTrue("matches from a",sMatch2.alwaysMatches());
+ }
+
+ public void testAtWithinCodeWithBinding() {
+ PointcutParameter p1 = parser.createPointcutParameter("x",MyAnnotation.class);
+ PointcutExpression atWithinCode = parser.parsePointcutExpression("@withincode(x)",A.class,new PointcutParameter[] {p1});
+ ShadowMatch sMatch2 = atWithinCode.matchesMethodCall(a,a);
+ assertTrue("matches from a",sMatch2.alwaysMatches());
+ JoinPointMatch jpm = sMatch2.matchesJoinPoint(new A(), new A(), new Object[0]);
+ assertEquals(1,jpm.getParameterBindings().length);
+ MyAnnotation annOna = a.getAnnotation(MyAnnotation.class);
+ assertEquals("MyAnnotation on a",annOna,jpm.getParameterBindings()[0].getBinding());
+ }
+
+ public void testAtAnnotation() {
+ PointcutExpression atAnnotation = parser.parsePointcutExpression("@annotation(org.aspectj.weaver.tools.Java15PointcutExpressionTest.MyAnnotation)");
+ ShadowMatch sMatch1 = atAnnotation.matchesMethodCall(b,a);
+ ShadowMatch sMatch2 = atAnnotation.matchesMethodCall(a,a);
+ assertTrue("does not match call to b",sMatch1.neverMatches());
+ assertTrue("matches call to a",sMatch2.alwaysMatches());
+ }
+
+ public void testAtAnnotationWithBinding() {
+ PointcutParameter p1 = parser.createPointcutParameter("x",MyAnnotation.class);
+ PointcutExpression atAnnotation = parser.parsePointcutExpression("@annotation(x)",A.class,new PointcutParameter[] {p1});
+ ShadowMatch sMatch2 = atAnnotation.matchesMethodCall(a,a);
+ assertTrue("matches call to a",sMatch2.alwaysMatches());
+ JoinPointMatch jpm = sMatch2.matchesJoinPoint(new A(), new A(), new Object[0]);
+ assertTrue(jpm.matches());
+ assertEquals(1,jpm.getParameterBindings().length);
+ MyAnnotation annOna = a.getAnnotation(MyAnnotation.class);
+ assertEquals("MyAnnotation on a",annOna,jpm.getParameterBindings()[0].getBinding());
+ }
+
+ public void testReferencePointcutNoParams() {
+ PointcutExpression pc = parser.parsePointcutExpression("foo()",C.class,new PointcutParameter[0]);
+ ShadowMatch sMatch1 = pc.matchesMethodCall(a,b);
+ ShadowMatch sMatch2 = pc.matchesMethodExecution(a);
+ assertTrue("no match on call",sMatch1.neverMatches());
+ assertTrue("match on execution",sMatch2.alwaysMatches());
+
+ pc = parser.parsePointcutExpression("org.aspectj.weaver.tools.Java15PointcutExpressionTest.C.foo()");
+ sMatch1 = pc.matchesMethodCall(a,b);
+ sMatch2 = pc.matchesMethodExecution(a);
+ assertTrue("no match on call",sMatch1.neverMatches());
+ assertTrue("match on execution",sMatch2.alwaysMatches());
+ }
+
+ public void testReferencePointcutParams() {
+ PointcutParameter p1 = parser.createPointcutParameter("x",A.class);
+ PointcutExpression pc = parser.parsePointcutExpression("goo(x)",C.class,new PointcutParameter[] {p1});
+
+ ShadowMatch sMatch1 = pc.matchesMethodCall(a,b);
+ ShadowMatch sMatch2 = pc.matchesMethodExecution(a);
+ assertTrue("no match on call",sMatch1.neverMatches());
+ assertTrue("match on execution",sMatch2.maybeMatches());
+ A anA = new A();
+ JoinPointMatch jpm = sMatch2.matchesJoinPoint(anA, new A(), new Object[0]);
+ assertTrue(jpm.matches());
+ assertEquals("should be bound to anA",anA,jpm.getParameterBindings()[0].getBinding());
+
+ }
+
+ public void testExecutionWithClassFileRetentionAnnotation() {
+ PointcutExpression pc1 = parser.parsePointcutExpression("execution(@org.aspectj.weaver.tools.Java15PointcutExpressionTest.MyAnnotation * *(..))");
+ PointcutExpression pc2 = parser.parsePointcutExpression("execution(@org.aspectj.weaver.tools.Java15PointcutExpressionTest.MyClassFileRetentionAnnotation * *(..))");
+ ShadowMatch sMatch = pc1.matchesMethodExecution(a);
+ assertTrue("matches",sMatch.alwaysMatches());
+ sMatch = pc2.matchesMethodExecution(a);
+ assertTrue("no match",sMatch.neverMatches());
+ sMatch = pc1.matchesMethodExecution(b);
+ assertTrue("no match",sMatch.neverMatches());
+ sMatch = pc2.matchesMethodExecution(b);
+ assertTrue("matches",sMatch.alwaysMatches());
+ }
+
+ public void testGenericMethodSignatures() throws Exception{
+ PointcutExpression ex = parser.parsePointcutExpression("execution(* set*(java.util.List<org.aspectj.weaver.tools.Java15PointcutExpressionTest.C>))");
+ Method m = TestBean.class.getMethod("setFriends",List.class);
+ ShadowMatch sm = ex.matchesMethodExecution(m);
+ assertTrue("should match",sm.alwaysMatches());
+ }
+
+ public void testAnnotationInExecution() throws Exception {
+ parser.parsePointcutExpression("execution(@(org.springframework..*) * *(..))");
+ }
+
+ public void testVarArgsMatching() throws Exception {
+ PointcutExpression ex = parser.parsePointcutExpression("execution(* *(String...))");
+ Method usesVarArgs = D.class.getMethod("varArgs",String[].class);
+ Method noVarArgs = D.class.getMethod("nonVarArgs", String[].class);
+ ShadowMatch sm1 = ex.matchesMethodExecution(usesVarArgs);
+ assertTrue("should match",sm1.alwaysMatches());
+ ShadowMatch sm2 = ex.matchesMethodExecution(noVarArgs);
+ assertFalse("should not match",sm2.alwaysMatches());
+ }
+
+ public void testJavaLangMatching() throws Exception {
+ PointcutExpression ex = parser.parsePointcutExpression("@within(java.lang.Deprecated)");
+ Method foo = GoldenOldie.class.getMethod("foo");
+ ShadowMatch sm1 = ex.matchesMethodExecution(foo);
+ assertTrue("should match",sm1.alwaysMatches());
+ }
+
+ public void testReferencePCsInSameType() throws Exception {
+ PointcutExpression ex = parser.parsePointcutExpression("org.aspectj.weaver.tools.Java15PointcutExpressionTest.NamedPointcutResolution.c()",NamedPointcutResolution.class,new PointcutParameter[0]);
+ ShadowMatch sm = ex.matchesMethodExecution(a);
+ assertTrue("should match",sm.alwaysMatches());
+ sm = ex.matchesMethodExecution(b);
+ assertTrue("does not match",sm.neverMatches());
+ }
+
+ public void testReferencePCsInOtherType() throws Exception {
+ PointcutExpression ex = parser.parsePointcutExpression("org.aspectj.weaver.tools.Java15PointcutExpressionTest.ExternalReferrer.d()",ExternalReferrer.class,new PointcutParameter[0]);
+ ShadowMatch sm = ex.matchesMethodExecution(a);
+ assertTrue("should match",sm.alwaysMatches());
+ sm = ex.matchesMethodExecution(b);
+ assertTrue("does not match",sm.neverMatches());
+ }
+
+ public void testArrayTypeInArgs() throws Exception {
+ PointcutParameter[] params = new PointcutParameter[3];
+ params[0] = parser.createPointcutParameter("d", Date.class);
+ params[1] = parser.createPointcutParameter("s", String.class);
+ params[2] = parser.createPointcutParameter("ss", String[].class);
+ parser.parsePointcutExpression("org.aspectj.weaver.tools.Java15PointcutExpressionTest.UsesArrays.pc(d,s,ss)",UsesArrays.class,params);
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ parser = PointcutParser.getPointcutParserSupportingAllPrimitivesAndUsingSpecifiedClassloaderForResolution(this.getClass().getClassLoader());
+ a = A.class.getMethod("a");
+ b = B.class.getMethod("b");
+ c = B.class.getMethod("c",new Class[] {A.class,B.class});
+ d = B.class.getMethod("d",new Class[] {A.class,A.class});
+ }
+
+ @Retention(RetentionPolicy.RUNTIME)
+ private @interface MyAnnotation {}
+
+ private @interface MyClassFileRetentionAnnotation {}
+
+ private static class A {
+ @MyAnnotation public void a() {}
+ }
+
+ @MyAnnotation
+ private static class B {
+ @MyClassFileRetentionAnnotation public void b() {}
+ public void c(A anA, B aB) {}
+
+ public void d(A anA, A anotherA) {}
+ }
+
+ private static class C {
+
+ @Pointcut("execution(* *(..))")
+ public void foo() {}
+
+ @Pointcut(value="execution(* *(..)) && this(x)", argNames="x")
+ public void goo(A x) {}
+ }
+
+ private static class D {
+
+ public void nonVarArgs(String[] strings) {};
+
+ public void varArgs(String... strings) {};
+
+ }
+
+ static class TestBean {
+ public void setFriends(List<C> friends) {}
+ }
+
+ @Deprecated
+ static class GoldenOldie {
+ public void foo() {}
+ }
+
+ private static class NamedPointcutResolution {
+
+ @Pointcut("execution(* *(..))")
+ public void a() {}
+
+ @Pointcut("this(org.aspectj.weaver.tools.Java15PointcutExpressionTest.A)")
+ public void b() {}
+
+ @Pointcut("a() && b()")
+ public void c() {}
+ }
+
+ private static class ExternalReferrer {
+
+ @Pointcut("org.aspectj.weaver.tools.Java15PointcutExpressionTest.NamedPointcutResolution.a() && " +
+ "org.aspectj.weaver.tools.Java15PointcutExpressionTest.NamedPointcutResolution.b())")
+ public void d() {}
+
+ }
+
+ private static class UsesArrays {
+
+ @Pointcut("execution(* *(..)) && args(d,s,ss)")
+ public void pc(Date d, String s, String[] ss) {}
+
+ }
+}
+
+
diff --git a/weaver/testsrc/org/aspectj/weaver/tools/PointcutDesignatorHandlerTests.java b/weaver/src/test/java/org/aspectj/weaver/tools/PointcutDesignatorHandlerTest.java
index 5e7d40d0b..83d7b461d 100644
--- a/weaver/testsrc/org/aspectj/weaver/tools/PointcutDesignatorHandlerTests.java
+++ b/weaver/src/test/java/org/aspectj/weaver/tools/PointcutDesignatorHandlerTest.java
@@ -19,7 +19,7 @@ import org.aspectj.util.LangUtil;
* @author Adrian Colyer
*
*/
-public class PointcutDesignatorHandlerTests extends TestCase {
+public class PointcutDesignatorHandlerTest extends TestCase {
boolean needToSkip = false;
diff --git a/weaver/testsrc/org/aspectj/weaver/tools/PointcutExpressionTest.java b/weaver/src/test/java/org/aspectj/weaver/tools/PointcutExpressionTest.java
index 46189fd32..46189fd32 100644
--- a/weaver/testsrc/org/aspectj/weaver/tools/PointcutExpressionTest.java
+++ b/weaver/src/test/java/org/aspectj/weaver/tools/PointcutExpressionTest.java
diff --git a/weaver/testsrc/org/aspectj/weaver/tools/PointcutParserTest.java b/weaver/src/test/java/org/aspectj/weaver/tools/PointcutParserTest.java
index 4654b049d..4654b049d 100644
--- a/weaver/testsrc/org/aspectj/weaver/tools/PointcutParserTest.java
+++ b/weaver/src/test/java/org/aspectj/weaver/tools/PointcutParserTest.java
diff --git a/weaver/testsrc/org/aspectj/weaver/tools/ReadingAttributes.java b/weaver/src/test/java/org/aspectj/weaver/tools/ReadingAttributesTest.java
index 180331c93..5814aa90f 100644
--- a/weaver/testsrc/org/aspectj/weaver/tools/ReadingAttributes.java
+++ b/weaver/src/test/java/org/aspectj/weaver/tools/ReadingAttributesTest.java
@@ -25,9 +25,11 @@ import org.aspectj.apache.bcel.util.SyntheticRepository;
import org.aspectj.weaver.VersionedDataInputStream;
import org.aspectj.weaver.WeaverStateInfo;
-public class ReadingAttributes extends TestCase {
+public class ReadingAttributesTest extends TestCase {
- public void testWeaverStateInfo() throws ClassNotFoundException, IOException {
+ public void testSkip() {} // Review what to do about these tests
+
+ public void xtestWeaverStateInfo() throws ClassNotFoundException, IOException {
JavaClass jc = getClassFrom(new File("n:/temp"), "com.springsource.petclinic.domain.Visit");
assertNotNull(jc);
diff --git a/weaver/testsrc/org/aspectj/weaver/tools/TypePatternMatcherTest.java b/weaver/src/test/java/org/aspectj/weaver/tools/TypePatternMatcherTest.java
index 523ee4a83..523ee4a83 100644
--- a/weaver/testsrc/org/aspectj/weaver/tools/TypePatternMatcherTest.java
+++ b/weaver/src/test/java/org/aspectj/weaver/tools/TypePatternMatcherTest.java
diff --git a/weaver/testsrc/org/aspectj/weaver/tools/cache/AbstractCacheBackingTestSupport.java b/weaver/src/test/java/org/aspectj/weaver/tools/cache/AbstractCacheBackingTestSupport.java
index d8c1f27b6..5ad69a91d 100644
--- a/weaver/testsrc/org/aspectj/weaver/tools/cache/AbstractCacheBackingTestSupport.java
+++ b/weaver/src/test/java/org/aspectj/weaver/tools/cache/AbstractCacheBackingTestSupport.java
@@ -147,9 +147,9 @@ public abstract class AbstractCacheBackingTestSupport extends TestCase {
}
String name=file.getName();
- if ("bin".equals(name) || "src".equals(name)) {
+ if ("target".equals(name) || "bin".equals(name) || "src".equals(name)) {
File parent=file.getParentFile();
- return new File(parent, "target");
+ return new File(parent, "target2");
}
}
diff --git a/weaver/testsrc/org/aspectj/weaver/tools/cache/AsynchronousFileCacheBackingTestSupport.java b/weaver/src/test/java/org/aspectj/weaver/tools/cache/AsynchronousFileCacheBackingTestSupport.java
index 7d1b66407..7d1b66407 100644
--- a/weaver/testsrc/org/aspectj/weaver/tools/cache/AsynchronousFileCacheBackingTestSupport.java
+++ b/weaver/src/test/java/org/aspectj/weaver/tools/cache/AsynchronousFileCacheBackingTestSupport.java
diff --git a/weaver/testsrc/org/aspectj/weaver/tools/cache/DefaultCacheKeyResolverTest.java b/weaver/src/test/java/org/aspectj/weaver/tools/cache/DefaultCacheKeyResolverTest.java
index 139488b3c..139488b3c 100644
--- a/weaver/testsrc/org/aspectj/weaver/tools/cache/DefaultCacheKeyResolverTest.java
+++ b/weaver/src/test/java/org/aspectj/weaver/tools/cache/DefaultCacheKeyResolverTest.java
diff --git a/weaver/testsrc/org/aspectj/weaver/tools/cache/DefaultFileCacheBackingTest.java b/weaver/src/test/java/org/aspectj/weaver/tools/cache/DefaultFileCacheBackingTest.java
index 2d5ec0c77..2d5ec0c77 100644
--- a/weaver/testsrc/org/aspectj/weaver/tools/cache/DefaultFileCacheBackingTest.java
+++ b/weaver/src/test/java/org/aspectj/weaver/tools/cache/DefaultFileCacheBackingTest.java
diff --git a/weaver/src/test/java/org/aspectj/weaver/tools/cache/FlatFileCacheBackingTest.java b/weaver/src/test/java/org/aspectj/weaver/tools/cache/FlatFileCacheBackingTest.java
new file mode 100644
index 000000000..87daff796
--- /dev/null
+++ b/weaver/src/test/java/org/aspectj/weaver/tools/cache/FlatFileCacheBackingTest.java
@@ -0,0 +1,147 @@
+/*******************************************************************************
+ * Copyright (c) 2012 VMware, Inc.
+ *
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Lyor Goldstein
+ *******************************************************************************/
+
+package org.aspectj.weaver.tools.cache;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.Map;
+import java.util.TreeMap;
+
+import org.aspectj.weaver.tools.cache.AbstractIndexedFileCacheBacking.IndexEntry;
+
+/**
+ * @author Lyor Goldstein
+ */
+public class FlatFileCacheBackingTest extends AsynchronousFileCacheBackingTestSupport {
+ public FlatFileCacheBackingTest() {
+ super();
+ }
+
+ @Override
+ protected FlatFileCacheBacking createFileBacking(File dir) {
+ return new FlatFileCacheBacking(dir);
+ }
+
+ public void testReadIndex() throws IOException {
+ IndexEntry[] entries = { createIgnoredEntry("ignored"), createIndexEntry("weaved", false, false, bytes, bytes),
+ createIndexEntry("generated", true, false, bytes, bytes) };
+ File indexFile = getIndexFile();
+ writeIndex(indexFile, entries);
+ Map<String, File> dataFiles = createDataFiles(entries);
+
+ File cacheDir = getCacheDir();
+ AsynchronousFileCacheBacking cache = createFileBacking(cacheDir);
+ Map<String, IndexEntry> indexMap = cache.getIndexMap();
+ assertEquals("Mismatched index size", entries.length, indexMap.size());
+
+ Map<String, byte[]> bytesMap = cache.getBytesMap();
+ assertEquals("Mismatched bytes size", dataFiles.size() /* the ignored one has no file */, bytesMap.size());
+
+ for (IndexEntry entry : entries) {
+ String key = entry.key;
+ assertNotNull("Missing entry for key=" + key, indexMap.get(key));
+
+ if (entry.ignored) {
+ assertNull("Unexpected bytes for ignored key=" + key, bytesMap.get(key));
+ } else {
+ assertArrayEquals("Mismatched contents for key=" + key, bytes, bytesMap.get(key));
+ }
+ }
+ }
+
+ public void testIgnoredBadCrcDataFiles() throws Exception {
+ IndexEntry[] entries = { createIndexEntry("weaved-goodData", false, false, bytes, bytes),
+ createIndexEntry("badData-weaved", false, false, bytes, bytes),
+ createIndexEntry("generated-goodData", true, false, bytes, bytes),
+ createIndexEntry("badData-generated", true, false, bytes, bytes) };
+ File indexFile = getIndexFile();
+ writeIndex(indexFile, entries);
+
+ Map<String, File> dataFiles = createDataFiles(entries);
+ long newCrc = generateNewBytes();
+ assertTrue("Bad new CRC", newCrc != (-1L));
+
+ Map<String, File> badFiles = new TreeMap<String, File>();
+ for (IndexEntry entry : entries) {
+ String key = entry.key;
+ if (key.startsWith("badData")) {
+ File file = dataFiles.get(key);
+ OutputStream out = new FileOutputStream(file);
+ try {
+ out.write(bytes);
+ } finally {
+ out.close();
+ }
+ dataFiles.remove(key);
+ badFiles.put(key, file);
+ }
+ }
+
+ File cacheDir = getCacheDir();
+ FlatFileCacheBacking cache = createFileBacking(cacheDir);
+ Map<String, IndexEntry> indexMap = cache.getIndexMap();
+ assertEquals("Mismatched index size", dataFiles.size(), indexMap.size());
+
+ Map<String, byte[]> bytesMap = cache.getBytesMap();
+ assertEquals("Mismatched bytes size", dataFiles.size(), bytesMap.size());
+
+ for (Map.Entry<String, File> badEntry : badFiles.entrySet()) {
+ String key = badEntry.getKey();
+ assertFalse("Unexpectedly indexed: " + key, indexMap.containsKey(key));
+ assertFalse("Unexpectedly loaded: " + key, bytesMap.containsKey(key));
+
+ File file = badEntry.getValue();
+ assertFalse("Unexpectedly still readable: " + key, file.canRead());
+ }
+ }
+
+ public void testSkipMissingDataFileOnReadIndex() throws IOException {
+ IndexEntry[] entries = { createIndexEntry("weaved-noData", false, false, null, null),
+ createIndexEntry("withData-weaved", false, false, bytes, bytes),
+ createIndexEntry("generated-noData", true, false, null, null),
+ createIndexEntry("withData-generated", true, false, bytes, bytes) };
+ File indexFile = getIndexFile();
+ writeIndex(indexFile, entries);
+
+ Map<String, File> dataFiles = new TreeMap<String, File>();
+ for (IndexEntry entry : entries) {
+ String key = entry.key;
+ if (key.startsWith("withData")) {
+ dataFiles.put(key, createDataFile(entry, bytes));
+ }
+ }
+
+ File cacheDir = getCacheDir();
+ FlatFileCacheBacking cache = createFileBacking(cacheDir);
+ Map<String, IndexEntry> indexMap = cache.getIndexMap();
+ assertEquals("Mismatched index size", dataFiles.size(), indexMap.size());
+
+ Map<String, byte[]> bytesMap = cache.getBytesMap();
+ assertEquals("Mismatched bytes size", dataFiles.size(), bytesMap.size());
+
+ for (IndexEntry entry : entries) {
+ String key = entry.key;
+ if (key.startsWith("withData")) {
+ assertTrue("Not indexed: " + key, indexMap.containsKey(key));
+ assertTrue("Not loaded: " + key, bytesMap.containsKey(key));
+ } else {
+ assertFalse("Unexpectedly indexed: " + key, indexMap.containsKey(key));
+ assertFalse("Unexpectedly loaded: " + key, bytesMap.containsKey(key));
+ }
+ }
+ }
+
+}
diff --git a/weaver/testsrc/org/aspectj/weaver/tools/cache/SimpleClassCacheTest.java b/weaver/src/test/java/org/aspectj/weaver/tools/cache/SimpleClassCacheTest.java
index 68fac6913..68fac6913 100644
--- a/weaver/testsrc/org/aspectj/weaver/tools/cache/SimpleClassCacheTest.java
+++ b/weaver/src/test/java/org/aspectj/weaver/tools/cache/SimpleClassCacheTest.java
diff --git a/weaver/testsrc/org/aspectj/weaver/tools/cache/WeavedClassCacheTest.java b/weaver/src/test/java/org/aspectj/weaver/tools/cache/WeavedClassCacheTest.java
index a02400eb8..a02400eb8 100644
--- a/weaver/testsrc/org/aspectj/weaver/tools/cache/WeavedClassCacheTest.java
+++ b/weaver/src/test/java/org/aspectj/weaver/tools/cache/WeavedClassCacheTest.java
diff --git a/weaver/testsrc/org/aspectj/weaver/tools/cache/ZippedFileCacheBackingTest.java b/weaver/src/test/java/org/aspectj/weaver/tools/cache/ZippedFileCacheBackingTest.java
index 4c41c1807..4c41c1807 100644
--- a/weaver/testsrc/org/aspectj/weaver/tools/cache/ZippedFileCacheBackingTest.java
+++ b/weaver/src/test/java/org/aspectj/weaver/tools/cache/ZippedFileCacheBackingTest.java
diff --git a/weaver/testsrc/reflect/tests/C.java b/weaver/src/test/java/reflect/tests/C.java
index f52043b5a..f52043b5a 100644
--- a/weaver/testsrc/reflect/tests/C.java
+++ b/weaver/src/test/java/reflect/tests/C.java
diff --git a/weaver/src/test/java/test/A.java b/weaver/src/test/java/test/A.java
new file mode 100644
index 000000000..12959cd51
--- /dev/null
+++ b/weaver/src/test/java/test/A.java
@@ -0,0 +1,27 @@
+/* *******************************************************************
+ * Copyright (c) 2008 Contributors
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors
+ * Andy Clement
+ * ******************************************************************/
+package test;
+
+public class A {
+ public void a(String s) {}
+ public void b(@A1 String s) {}
+ public void c(@A1 @A2 String s) {}
+ public void d(@A1 String s,@A2 String t) {}
+
+ public void e(A1AnnotatedType s) {}
+ public void f(A2AnnotatedType s) {}
+ public void g(@A2 A1AnnotatedType s) {}
+ public void h(@A1 A1AnnotatedType s) {}
+ public void i(A1AnnotatedType s,@A2 String t) {}
+ public void j(@A1 @A2 String s) {}
+
+}
diff --git a/weaver/src/test/java/test/A1.java b/weaver/src/test/java/test/A1.java
new file mode 100644
index 000000000..616708345
--- /dev/null
+++ b/weaver/src/test/java/test/A1.java
@@ -0,0 +1,20 @@
+/* *******************************************************************
+ * Copyright (c) 2008 Contributors
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors
+ * Andy Clement
+ * ******************************************************************/
+package test;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+@Retention(RetentionPolicy.RUNTIME)
+public @interface A1 {
+
+}
diff --git a/weaver/src/test/java/test/A1AnnotatedType.java b/weaver/src/test/java/test/A1AnnotatedType.java
new file mode 100644
index 000000000..e40addbf5
--- /dev/null
+++ b/weaver/src/test/java/test/A1AnnotatedType.java
@@ -0,0 +1,17 @@
+/* *******************************************************************
+ * Copyright (c) 2008 Contributors
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors
+ * Andy Clement
+ * ******************************************************************/
+package test;
+
+@A1
+public class A1AnnotatedType {
+
+}
diff --git a/weaver/src/test/java/test/A2.java b/weaver/src/test/java/test/A2.java
new file mode 100644
index 000000000..48749a3d4
--- /dev/null
+++ b/weaver/src/test/java/test/A2.java
@@ -0,0 +1,20 @@
+/* *******************************************************************
+ * Copyright (c) 2008 Contributors
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors
+ * Andy Clement
+ * ******************************************************************/
+package test;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+@Retention(RetentionPolicy.RUNTIME)
+public @interface A2 {
+
+}
diff --git a/weaver/src/test/java/test/A2AnnotatedType.java b/weaver/src/test/java/test/A2AnnotatedType.java
new file mode 100644
index 000000000..0fa3b5c8a
--- /dev/null
+++ b/weaver/src/test/java/test/A2AnnotatedType.java
@@ -0,0 +1,17 @@
+/* *******************************************************************
+ * Copyright (c) 2008 Contributors
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors
+ * Andy Clement
+ * ******************************************************************/
+package test;
+
+@A2
+public class A2AnnotatedType {
+
+}
diff --git a/weaver/src/test/java/test/A3.java b/weaver/src/test/java/test/A3.java
new file mode 100644
index 000000000..ab54388ae
--- /dev/null
+++ b/weaver/src/test/java/test/A3.java
@@ -0,0 +1,19 @@
+/* *******************************************************************
+ * Copyright (c) 2008 Contributors
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors
+ * Andy Clement
+ * ******************************************************************/
+package test;
+
+import java.lang.annotation.*;
+
+@Retention(RetentionPolicy.RUNTIME)
+public @interface A3 {
+ Color value() default Color.RED;
+}
diff --git a/weaver/src/test/java/test/AnnoValues.java b/weaver/src/test/java/test/AnnoValues.java
new file mode 100644
index 000000000..08301d1a0
--- /dev/null
+++ b/weaver/src/test/java/test/AnnoValues.java
@@ -0,0 +1,20 @@
+/* *******************************************************************
+ * Copyright (c) 2008 Contributors
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors
+ * Andy Clement
+ * ******************************************************************/
+package test;
+
+public class AnnoValues {
+ public void none() {}
+ @A3 public void defaultMethod() {}
+ @A3(Color.GREEN) public void greenMethod() {}
+ @A3(Color.RED) public void redMethod() {}
+ @A3(Color.BLUE) public void blueMethod() {}
+}
diff --git a/weaver/src/test/java/test/Color.java b/weaver/src/test/java/test/Color.java
new file mode 100644
index 000000000..dea2593ac
--- /dev/null
+++ b/weaver/src/test/java/test/Color.java
@@ -0,0 +1,14 @@
+package test;
+/* *******************************************************************
+ * Copyright (c) 2008 Contributors
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors
+ * Andy Clement
+ * ******************************************************************/
+
+public enum Color { RED, GREEN, BLUE } \ No newline at end of file
diff --git a/weaver/testdata/logging.properties b/weaver/testdata/logging.properties
new file mode 100644
index 000000000..b65bfeaa5
--- /dev/null
+++ b/weaver/testdata/logging.properties
@@ -0,0 +1,60 @@
+############################################################
+# Default Logging Configuration File
+#
+# You can use a different file by specifying a filename
+# with the java.util.logging.config.file system property.
+# For example java -Djava.util.logging.config.file=myfile
+############################################################
+
+############################################################
+# Global properties
+############################################################
+
+# "handlers" specifies a comma separated list of log Handler
+# classes. These handlers will be installed during VM startup.
+# Note that these classes must be on the system classpath.
+# By default we only configure a ConsoleHandler, which will only
+# show messages at the INFO and above levels.
+#handlers= java.util.logging.ConsoleHandler
+
+# To also add the FileHandler, use the following line instead.
+#handlers= java.util.logging.FileHandler, java.util.logging.ConsoleHandler
+handlers= java.util.logging.FileHandler
+
+# Default global logging level.
+# This specifies which kinds of events are logged across
+# all loggers. For any given facility this global level
+# can be overriden by a facility specific level
+# Note that the ConsoleHandler also has a separate level
+# setting to limit messages printed to the console.
+.level= INFO
+
+############################################################
+# Handler specific properties.
+# Describes specific configuration info for Handlers.
+############################################################
+
+# default file output is in user's home directory.
+java.util.logging.FileHandler.pattern = %h/java%u.log
+#java.util.logging.FileHandler.limit = 50000
+java.util.logging.FileHandler.count = 1
+#java.util.logging.FileHandler.formatter = java.util.logging.XMLFormatter
+java.util.logging.FileHandler.formatter = java.util.logging.SimpleFormatter
+java.util.logging.FileHandler.level = FINER
+
+# Limit the message that are printed on the console to INFO and above.
+java.util.logging.ConsoleHandler.level = FINER
+java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter
+
+
+############################################################
+# Facility specific properties.
+# Provides extra control for each logger.
+############################################################
+
+# For example, set the com.xyz.foo logger to only log SEVERE
+# messages:
+#com.xyz.foo.level = SEVERE
+org.aspectj.weaver.level = FINER
+org.aspectj.weaver.loadtime.level = FINER
+org.aspectj.weaver.weaver.level = FINER
diff --git a/weaver/testsrc/org/aspectj/weaver/BcweaverModuleTests.java b/weaver/testsrc/org/aspectj/weaver/BcweaverModuleTests.java
deleted file mode 100644
index b0e019bbc..000000000
--- a/weaver/testsrc/org/aspectj/weaver/BcweaverModuleTests.java
+++ /dev/null
@@ -1,41 +0,0 @@
-package org.aspectj.weaver;
-
-/* *******************************************************************
- * Copyright (c) 2002 Palo Alto Research Center, Incorporated (PARC).
- * All rights reserved.
- * This program and the accompanying materials are made available
- * under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * PARC initial implementation
- * ******************************************************************/
-
-// default package
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
-import org.aspectj.weaver.tools.ToolsTests;
-import org.aspectj.weaver.tools.cache.CacheTests;
-
-public class BcweaverModuleTests extends TestCase {
-
- public static Test suite() {
- TestSuite suite = new TestSuite(BcweaverModuleTests.class.getName());
- suite.addTest(org.aspectj.weaver.bcel.BcelTests.suite());
- suite.addTest(org.aspectj.weaver.BcweaverTests.suite());
- suite.addTest(org.aspectj.weaver.patterns.bcel.BcelPatternsTests.suite());
- suite.addTestSuite(LocaleTest.class);
- suite.addTestSuite(GenericSignatureParserTest.class);
- suite.addTest(ToolsTests.suite());
- suite.addTest(CacheTests.suite());
- return suite;
- }
-
- public BcweaverModuleTests(String name) {
- super(name);
- }
-
-}
diff --git a/weaver/testsrc/org/aspectj/weaver/bcel/BcelTests.java b/weaver/testsrc/org/aspectj/weaver/bcel/BcelTests.java
deleted file mode 100644
index 77f066083..000000000
--- a/weaver/testsrc/org/aspectj/weaver/bcel/BcelTests.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/* *******************************************************************
- * Copyright (c) 2002 Palo Alto Research Center, Incorporated (PARC).
- * All rights reserved.
- * This program and the accompanying materials are made available
- * under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * PARC initial implementation
- * ******************************************************************/
-
-
-package org.aspectj.weaver.bcel;
-
-import org.aspectj.util.LangUtil;
-
-import junit.framework.*;
-
-public class BcelTests extends TestCase {
-
- public static Test suite() {
- TestSuite suite = new TestSuite(BcelTests.class.getName());
- // abstract
- //suite.addTestSuite(WeaveTestCase.class);
- //$JUnit-BEGIN$
- suite.addTestSuite(AfterReturningWeaveTestCase.class);
- suite.addTestSuite(AfterThrowingWeaveTestCase.class);
- suite.addTestSuite(AfterWeaveTestCase.class);
- suite.addTestSuite(ArgsWeaveTestCase.class);
- suite.addTestSuite(AroundArgsWeaveTestCase.class);
- suite.addTestSuite(AroundWeaveTestCase.class);
- suite.addTestSuite(BeforeWeaveTestCase.class);
- suite.addTestSuite(CheckerTestCase.class);
- suite.addTestSuite(FieldSetTestCase.class);
- suite.addTestSuite(HierarchyDependsTestCase.class);
- suite.addTestSuite(IdWeaveTestCase.class);
- suite.addTestSuite(MoveInstructionsWeaveTestCase.class);
- suite.addTestSuite(NonstaticWeaveTestCase.class);
- suite.addTestSuite(PatternWeaveTestCase.class);
- suite.addTestSuite(PointcutResidueTestCase.class);
- suite.addTestSuite(TraceJarWeaveTestCase.class);
- suite.addTestSuite(TjpWeaveTestCase.class);
- suite.addTestSuite(UtilityTestCase.class);
- suite.addTestSuite(WeaveOrderTestCase.class);
- suite.addTestSuite(WorldTestCase.class);
- suite.addTestSuite(ZipTestCase.class);
- if (LangUtil.is19VMOrGreater()) {
- suite.addTestSuite(JImageTestCase.class);
- }
- //$JUnit-END$
- return suite;
- }
-
- public BcelTests(String name) { super(name); }
-
-}
diff --git a/weaver/testsrc/org/aspectj/weaver/patterns/bcel/BcelPatternsTests.java b/weaver/testsrc/org/aspectj/weaver/patterns/bcel/BcelPatternsTests.java
deleted file mode 100644
index 877810a1a..000000000
--- a/weaver/testsrc/org/aspectj/weaver/patterns/bcel/BcelPatternsTests.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/* *******************************************************************
- * Copyright (c) 2002 Palo Alto Research Center, Incorporated (PARC).
- * All rights reserved.
- * This program and the accompanying materials are made available
- * under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * PARC initial implementation
- * ******************************************************************/
-
-package org.aspectj.weaver.patterns.bcel;
-
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
-import org.aspectj.weaver.patterns.AnnotationPatternMatchingTestCase;
-import org.aspectj.weaver.patterns.AnnotationPatternTestCase;
-
-public class BcelPatternsTests extends TestCase {
-
- public static Test suite() {
- TestSuite suite = new TestSuite(BcelPatternsTests.class.getName());
- // $JUnit-BEGIN$
- suite.addTestSuite(BcelAndOrNotTestCase.class);
- suite.addTestSuite(BcelBindingTestCase.class);
- suite.addTestSuite(BcelWithinTestCase.class);
- suite.addTestSuite(BcelModifiersPatternTestCase.class);
- suite.addTestSuite(BcelTypePatternListTestCase.class);
- suite.addTestSuite(BcelParserTestCase.class);
- suite.addTestSuite(BcelSignaturePatternTestCase.class);
- suite.addTestSuite(BcelTypePatternTestCase.class);
-
- suite.addTestSuite(AnnotationPatternTestCase.class);
- suite.addTestSuite(AnnotationPatternMatchingTestCase.class);
- // $JUnit-END$
- return suite;
- }
-
- public BcelPatternsTests(String name) {
- super(name);
- }
-
-}
diff --git a/weaver/testsrc/org/aspectj/weaver/tools/ToolsTests.java b/weaver/testsrc/org/aspectj/weaver/tools/ToolsTests.java
deleted file mode 100644
index 636fd7a1f..000000000
--- a/weaver/testsrc/org/aspectj/weaver/tools/ToolsTests.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/* *******************************************************************
- * Copyright (c) 2004 IBM Corporation.
- * All rights reserved.
- * This program and the accompanying materials are made available
- * under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * ******************************************************************/
-package org.aspectj.weaver.tools;
-
-import org.aspectj.testing.util.TestUtil;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-public class ToolsTests {
-
- public static Test suite() {
- TestSuite suite = new TestSuite(ToolsTests.class.getName());
- //$JUnit-BEGIN$
- /* FIXME maw The CLASSPATH is wrong so run them in weaver5 instead */
- if (!TestUtil.is15VMOrGreater()) {
- suite.addTestSuite(PointcutExpressionTest.class);
- } else {
- suite.addTest(TestUtil.testNamed("run from weaver5 under 1.5"));
- }
- suite.addTestSuite(PointcutParserTest.class);
- suite.addTestSuite(TypePatternMatcherTest.class);
- suite.addTestSuite(PointcutDesignatorHandlerTests.class);
- //$JUnit-END$
- return suite;
- }
-}
diff --git a/weaver/testsrc/org/aspectj/weaver/tools/cache/CacheTests.java b/weaver/testsrc/org/aspectj/weaver/tools/cache/CacheTests.java
deleted file mode 100644
index b59665b4e..000000000
--- a/weaver/testsrc/org/aspectj/weaver/tools/cache/CacheTests.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 Contributors.
- * All rights reserved.
- * This program and the accompanying materials are made available
- * under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution and is available at
- * http://eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * John Kew (vmware) initial implementation
- *******************************************************************************/
-
-package org.aspectj.weaver.tools.cache;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-/**
- */
-public class CacheTests {
- public static Test suite() {
- TestSuite suite = new TestSuite(CacheTests.class.getName());
- suite.addTestSuite(SimpleClassCacheTest.class);
- suite.addTestSuite(WeavedClassCacheTest.class);
- suite.addTestSuite(DefaultCacheKeyResolverTest.class);
- suite.addTestSuite(DefaultFileCacheBackingTest.class);
- suite.addTestSuite(FlatFileCacheBackingTest.class);
- suite.addTestSuite(ZippedFileCacheBackingTest.class);
- return suite;
- }
-}
diff --git a/weaver/testsrc/org/aspectj/weaver/tools/cache/FlatFileCacheBackingTest.java b/weaver/testsrc/org/aspectj/weaver/tools/cache/FlatFileCacheBackingTest.java
deleted file mode 100644
index 8c6df7ad8..000000000
--- a/weaver/testsrc/org/aspectj/weaver/tools/cache/FlatFileCacheBackingTest.java
+++ /dev/null
@@ -1,154 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 VMware, Inc.
- *
- * All rights reserved.
- * This program and the accompanying materials are made available
- * under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Lyor Goldstein
- *******************************************************************************/
-
-package org.aspectj.weaver.tools.cache;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.util.Map;
-import java.util.TreeMap;
-
-import org.aspectj.weaver.tools.cache.AbstractIndexedFileCacheBacking.IndexEntry;
-
-/**
- * @author Lyor Goldstein
- */
-public class FlatFileCacheBackingTest extends AsynchronousFileCacheBackingTestSupport {
- public FlatFileCacheBackingTest() {
- super();
- }
-
- @Override
- protected FlatFileCacheBacking createFileBacking(File dir) {
- return new FlatFileCacheBacking(dir);
- }
-
- public void testReadIndex () throws IOException {
- IndexEntry[] entries={
- createIgnoredEntry("ignored"),
- createIndexEntry("weaved", false, false, bytes, bytes),
- createIndexEntry("generated", true, false, bytes, bytes)
- };
- File indexFile=getIndexFile();
- writeIndex(indexFile, entries);
- Map<String, File> dataFiles=createDataFiles(entries);
-
- File cacheDir=getCacheDir();
- AsynchronousFileCacheBacking cache=createFileBacking(cacheDir);
- Map<String, IndexEntry> indexMap=cache.getIndexMap();
- assertEquals("Mismatched index size", entries.length, indexMap.size());
-
- Map<String, byte[]> bytesMap=cache.getBytesMap();
- assertEquals("Mismatched bytes size", dataFiles.size() /* the ignored one has no file */, bytesMap.size());
-
- for (IndexEntry entry : entries) {
- String key=entry.key;
- assertNotNull("Missing entry for key=" + key, indexMap.get(key));
-
- if (entry.ignored) {
- assertNull("Unexpected bytes for ignored key=" + key, bytesMap.get(key));
- } else {
- assertArrayEquals("Mismatched contents for key=" + key, bytes, bytesMap.get(key));
- }
- }
- }
-
- public void testIgnoredBadCrcDataFiles () throws Exception {
- IndexEntry[] entries={
- createIndexEntry("weaved-goodData", false, false, bytes, bytes),
- createIndexEntry("badData-weaved", false, false, bytes, bytes),
- createIndexEntry("generated-goodData", true, false, bytes, bytes),
- createIndexEntry("badData-generated", true, false, bytes, bytes)
- };
- File indexFile=getIndexFile();
- writeIndex(indexFile, entries);
-
- Map<String,File> dataFiles=createDataFiles(entries);
- long newCrc=generateNewBytes();
- assertTrue("Bad new CRC", newCrc != (-1L));
-
- Map<String,File> badFiles=new TreeMap<String, File>();
- for (IndexEntry entry : entries) {
- String key=entry.key;
- if (key.startsWith("badData")) {
- File file=dataFiles.get(key);
- OutputStream out=new FileOutputStream(file);
- try {
- out.write(bytes);
- } finally {
- out.close();
- }
- dataFiles.remove(key);
- badFiles.put(key, file);
- }
- }
-
- File cacheDir=getCacheDir();
- FlatFileCacheBacking cache=createFileBacking(cacheDir);
- Map<String, IndexEntry> indexMap=cache.getIndexMap();
- assertEquals("Mismatched index size", dataFiles.size(), indexMap.size());
-
- Map<String, byte[]> bytesMap=cache.getBytesMap();
- assertEquals("Mismatched bytes size", dataFiles.size(), bytesMap.size());
-
- for (Map.Entry<String,File> badEntry : badFiles.entrySet()) {
- String key=badEntry.getKey();
- assertFalse("Unexpectedly indexed: " + key, indexMap.containsKey(key));
- assertFalse("Unexpectedly loaded: " + key, bytesMap.containsKey(key));
-
- File file=badEntry.getValue();
- assertFalse("Unexpectedly still readable: " + key, file.canRead());
- }
- }
-
- public void testSkipMissingDataFileOnReadIndex () throws IOException {
- IndexEntry[] entries={
- createIndexEntry("weaved-noData", false, false, null, null),
- createIndexEntry("withData-weaved", false, false, bytes, bytes),
- createIndexEntry("generated-noData", true, false, null, null),
- createIndexEntry("withData-generated", true, false, bytes, bytes)
- };
- File indexFile=getIndexFile();
- writeIndex(indexFile, entries);
-
- Map<String,File> dataFiles=new TreeMap<String, File>();
- for (IndexEntry entry : entries) {
- String key=entry.key;
- if (key.startsWith("withData")) {
- dataFiles.put(key, createDataFile(entry, bytes));
- }
- }
-
- File cacheDir=getCacheDir();
- FlatFileCacheBacking cache=createFileBacking(cacheDir);
- Map<String, IndexEntry> indexMap=cache.getIndexMap();
- assertEquals("Mismatched index size", dataFiles.size(), indexMap.size());
-
- Map<String, byte[]> bytesMap=cache.getBytesMap();
- assertEquals("Mismatched bytes size", dataFiles.size(), bytesMap.size());
-
- for (IndexEntry entry : entries) {
- String key=entry.key;
- if (key.startsWith("withData")) {
- assertTrue("Not indexed: " + key, indexMap.containsKey(key));
- assertTrue("Not loaded: " + key, bytesMap.containsKey(key));
- } else {
- assertFalse("Unexpectedly indexed: " + key, indexMap.containsKey(key));
- assertFalse("Unexpectedly loaded: " + key, bytesMap.containsKey(key));
- }
- }
- }
-
-}