aboutsummaryrefslogtreecommitdiffstats
path: root/weaver5
diff options
context:
space:
mode:
authorAndy Clement <aclement@pivotal.io>2019-02-08 15:02:11 -0800
committerAndy Clement <aclement@pivotal.io>2019-02-08 15:02:11 -0800
commit635f0ed47ffe11e93d96e4d24e4411eedfa1ddc9 (patch)
tree2fa95e5cf13bdefa559ce341761f90de747421e9 /weaver5
parent66f6e011d251d84250c562950f491cab31af0ad3 (diff)
downloadaspectj-635f0ed47ffe11e93d96e4d24e4411eedfa1ddc9.tar.gz
aspectj-635f0ed47ffe11e93d96e4d24e4411eedfa1ddc9.zip
tidyup retired modules and add aspectjtools submodule
Diffstat (limited to 'weaver5')
-rw-r--r--weaver5/.classpath17
-rw-r--r--weaver5/.cvsignore6
-rw-r--r--weaver5/.project17
-rw-r--r--weaver5/.settings/org.eclipse.jdt.core.prefs61
-rw-r--r--weaver5/.settings/org.eclipse.jdt.ui.prefs3
-rw-r--r--weaver5/build.xml6
-rw-r--r--weaver5/java5-src/org/aspectj/weaver/reflect/ArgNameFinder.java26
-rw-r--r--weaver5/java5-src/org/aspectj/weaver/reflect/DeferredResolvedPointcutDefinition.java35
-rw-r--r--weaver5/java5-src/org/aspectj/weaver/reflect/InternalUseOnlyPointcutParser.java43
-rw-r--r--weaver5/java5-src/org/aspectj/weaver/reflect/Java15AnnotationFinder.java386
-rw-r--r--weaver5/java5-src/org/aspectj/weaver/reflect/Java15GenericSignatureInformationProvider.java103
-rw-r--r--weaver5/java5-src/org/aspectj/weaver/reflect/Java15ReflectionBasedReferenceTypeDelegate.java389
-rw-r--r--weaver5/java5-src/org/aspectj/weaver/reflect/JavaLangTypeToResolvedTypeConverter.java134
-rw-r--r--weaver5/java5-src/org/aspectj/weaver/tools/Jdk14Trace.java127
-rw-r--r--weaver5/java5-src/org/aspectj/weaver/tools/Jdk14TraceFactory.java20
-rw-r--r--weaver5/java5-testsrc/$Proxy1.java28
-rw-r--r--weaver5/java5-testsrc/CounterAspect.java52
-rw-r--r--weaver5/java5-testsrc/GenericService.java17
-rw-r--r--weaver5/java5-testsrc/MA.java15
-rw-r--r--weaver5/java5-testsrc/MB.java15
-rw-r--r--weaver5/java5-testsrc/MC.java15
-rw-r--r--weaver5/java5-testsrc/MD.java15
-rw-r--r--weaver5/java5-testsrc/MessageService.java13
-rw-r--r--weaver5/java5-testsrc/org/aspectj/matcher/tools/ReflectionWorldAdvancedPointcutExpressionTests.java30
-rw-r--r--weaver5/java5-testsrc/org/aspectj/weaver/AllTracing5Tests.java27
-rw-r--r--weaver5/java5-testsrc/org/aspectj/weaver/AllWeaver5Tests.java40
-rw-r--r--weaver5/java5-testsrc/org/aspectj/weaver/BcweaverModuleTests15.java41
-rw-r--r--weaver5/java5-testsrc/org/aspectj/weaver/BoundedReferenceTypeTestCase.java106
-rw-r--r--weaver5/java5-testsrc/org/aspectj/weaver/CommonReferenceTypeTests.java91
-rw-r--r--weaver5/java5-testsrc/org/aspectj/weaver/Jdk14TraceFactoryTest.java30
-rw-r--r--weaver5/java5-testsrc/org/aspectj/weaver/Jdk14TraceTest.java34
-rw-r--r--weaver5/java5-testsrc/org/aspectj/weaver/JoinPointSignatureIteratorTests.java107
-rw-r--r--weaver5/java5-testsrc/org/aspectj/weaver/MemberTestCase15.java155
-rw-r--r--weaver5/java5-testsrc/org/aspectj/weaver/ReferenceTypeTestCase.java854
-rw-r--r--weaver5/java5-testsrc/org/aspectj/weaver/TestJava5ReflectionBasedReferenceTypeDelegate.java154
-rw-r--r--weaver5/java5-testsrc/org/aspectj/weaver/TypeVariableReferenceTypeTestCase.java81
-rw-r--r--weaver5/java5-testsrc/org/aspectj/weaver/TypeVariableTestCase.java110
-rw-r--r--weaver5/java5-testsrc/org/aspectj/weaver/bcel/BcelGenericSignatureToTypeXTestCase.java68
-rw-r--r--weaver5/java5-testsrc/org/aspectj/weaver/bcel/BcelWorldReferenceTypeTest.java23
-rw-r--r--weaver5/java5-testsrc/org/aspectj/weaver/patterns/WildTypePatternResolutionTestCase.java422
-rw-r--r--weaver5/java5-testsrc/org/aspectj/weaver/reflect/ReflectionBasedReferenceTypeDelegateTest.java316
-rw-r--r--weaver5/java5-testsrc/org/aspectj/weaver/reflect/ReflectionWorldReferenceTypeTest.java27
-rw-r--r--weaver5/java5-testsrc/org/aspectj/weaver/reflect/ReflectionWorldTest.java290
-rw-r--r--weaver5/java5-testsrc/org/aspectj/weaver/tools/Java15PointcutExpressionTest.java746
-rw-r--r--weaver5/java5-testsrc/test/A.java27
-rw-r--r--weaver5/java5-testsrc/test/A1.java20
-rw-r--r--weaver5/java5-testsrc/test/A1AnnotatedType.java17
-rw-r--r--weaver5/java5-testsrc/test/A2.java20
-rw-r--r--weaver5/java5-testsrc/test/A2AnnotatedType.java17
-rw-r--r--weaver5/java5-testsrc/test/A3.java19
-rw-r--r--weaver5/java5-testsrc/test/AnnoValues.java20
-rw-r--r--weaver5/java5-testsrc/test/Color.java14
-rw-r--r--weaver5/testdata/logging.properties60
-rw-r--r--weaver5/testsrc/org/aspectj/weaver/Weaver5ModuleTests.java37
54 files changed, 0 insertions, 5546 deletions
diff --git a/weaver5/.classpath b/weaver5/.classpath
deleted file mode 100644
index c54a89cea..000000000
--- a/weaver5/.classpath
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path="java5-src"/>
- <classpathentry kind="src" path="testsrc"/>
- <classpathentry kind="src" path="java5-testsrc"/>
- <classpathentry kind="lib" path="/lib/bcel/bcel.jar" sourcepath="/lib/bcel/bcel-src.zip"/>
- <classpathentry combineaccessrules="false" kind="src" path="/weaver"/>
- <classpathentry combineaccessrules="false" kind="src" path="/bridge"/>
- <classpathentry combineaccessrules="false" kind="src" path="/runtime"/>
- <classpathentry combineaccessrules="false" kind="src" path="/testing-util"/>
- <classpathentry combineaccessrules="false" kind="src" path="/util"/>
- <classpathentry combineaccessrules="false" kind="src" path="/aspectj5rt"/>
- <classpathentry kind="lib" path="/lib/junit/junit.jar" sourcepath="/lib/junit/junit-src.jar"/>
- <classpathentry kind="var" path="JRE15_LIB" sourcepath="/JRE15_SRC"/>
- <classpathentry combineaccessrules="false" kind="src" path="/org.aspectj.matcher"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
diff --git a/weaver5/.cvsignore b/weaver5/.cvsignore
deleted file mode 100644
index e1b17a04f..000000000
--- a/weaver5/.cvsignore
+++ /dev/null
@@ -1,6 +0,0 @@
-out
-bin
-default.lst
-default.ajsym
-.clover
-bintest
diff --git a/weaver5/.project b/weaver5/.project
deleted file mode 100644
index 3f4e4f364..000000000
--- a/weaver5/.project
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>weaver5</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.jdt.core.javanature</nature>
- </natures>
-</projectDescription>
diff --git a/weaver5/.settings/org.eclipse.jdt.core.prefs b/weaver5/.settings/org.eclipse.jdt.core.prefs
deleted file mode 100644
index 1099c7bdc..000000000
--- a/weaver5/.settings/org.eclipse.jdt.core.prefs
+++ /dev/null
@@ -1,61 +0,0 @@
-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.annotationSuperInterface=warning
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
-org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
-org.eclipse.jdt.core.compiler.problem.deprecation=ignore
-org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
-org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
-org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
-org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
-org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
-org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
-org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
-org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
-org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
-org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
-org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore
-org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore
-org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
-org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
-org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
-org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
-org.eclipse.jdt.core.compiler.problem.missingSerialVersion=ignore
-org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
-org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
-org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
-org.eclipse.jdt.core.compiler.problem.nullReference=ignore
-org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
-org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
-org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore
-org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore
-org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
-org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
-org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
-org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
-org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
-org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=ignore
-org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
-org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
-org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
-org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore
-org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
-org.eclipse.jdt.core.compiler.problem.unusedImport=warning
-org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
-org.eclipse.jdt.core.compiler.problem.unusedLocal=ignore
-org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
-org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
-org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
-org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=ignore
-org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=ignore
-org.eclipse.jdt.core.compiler.source=1.7
diff --git a/weaver5/.settings/org.eclipse.jdt.ui.prefs b/weaver5/.settings/org.eclipse.jdt.ui.prefs
deleted file mode 100644
index 60c05a46a..000000000
--- a/weaver5/.settings/org.eclipse.jdt.ui.prefs
+++ /dev/null
@@ -1,3 +0,0 @@
-#Mon Sep 26 14:56:47 BST 2005
-eclipse.preferences.version=1
-internal.default.compliance=default
diff --git a/weaver5/build.xml b/weaver5/build.xml
deleted file mode 100644
index 5fc6b3443..000000000
--- a/weaver5/build.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-<?xml version="1.0"?>
-<!-- see ../build/*.html for explanation -->
-<project name="weaver5" default="test" basedir=".">
- <import file="${basedir}/../build/build.xml"/>
-</project>
-
diff --git a/weaver5/java5-src/org/aspectj/weaver/reflect/ArgNameFinder.java b/weaver5/java5-src/org/aspectj/weaver/reflect/ArgNameFinder.java
deleted file mode 100644
index 25945a90a..000000000
--- a/weaver5/java5-src/org/aspectj/weaver/reflect/ArgNameFinder.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/* *******************************************************************
- * 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/weaver5/java5-src/org/aspectj/weaver/reflect/DeferredResolvedPointcutDefinition.java b/weaver5/java5-src/org/aspectj/weaver/reflect/DeferredResolvedPointcutDefinition.java
deleted file mode 100644
index b0af93f16..000000000
--- a/weaver5/java5-src/org/aspectj/weaver/reflect/DeferredResolvedPointcutDefinition.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/* *******************************************************************
- * 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/weaver5/java5-src/org/aspectj/weaver/reflect/InternalUseOnlyPointcutParser.java b/weaver5/java5-src/org/aspectj/weaver/reflect/InternalUseOnlyPointcutParser.java
deleted file mode 100644
index 8d81d7b08..000000000
--- a/weaver5/java5-src/org/aspectj/weaver/reflect/InternalUseOnlyPointcutParser.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/* *******************************************************************
- * 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/weaver5/java5-src/org/aspectj/weaver/reflect/Java15AnnotationFinder.java b/weaver5/java5-src/org/aspectj/weaver/reflect/Java15AnnotationFinder.java
deleted file mode 100644
index 016becf87..000000000
--- a/weaver5/java5-src/org/aspectj/weaver/reflect/Java15AnnotationFinder.java
+++ /dev/null
@@ -1,386 +0,0 @@
-/* *******************************************************************
- * 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/weaver5/java5-src/org/aspectj/weaver/reflect/Java15GenericSignatureInformationProvider.java b/weaver5/java5-src/org/aspectj/weaver/reflect/Java15GenericSignatureInformationProvider.java
deleted file mode 100644
index c9de9517e..000000000
--- a/weaver5/java5-src/org/aspectj/weaver/reflect/Java15GenericSignatureInformationProvider.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/* *******************************************************************
- * 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/weaver5/java5-src/org/aspectj/weaver/reflect/Java15ReflectionBasedReferenceTypeDelegate.java b/weaver5/java5-src/org/aspectj/weaver/reflect/Java15ReflectionBasedReferenceTypeDelegate.java
deleted file mode 100644
index 6b65ed31e..000000000
--- a/weaver5/java5-src/org/aspectj/weaver/reflect/Java15ReflectionBasedReferenceTypeDelegate.java
+++ /dev/null
@@ -1,389 +0,0 @@
-/* *******************************************************************
- * 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/weaver5/java5-src/org/aspectj/weaver/reflect/JavaLangTypeToResolvedTypeConverter.java b/weaver5/java5-src/org/aspectj/weaver/reflect/JavaLangTypeToResolvedTypeConverter.java
deleted file mode 100644
index 30983e38f..000000000
--- a/weaver5/java5-src/org/aspectj/weaver/reflect/JavaLangTypeToResolvedTypeConverter.java
+++ /dev/null
@@ -1,134 +0,0 @@
-/* *******************************************************************
- * 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/weaver5/java5-src/org/aspectj/weaver/tools/Jdk14Trace.java b/weaver5/java5-src/org/aspectj/weaver/tools/Jdk14Trace.java
deleted file mode 100644
index 061b0b0a0..000000000
--- a/weaver5/java5-src/org/aspectj/weaver/tools/Jdk14Trace.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/*******************************************************************************
- * 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/weaver5/java5-src/org/aspectj/weaver/tools/Jdk14TraceFactory.java b/weaver5/java5-src/org/aspectj/weaver/tools/Jdk14TraceFactory.java
deleted file mode 100644
index 4043d1d33..000000000
--- a/weaver5/java5-src/org/aspectj/weaver/tools/Jdk14TraceFactory.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/*******************************************************************************
- * 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/weaver5/java5-testsrc/$Proxy1.java b/weaver5/java5-testsrc/$Proxy1.java
deleted file mode 100644
index 51cae8b05..000000000
--- a/weaver5/java5-testsrc/$Proxy1.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*******************************************************************************
- * 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/weaver5/java5-testsrc/CounterAspect.java b/weaver5/java5-testsrc/CounterAspect.java
deleted file mode 100644
index 1ca126d02..000000000
--- a/weaver5/java5-testsrc/CounterAspect.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/* *******************************************************************
- * 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/weaver5/java5-testsrc/GenericService.java b/weaver5/java5-testsrc/GenericService.java
deleted file mode 100644
index 87f5c0419..000000000
--- a/weaver5/java5-testsrc/GenericService.java
+++ /dev/null
@@ -1,17 +0,0 @@
-/*******************************************************************************
- * 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/weaver5/java5-testsrc/MA.java b/weaver5/java5-testsrc/MA.java
deleted file mode 100644
index 270882586..000000000
--- a/weaver5/java5-testsrc/MA.java
+++ /dev/null
@@ -1,15 +0,0 @@
-/* *******************************************************************
- * 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/weaver5/java5-testsrc/MB.java b/weaver5/java5-testsrc/MB.java
deleted file mode 100644
index 3ff3eede4..000000000
--- a/weaver5/java5-testsrc/MB.java
+++ /dev/null
@@ -1,15 +0,0 @@
-/* *******************************************************************
- * 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/weaver5/java5-testsrc/MC.java b/weaver5/java5-testsrc/MC.java
deleted file mode 100644
index d48133baf..000000000
--- a/weaver5/java5-testsrc/MC.java
+++ /dev/null
@@ -1,15 +0,0 @@
-/* *******************************************************************
- * 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/weaver5/java5-testsrc/MD.java b/weaver5/java5-testsrc/MD.java
deleted file mode 100644
index 47a61cba0..000000000
--- a/weaver5/java5-testsrc/MD.java
+++ /dev/null
@@ -1,15 +0,0 @@
-/* *******************************************************************
- * 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/weaver5/java5-testsrc/MessageService.java b/weaver5/java5-testsrc/MessageService.java
deleted file mode 100644
index 160aecc21..000000000
--- a/weaver5/java5-testsrc/MessageService.java
+++ /dev/null
@@ -1,13 +0,0 @@
-/*******************************************************************************
- * 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/weaver5/java5-testsrc/org/aspectj/matcher/tools/ReflectionWorldAdvancedPointcutExpressionTests.java b/weaver5/java5-testsrc/org/aspectj/matcher/tools/ReflectionWorldAdvancedPointcutExpressionTests.java
deleted file mode 100644
index d93daffd3..000000000
--- a/weaver5/java5-testsrc/org/aspectj/matcher/tools/ReflectionWorldAdvancedPointcutExpressionTests.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/* *******************************************************************
- * 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 ReflectionWorldAdvancedPointcutExpressionTests extends CommonAdvancedPointcutExpressionTests {
-
- protected World getWorld() {
- World w = new ReflectionWorld(false, getClass().getClassLoader());
- w.setBehaveInJava5Way(true);
- return w;
- }
-
-}
diff --git a/weaver5/java5-testsrc/org/aspectj/weaver/AllTracing5Tests.java b/weaver5/java5-testsrc/org/aspectj/weaver/AllTracing5Tests.java
deleted file mode 100644
index bf68cb56c..000000000
--- a/weaver5/java5-testsrc/org/aspectj/weaver/AllTracing5Tests.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*******************************************************************************
- * 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 junit.framework.Test;
-import junit.framework.TestSuite;
-
-public class AllTracing5Tests {
-
- public static Test suite() {
- TestSuite suite = new TestSuite(AllTracing5Tests.class.getName());
- //$JUnit-BEGIN$
- suite.addTestSuite(Jdk14TraceFactoryTest.class);
- suite.addTestSuite(Jdk14TraceTest.class);
- //$JUnit-END$
- return suite;
- }
-
-}
diff --git a/weaver5/java5-testsrc/org/aspectj/weaver/AllWeaver5Tests.java b/weaver5/java5-testsrc/org/aspectj/weaver/AllWeaver5Tests.java
deleted file mode 100644
index 54f35656f..000000000
--- a/weaver5/java5-testsrc/org/aspectj/weaver/AllWeaver5Tests.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/* *******************************************************************
- * 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(BcweaverModuleTests15.suite());
- suite.addTestSuite(ReflectionWorldReferenceTypeTest.class);
- suite.addTestSuite(PointcutExpressionTest.class);
- suite.addTestSuite(JoinPointSignatureIteratorTests.class);
- // gives incompatible class version error...
- // suite.addTestSuite(ReflectionWorldAdvancedPointcutExpressionTests.class
- // );
- suite.addTestSuite(ReflectionWorldSpecificTest.class);
- // $JUnit-END$
- return suite;
- }
-
-}
diff --git a/weaver5/java5-testsrc/org/aspectj/weaver/BcweaverModuleTests15.java b/weaver5/java5-testsrc/org/aspectj/weaver/BcweaverModuleTests15.java
deleted file mode 100644
index 4ae4d7beb..000000000
--- a/weaver5/java5-testsrc/org/aspectj/weaver/BcweaverModuleTests15.java
+++ /dev/null
@@ -1,41 +0,0 @@
-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 BcweaverModuleTests15 extends TestCase {
- public static Test suite() {
- TestSuite suite = new TestSuite(BcweaverModuleTests15.class.getName());
- suite.addTestSuite(BcelGenericSignatureToTypeXTestCase.class);
- suite.addTestSuite(BoundedReferenceTypeTestCase.class);
- suite.addTest(Java15PointcutExpressionTest.suite());
- suite.addTestSuite(MemberTestCase15.class);
- suite.addTestSuite(BcelWorldReferenceTypeTest.class);
- suite.addTest(TestJava5ReflectionBasedReferenceTypeDelegate.suite());
- suite.addTestSuite(TypeVariableTestCase.class);
- suite.addTestSuite(TypeVariableReferenceTypeTestCase.class);
- suite.addTestSuite(WildTypePatternResolutionTestCase.class);
- return suite;
- }
-
- public BcweaverModuleTests15(String name) {
- super(name);
- }
-}
diff --git a/weaver5/java5-testsrc/org/aspectj/weaver/BoundedReferenceTypeTestCase.java b/weaver5/java5-testsrc/org/aspectj/weaver/BoundedReferenceTypeTestCase.java
deleted file mode 100644
index 403b2ecb1..000000000
--- a/weaver5/java5-testsrc/org/aspectj/weaver/BoundedReferenceTypeTestCase.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/* *******************************************************************
- * 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;
-
-import org.aspectj.weaver.bcel.BcelWorld;
-
-public class BoundedReferenceTypeTestCase extends TestCase {
-
- ReferenceType javaLangClass;
- ReferenceType javaLangObject;
- BoundedReferenceType extendsClass;
- BoundedReferenceType superClass;
- BoundedReferenceType extendsWithExtras;
-
- public void testSignature() {
- String extendsSig = extendsClass.getSignature();
- assertEquals("+Ljava/lang/Class;", extendsSig);
- assertEquals("-Ljava/lang/Class;", superClass.getSignature());
- }
-
- public void testExtendsBounds() {
- assertFalse("has no lower bound", extendsClass.hasLowerBound());
- assertNull("no lower bound", extendsClass.getLowerBound());
- assertEquals(javaLangClass, extendsClass.getUpperBound());
- assertEquals("no interface bounds", 0, extendsClass.getAdditionalBounds().length);
- }
-
- public void testSuperBounds() {
- assertTrue("has lower bound", superClass.hasLowerBound());
- assertEquals(javaLangClass, superClass.getLowerBound());
- assertEquals("Ljava/lang/Object;", superClass.getUpperBound().getSignature());
- assertEquals("no interface bounds", 0, superClass.getAdditionalBounds().length);
- }
-
- public void testIsExtends() {
- assertTrue(extendsClass.kind == BoundedReferenceType.EXTENDS);
- assertFalse(superClass.kind == BoundedReferenceType.EXTENDS);
- }
-
- public void testIsSuper() {
- assertTrue(superClass.kind == BoundedReferenceType.SUPER);
- assertFalse(extendsClass.kind == BoundedReferenceType.SUPER);
- }
-
- public void testGetDeclaredInterfacesNoAdditions() {
- ResolvedType[] rt1 = extendsClass.getDeclaredInterfaces();
- ResolvedType[] rt2 = javaLangClass.getDeclaredInterfaces();
- assertEquals("same length", rt1.length, rt2.length);
- for (int i = 0; i < rt2.length; i++) {
- assertEquals("same methods", rt1[i], rt2[i]);
- }
- }
-
- public void testGetDeclaredInterfacesWithInterfaceBounds() {
- ResolvedType[] rt1 = extendsWithExtras.getDeclaredInterfaces();
- ResolvedType[] rt2 = javaLangClass.getDeclaredInterfaces();
- assertEquals("one extra interface", rt1.length, rt2.length + 1);
- for (int i = 0; i < rt2.length; i++) {
- assertEquals("same methods", rt1[i], rt2[i]);
- }
- assertEquals("Ljava/util/List;", rt1[rt1.length - 1].getSignature());
- }
-
- // all other methods in signature are delegated to upper bound...
- // representative test
- public void testGetDeclaredMethodsExtends() {
- ResolvedMember[] rm1 = extendsClass.getDeclaredMethods();
- ResolvedMember[] rm2 = javaLangClass.getDeclaredMethods();
- assertEquals("same length", rm1.length, rm2.length);
- for (int i = 0; i < rm2.length; i++) {
- assertEquals("same methods", rm1[i], rm2[i]);
- }
- }
-
- public void testGetDeclaredMethodsSuper() {
- ResolvedMember[] rm1 = superClass.getDeclaredMethods();
- ResolvedMember[] rm2 = javaLangObject.getDeclaredMethods();
- assertEquals("same length", rm1.length, rm2.length);
- for (int i = 0; i < rm2.length; i++) {
- assertEquals("same methods", rm1[i], rm2[i]);
- }
- }
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- BcelWorld world = new BcelWorld();
- javaLangClass = (ReferenceType) world.resolve(UnresolvedType.forName("java/lang/Class"));
- javaLangObject = (ReferenceType) world.resolve(UnresolvedType.OBJECT);
- extendsClass = new BoundedReferenceType(javaLangClass, true, world);
- superClass = new BoundedReferenceType(javaLangClass, false, world);
- extendsWithExtras = new BoundedReferenceType(javaLangClass, true, world, new ReferenceType[] { (ReferenceType) world
- .resolve(UnresolvedType.forName("java/util/List")) });
- }
-}
diff --git a/weaver5/java5-testsrc/org/aspectj/weaver/CommonReferenceTypeTests.java b/weaver5/java5-testsrc/org/aspectj/weaver/CommonReferenceTypeTests.java
deleted file mode 100644
index 8d683e8af..000000000
--- a/weaver5/java5-testsrc/org/aspectj/weaver/CommonReferenceTypeTests.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/* *******************************************************************
- * 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/weaver5/java5-testsrc/org/aspectj/weaver/Jdk14TraceFactoryTest.java b/weaver5/java5-testsrc/org/aspectj/weaver/Jdk14TraceFactoryTest.java
deleted file mode 100644
index cec4d6a3d..000000000
--- a/weaver5/java5-testsrc/org/aspectj/weaver/Jdk14TraceFactoryTest.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*******************************************************************************
- * 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 junit.framework.TestCase;
-
-import org.aspectj.weaver.tools.Jdk14TraceFactory;
-import org.aspectj.weaver.tools.Trace;
-
-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/weaver5/java5-testsrc/org/aspectj/weaver/Jdk14TraceTest.java b/weaver5/java5-testsrc/org/aspectj/weaver/Jdk14TraceTest.java
deleted file mode 100644
index 0c694cc9d..000000000
--- a/weaver5/java5-testsrc/org/aspectj/weaver/Jdk14TraceTest.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*******************************************************************************
- * 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/weaver5/java5-testsrc/org/aspectj/weaver/JoinPointSignatureIteratorTests.java b/weaver5/java5-testsrc/org/aspectj/weaver/JoinPointSignatureIteratorTests.java
deleted file mode 100644
index 9b7aa00d6..000000000
--- a/weaver5/java5-testsrc/org/aspectj/weaver/JoinPointSignatureIteratorTests.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/* *******************************************************************
- * 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 JoinPointSignatureIteratorTests 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/weaver5/java5-testsrc/org/aspectj/weaver/MemberTestCase15.java b/weaver5/java5-testsrc/org/aspectj/weaver/MemberTestCase15.java
deleted file mode 100644
index f44095a0e..000000000
--- a/weaver5/java5-testsrc/org/aspectj/weaver/MemberTestCase15.java
+++ /dev/null
@@ -1,155 +0,0 @@
-/* *******************************************************************
- * 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 MemberTestCase15 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/weaver5/java5-testsrc/org/aspectj/weaver/ReferenceTypeTestCase.java b/weaver5/java5-testsrc/org/aspectj/weaver/ReferenceTypeTestCase.java
deleted file mode 100644
index 5fbc530e7..000000000
--- a/weaver5/java5-testsrc/org/aspectj/weaver/ReferenceTypeTestCase.java
+++ /dev/null
@@ -1,854 +0,0 @@
-/* *******************************************************************
- * 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/weaver5/java5-testsrc/org/aspectj/weaver/TestJava5ReflectionBasedReferenceTypeDelegate.java b/weaver5/java5-testsrc/org/aspectj/weaver/TestJava5ReflectionBasedReferenceTypeDelegate.java
deleted file mode 100644
index 475c330eb..000000000
--- a/weaver5/java5-testsrc/org/aspectj/weaver/TestJava5ReflectionBasedReferenceTypeDelegate.java
+++ /dev/null
@@ -1,154 +0,0 @@
-/* *******************************************************************
- * 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 TestJava5ReflectionBasedReferenceTypeDelegate extends ReflectionBasedReferenceTypeDelegateTest {
-
- public static Test suite() {
- TestSuite suite = new TestSuite("TestJava5ReflectionBasedReferenceTypeDelegate");
- suite.addTestSuite(TestJava5ReflectionBasedReferenceTypeDelegate.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/weaver5/java5-testsrc/org/aspectj/weaver/TypeVariableReferenceTypeTestCase.java b/weaver5/java5-testsrc/org/aspectj/weaver/TypeVariableReferenceTypeTestCase.java
deleted file mode 100644
index 367a4fc93..000000000
--- a/weaver5/java5-testsrc/org/aspectj/weaver/TypeVariableReferenceTypeTestCase.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/* *******************************************************************
- * 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;
-
-import org.aspectj.weaver.bcel.BcelWorld;
-
-/**
- * @author colyer
- *
- */
-public class TypeVariableReferenceTypeTestCase extends TestCase {
-
- ReferenceType javaLangClass;
- ReferenceType jlNumber;
- ReferenceType javaLangObject;
- BoundedReferenceType extendsClass;
- BoundedReferenceType superClass;
- BoundedReferenceType extendsWithExtras;
- BcelWorld world;
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- 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);
- extendsWithExtras = new BoundedReferenceType(javaLangClass, true, world, new ReferenceType[] { (ReferenceType) world
- .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/weaver5/java5-testsrc/org/aspectj/weaver/TypeVariableTestCase.java b/weaver5/java5-testsrc/org/aspectj/weaver/TypeVariableTestCase.java
deleted file mode 100644
index 8ef8f70c1..000000000
--- a/weaver5/java5-testsrc/org/aspectj/weaver/TypeVariableTestCase.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/* *******************************************************************
- * 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;
-
-import org.aspectj.weaver.bcel.BcelWorld;
-
-public class TypeVariableTestCase extends TestCase {
-
- private UnresolvedType javaLangNumber;
- private UnresolvedType javaLangDouble;
- private UnresolvedType javaUtilList;
- private UnresolvedType javaIoSerializable;
- private World world;
-
- 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());
- }
-
- public void testAdditionalUpperBounds() {
- 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() {
- TypeVariable tv = new TypeVariable("T", javaLangNumber, new UnresolvedType[] { javaUtilList });
- tv.resolve(world);
- assertEquals("resolved number", javaLangNumber.resolve(world), tv.getUpperBound());
- assertEquals("resolved list", javaUtilList.resolve(world), tv.getSuperInterfaces()[0]);
- }
-
- public void testBindWithoutResolve() {
- TypeVariable tv = new TypeVariable("X");
- try {
- tv.canBeBoundTo(null);
- fail("Should throw illegal state exception");
- } catch (IllegalStateException ex) {
- }
- }
-
- public void testCanBindToUpperMatch() {
- TypeVariable tv = new TypeVariable("X", javaLangNumber);
- tv.resolve(world);
- assertTrue(tv.canBeBoundTo(javaLangDouble.resolve(world)));
- }
-
- public void testCanBindToUpperFail() {
- TypeVariable tv = new TypeVariable("X", javaLangNumber);
- tv.resolve(world);
- assertFalse(tv.canBeBoundTo(UnresolvedType.OBJECT.resolve(world)));
- }
-
- public void testCanBindToInterfaceMatch() {
- TypeVariable tv = new TypeVariable("T", javaLangNumber, new UnresolvedType[] { javaIoSerializable });
- tv.resolve(world);
- assertTrue(tv.canBeBoundTo(javaLangDouble.resolve(world)));
- }
-
- public void testCanBindToInterfaceFail() {
- TypeVariable tv = new TypeVariable("T", javaLangNumber, new UnresolvedType[] { javaUtilList });
- tv.resolve(world);
- assertFalse(tv.canBeBoundTo(javaLangDouble.resolve(world)));
- }
-
- // ---
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- javaLangNumber = UnresolvedType.forSignature("Ljava/lang/Number;");
- javaLangDouble = UnresolvedType.forSignature("Ljava/lang/Double;");
- javaIoSerializable = UnresolvedType.forSignature("Ljava/io/Serializable;");
- javaUtilList = UnresolvedType.forSignature("Ljava/util/List;");
- world = new BcelWorld();
- }
-
- @Override
- protected void tearDown() throws Exception {
- super.tearDown();
- }
-
-}
diff --git a/weaver5/java5-testsrc/org/aspectj/weaver/bcel/BcelGenericSignatureToTypeXTestCase.java b/weaver5/java5-testsrc/org/aspectj/weaver/bcel/BcelGenericSignatureToTypeXTestCase.java
deleted file mode 100644
index 58f774840..000000000
--- a/weaver5/java5-testsrc/org/aspectj/weaver/bcel/BcelGenericSignatureToTypeXTestCase.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/* *******************************************************************
- * 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.bcel;
-
-import junit.framework.TestCase;
-
-import org.aspectj.apache.bcel.Repository;
-import org.aspectj.apache.bcel.classfile.JavaClass;
-import org.aspectj.apache.bcel.classfile.Signature;
-import org.aspectj.util.GenericSignature;
-import org.aspectj.util.GenericSignatureParser;
-import org.aspectj.util.GenericSignature.ClassSignature;
-import org.aspectj.weaver.UnresolvedType;
-
-/**
- * @author colyer
- *
- */
-public class BcelGenericSignatureToTypeXTestCase extends TestCase {
-
- public final GenericSignature.ClassSignature getGenericClassTypeSignature(JavaClass jClass) {
- Signature sig = jClass.getSignatureAttribute();
- if (sig != null) {
- GenericSignatureParser parser = new GenericSignatureParser();
- ClassSignature classSig = parser.parseAsClassSignature(sig.getSignature());
- return classSig;
- }
- return null;
- }
-
- public void testEnumFromHell() throws Exception {
- BcelWorld world = new BcelWorld();
- JavaClass javaLangEnum = Repository.lookupClass("java/lang/Enum");
- GenericSignature.ClassSignature cSig = getGenericClassTypeSignature(javaLangEnum);
- UnresolvedType superclass = BcelGenericSignatureToTypeXConverter.classTypeSignature2TypeX(cSig.superclassSignature,
- cSig.formalTypeParameters, world);
- assertEquals("Ljava/lang/Object;", superclass.getSignature());
- assertEquals("2 superinterfaces", 2, cSig.superInterfaceSignatures.length);
- UnresolvedType comparable = BcelGenericSignatureToTypeXConverter.classTypeSignature2TypeX(cSig.superInterfaceSignatures[0],
- cSig.formalTypeParameters, world);
- assertEquals("Pjava/lang/Comparable<TE;>;", comparable.getSignature());
- UnresolvedType serializable = BcelGenericSignatureToTypeXConverter.classTypeSignature2TypeX(
- cSig.superInterfaceSignatures[1], cSig.formalTypeParameters, world);
- assertEquals("Ljava/io/Serializable;", serializable.getSignature());
- }
-
- public void testColonColon() throws Exception {
- BcelWorld world = new BcelWorld();
- GenericSignature.ClassSignature cSig = new GenericSignatureParser()
- .parseAsClassSignature("<T::Ljava/io/Serializable;>Ljava/lang/Object;Ljava/lang/Comparable<TT;>;");
- UnresolvedType resolved = BcelGenericSignatureToTypeXConverter.classTypeSignature2TypeX(cSig.superclassSignature,
- cSig.formalTypeParameters, world);
- assertEquals("Ljava/lang/Object;", resolved.getSignature());
- BcelGenericSignatureToTypeXConverter.classTypeSignature2TypeX(cSig.superInterfaceSignatures[0], cSig.formalTypeParameters,
- world);
-
- }
-
-}
diff --git a/weaver5/java5-testsrc/org/aspectj/weaver/bcel/BcelWorldReferenceTypeTest.java b/weaver5/java5-testsrc/org/aspectj/weaver/bcel/BcelWorldReferenceTypeTest.java
deleted file mode 100644
index 0ab70023e..000000000
--- a/weaver5/java5-testsrc/org/aspectj/weaver/bcel/BcelWorldReferenceTypeTest.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/* *******************************************************************
- * 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/weaver5/java5-testsrc/org/aspectj/weaver/patterns/WildTypePatternResolutionTestCase.java b/weaver5/java5-testsrc/org/aspectj/weaver/patterns/WildTypePatternResolutionTestCase.java
deleted file mode 100644
index 5eda5d577..000000000
--- a/weaver5/java5-testsrc/org/aspectj/weaver/patterns/WildTypePatternResolutionTestCase.java
+++ /dev/null
@@ -1,422 +0,0 @@
-/* *******************************************************************
- * Copyright (c) 2005 Contributors
- * All rights reserved.
- * This program and the accompanying materials are made available
- * under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Adrian Colyer initial implementation
- * ******************************************************************/
-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;
-import org.aspectj.weaver.CompressingDataOutputStream;
-import org.aspectj.weaver.ResolvedType;
-import org.aspectj.weaver.TypeFactory;
-import org.aspectj.weaver.UnresolvedType;
-import org.aspectj.weaver.VersionedDataInputStream;
-import org.aspectj.weaver.World;
-import org.aspectj.weaver.AjAttribute.WeaverVersionInfo;
-import org.aspectj.weaver.bcel.BcelWorld;
-
-// TODO write test cases for instanceof matching
-
-public class WildTypePatternResolutionTestCase extends TestCase {
-
- private World world;
- private Bindings bindings;
- private SimpleScope scope;
- private ResolvedType javaUtilList;
- private ResolvedType javaLangString;
- private ResolvedType javaUtilListOfString;
- private ResolvedType javaUtilListOfDouble;
- private ResolvedType javaUtilListOfSomething;
-
- /**
- * Foo where Foo exists and is generic Parser creates WildTypePattern namePatterns={Foo} resolveBindings resolves Foo to RT(Foo
- * - raw) return ExactTypePattern(LFoo;)
- */
- public void testSimpleFoo() {
- TypePattern rtp = resolveWildTypePattern("List", false);
-
- assertTrue("resolves to exact type", rtp instanceof ExactTypePattern);
- UnresolvedType exactType = rtp.getExactType();
- assertTrue(exactType.isRawType());
- assertEquals("Ljava/util/List;", exactType.getSignature());
-
- ResolvedType rt = exactType.resolve(world);
- assertEquals("Ljava/util/List;", rt.getSignature());
- assertTrue(rt.isRawType());
-
- ExactTypePattern etp = (ExactTypePattern) writeAndRead(rtp);
- exactType = etp.getExactType();
-
- assertEquals("Ljava/util/List;", exactType.getSignature());
-
- rt = exactType.resolve(world);
- assertEquals("Ljava/util/List;", rt.getSignature());
- assertTrue(rt.isRawType());
-
- assertTrue("matches List", etp.matches(javaUtilList, TypePattern.STATIC).alwaysTrue());
- assertTrue("matches generic List", etp.matches(javaUtilList.getGenericType(), TypePattern.STATIC).alwaysTrue());
- assertTrue("matches parameterized list", etp.matches(javaUtilListOfString, TypePattern.STATIC).alwaysTrue());
- assertTrue("does not match String", etp.matches(javaLangString, TypePattern.STATIC).alwaysFalse());
- }
-
- /**
- * Foo<String> where Foo exists and String meets the bounds Parser creates WildTypePattern namePatterns = {Foo},
- * typeParameters=WTP{String} resolveBindings resolves typeParameters to ExactTypePattern(String) resolves Foo to RT(Foo)
- * returns ExactTypePattern(PFoo<String>; - parameterized)
- */
- public void testParameterized() {
- TypePattern rtp = resolveWildTypePattern("List<String>", false);
-
- assertTrue("resolves to exact type", rtp instanceof ExactTypePattern);
- UnresolvedType exactType = rtp.getExactType();
- assertTrue(exactType.isParameterizedType());
- assertEquals("Pjava/util/List<Ljava/lang/String;>;", exactType.getSignature());
-
- ResolvedType rt = exactType.resolve(world);
- assertEquals("Pjava/util/List<Ljava/lang/String;>;", rt.getSignature());
- assertTrue(rt.isParameterizedType());
-
- ExactTypePattern etp = (ExactTypePattern) writeAndRead(rtp);
- exactType = etp.getExactType();
-
- assertEquals("Pjava/util/List<Ljava/lang/String;>;", rt.getSignature());
- assertTrue(rt.isParameterizedType());
-
- rt = exactType.resolve(world);
- assertEquals("Pjava/util/List<Ljava/lang/String;>;", rt.getSignature());
- assertTrue(rt.isParameterizedType());
-
- assertFalse("does not match List", etp.matches(javaUtilList, TypePattern.STATIC).alwaysTrue());
- assertFalse("does not match generic List", etp.matches(javaUtilList.getGenericType(), TypePattern.STATIC).alwaysTrue());
- assertTrue("matches parameterized list", etp.matches(javaUtilListOfString, TypePattern.STATIC).alwaysTrue());
- assertFalse("does not match parameterized list of double", etp.matches(javaUtilListOfDouble, TypePattern.STATIC)
- .alwaysTrue());
- assertTrue("does not match String", etp.matches(javaLangString, TypePattern.STATIC).alwaysFalse());
-
- }
-
- /**
- * Foo<Str*> where Foo exists and takes one bound Parser creates WildTypePattern namePatterns = {Foo}, typeParameters=WTP{Str*}
- * resolveBindings resolves typeParameters to WTP{Str*} resolves Foo to RT(Foo) returns WildTypePattern(name = Foo,
- * typeParameters = WTP{Str*} isGeneric=false)
- */
- public void testParameterizedWildCard() {
- TypePattern rtp = resolveWildTypePattern("List<Str*>", false);
-
- assertTrue("resolves to WildTypePattern", rtp instanceof WildTypePattern);
- assertTrue("one type parameter", rtp.typeParameters.size() == 1);
- assertTrue("missing", ResolvedType.isMissing(rtp.getExactType()));
-
- WildTypePattern wtp = (WildTypePattern) writeAndRead(rtp);
- assertTrue("one type parameter", wtp.typeParameters.size() == 1);
- assertTrue("missing", ResolvedType.isMissing(wtp.getExactType()));
- assertEquals("Str*", wtp.getTypeParameters().getTypePatterns()[0].toString());
-
- assertFalse("does not match List", wtp.matches(javaUtilList, TypePattern.STATIC).alwaysTrue());
- assertFalse("does not match generic List", wtp.matches(javaUtilList.getGenericType(), TypePattern.STATIC).alwaysTrue());
- assertTrue("matches parameterized list", wtp.matches(javaUtilListOfString, TypePattern.STATIC).alwaysTrue());
- assertFalse("does not match parameterized list of double", wtp.matches(javaUtilListOfDouble, TypePattern.STATIC)
- .alwaysTrue());
- assertTrue("does not match String", wtp.matches(javaLangString, TypePattern.STATIC).alwaysFalse());
- }
-
- /**
- * Fo*<String> Parser creates WildTypePattern namePatterns = {Fo*}, typeParameters=WTP{String} resolveBindings resolves
- * typeParameters to ETP{String} returns WildTypePattern(name = Fo*, typeParameters = ETP{String} isGeneric=false)
- */
- public void testWildcardParameterized() {
- TypePattern rtp = resolveWildTypePattern("Li*<String>", false);
-
- assertTrue("resolves to WildTypePattern", rtp instanceof WildTypePattern);
- assertTrue("one type parameter", rtp.typeParameters.size() == 1);
- assertEquals("Ljava/lang/String;", rtp.typeParameters.getTypePatterns()[0].getExactType().getSignature());
-
- WildTypePattern wtp = (WildTypePattern) writeAndRead(rtp);
- assertTrue("one type parameter", wtp.typeParameters.size() == 1);
- assertEquals("Ljava/lang/String;", wtp.typeParameters.getTypePatterns()[0].getExactType().getSignature());
-
- assertFalse("does not match List", wtp.matches(javaUtilList, TypePattern.STATIC).alwaysTrue());
- assertFalse("does not match generic List", wtp.matches(javaUtilList.getGenericType(), TypePattern.STATIC).alwaysTrue());
- assertTrue("matches parameterized list", wtp.matches(javaUtilListOfString, TypePattern.STATIC).alwaysTrue());
- assertFalse("does not match parameterized list of double", wtp.matches(javaUtilListOfDouble, TypePattern.STATIC)
- .alwaysTrue());
- assertTrue("does not match String", wtp.matches(javaLangString, TypePattern.STATIC).alwaysFalse());
- }
-
- /**
- * Foo<?>
- */
- public void testSomething() {
- TypePattern rtp = resolveWildTypePattern("List<?>", false);
-
- assertTrue("resolves to exact type", rtp instanceof ExactTypePattern);
- UnresolvedType exactType = rtp.getExactType();
- assertTrue(exactType.isParameterizedType());
- assertEquals("Pjava/util/List<*>;", exactType.getSignature());
-
- ExactTypePattern etp = (ExactTypePattern) writeAndRead(rtp);
- exactType = etp.getExactType();
- assertTrue(exactType.isParameterizedType());
- assertEquals("Pjava/util/List<*>;", exactType.getSignature());
-
- assertFalse("does not match List", etp.matches(javaUtilList, TypePattern.STATIC).alwaysTrue());
- assertFalse("does not match generic List", etp.matches(javaUtilList.getGenericType(), TypePattern.STATIC).alwaysTrue());
- assertFalse("does not match parameterized list", etp.matches(javaUtilListOfString, TypePattern.STATIC).alwaysTrue());
- assertFalse("does not match parameterized list of double", etp.matches(javaUtilListOfDouble, TypePattern.STATIC)
- .alwaysTrue());
- assertTrue("does not match String", etp.matches(javaLangString, TypePattern.STATIC).alwaysFalse());
-
- assertTrue("matches list of something", etp.matches(javaUtilListOfSomething, TypePattern.STATIC).alwaysTrue());
- }
-
- /**
- * Foo<? extends Number>
- */
- public void testSomethingExtends() {
- TypePattern rtp = resolveWildTypePattern("List<? extends Number>", false);
-
- assertTrue("resolves to exact type", rtp instanceof ExactTypePattern);
- UnresolvedType exactType = rtp.getExactType();
- assertTrue(exactType.isParameterizedType());
- assertEquals("Pjava/util/List<+Ljava/lang/Number;>;", exactType.getSignature());
- assertTrue("got a bounded reference type", exactType.getTypeParameters()[0] instanceof BoundedReferenceType);
-
- ExactTypePattern etp = (ExactTypePattern) writeAndRead(rtp);
- exactType = etp.getExactType();
- exactType = exactType.resolve(world);
- assertTrue(exactType.isParameterizedType());
- assertEquals("Pjava/util/List<+Ljava/lang/Number;>;", exactType.getSignature());
- assertTrue("got a bounded reference type", exactType.getTypeParameters()[0] instanceof BoundedReferenceType);
-
- assertFalse("does not match List", etp.matches(javaUtilList, TypePattern.STATIC).alwaysTrue());
- assertFalse("does not match generic List", etp.matches(javaUtilList.getGenericType(), TypePattern.STATIC).alwaysTrue());
- assertFalse("does not match parameterized list", etp.matches(javaUtilListOfString, TypePattern.STATIC).alwaysTrue());
- assertFalse("does not match parameterized list of double", etp.matches(javaUtilListOfDouble, TypePattern.STATIC)
- .alwaysTrue());
- assertTrue("does not match String", etp.matches(javaLangString, TypePattern.STATIC).alwaysFalse());
- assertFalse("does not match list of something", etp.matches(javaUtilListOfSomething, TypePattern.STATIC).alwaysTrue());
-
- ResolvedType listOfNumber = TypeFactory.createParameterizedType(javaUtilList, new UnresolvedType[] { UnresolvedType
- .forName("java.lang.Number").resolve(world) }, world);
-
- ResolvedType listOfDouble = TypeFactory.createParameterizedType(javaUtilList, new UnresolvedType[] { UnresolvedType
- .forName("java.lang.Double").resolve(world) }, world);
-
- assertFalse("does not match list of number", etp.matches(listOfNumber, TypePattern.STATIC).alwaysTrue());
- assertFalse("does not match list of double", etp.matches(listOfDouble, TypePattern.STATIC).alwaysTrue());
-
- ResolvedType extendsNumber = TypeFactory.createTypeFromSignature("+Ljava/lang/Number;").resolve(world);
- ResolvedType listOfExtendsNumber = TypeFactory.createParameterizedType(javaUtilList,
- new UnresolvedType[] { extendsNumber }, world);
-
- assertTrue("matches list of ? extends number", etp.matches(listOfExtendsNumber, TypePattern.STATIC).alwaysTrue());
-
- }
-
- /**
- * Foo<? extends Number+>
- */
- public void testSomethingExtendsPattern() {
- TypePattern rtp = resolveWildTypePattern("List<? extends Number+>", false);
-
- assertTrue("resolves to wild type pattern", rtp instanceof WildTypePattern);
- assertEquals("one type parameter", 1, rtp.getTypeParameters().size());
- TypePattern tp = rtp.getTypeParameters().getTypePatterns()[0];
- assertTrue("parameter is wild", tp instanceof WildTypePattern);
- WildTypePattern tpwtp = (WildTypePattern) tp;
- assertEquals("?", tpwtp.getNamePatterns()[0].maybeGetSimpleName());
- assertEquals("java.lang.Number+", tpwtp.upperBound.toString());
-
- WildTypePattern wtp = (WildTypePattern) writeAndRead(rtp);
- assertEquals("one type parameter", 1, wtp.getTypeParameters().size());
- tp = rtp.getTypeParameters().getTypePatterns()[0];
- assertTrue("parameter is wild", tp instanceof WildTypePattern);
- tpwtp = (WildTypePattern) tp;
- assertEquals("?", tpwtp.getNamePatterns()[0].maybeGetSimpleName());
- assertEquals("java.lang.Number+", tpwtp.upperBound.toString());
-
- assertFalse("does not match List", wtp.matches(javaUtilList, TypePattern.STATIC).alwaysTrue());
- assertFalse("does not match generic List", wtp.matches(javaUtilList.getGenericType(), TypePattern.STATIC).alwaysTrue());
- assertFalse("does not match parameterized list", wtp.matches(javaUtilListOfString, TypePattern.STATIC).alwaysTrue());
- assertFalse("does not match parameterized list of double", wtp.matches(javaUtilListOfDouble, TypePattern.STATIC)
- .alwaysTrue());
- assertTrue("does not match String", wtp.matches(javaLangString, TypePattern.STATIC).alwaysFalse());
- assertFalse("does not match list of something", wtp.matches(javaUtilListOfSomething, TypePattern.STATIC).alwaysTrue());
-
- ResolvedType listOfNumber = TypeFactory.createParameterizedType(javaUtilList, new UnresolvedType[] { UnresolvedType
- .forName("java.lang.Number").resolve(world) }, world);
-
- ResolvedType listOfDouble = TypeFactory.createParameterizedType(javaUtilList, new UnresolvedType[] { UnresolvedType
- .forName("java.lang.Double").resolve(world) }, world);
-
- 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);
-
- 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,
- new UnresolvedType[] { extendsDouble }, world);
-
- assertTrue("matches list of ? extends double", wtp.matches(listOfExtendsDouble, TypePattern.STATIC).alwaysTrue());
-
- }
-
- /**
- * Foo<? extends Num*>
- */
- public void testSomethingExtendsPatternv2() {
- TypePattern rtp = resolveWildTypePattern("List<? extends Num*>", false);
-
- assertTrue("resolves to wild type pattern", rtp instanceof WildTypePattern);
- assertEquals("one type parameter", 1, rtp.getTypeParameters().size());
- TypePattern tp = rtp.getTypeParameters().getTypePatterns()[0];
- assertTrue("parameter is wild", tp instanceof WildTypePattern);
- WildTypePattern tpwtp = (WildTypePattern) tp;
- assertEquals("?", tpwtp.getNamePatterns()[0].maybeGetSimpleName());
- assertEquals("Num*", tpwtp.upperBound.toString());
-
- WildTypePattern wtp = (WildTypePattern) writeAndRead(rtp);
- assertEquals("one type parameter", 1, wtp.getTypeParameters().size());
- tp = rtp.getTypeParameters().getTypePatterns()[0];
- assertTrue("parameter is wild", tp instanceof WildTypePattern);
- tpwtp = (WildTypePattern) tp;
- assertEquals("?", tpwtp.getNamePatterns()[0].maybeGetSimpleName());
- assertEquals("Num*", tpwtp.upperBound.toString());
-
- assertFalse("does not match List", wtp.matches(javaUtilList, TypePattern.STATIC).alwaysTrue());
- assertFalse("does not match generic List", wtp.matches(javaUtilList.getGenericType(), TypePattern.STATIC).alwaysTrue());
- assertFalse("does not match parameterized list", wtp.matches(javaUtilListOfString, TypePattern.STATIC).alwaysTrue());
- assertFalse("does not match parameterized list of double", wtp.matches(javaUtilListOfDouble, TypePattern.STATIC)
- .alwaysTrue());
- assertTrue("does not match String", wtp.matches(javaLangString, TypePattern.STATIC).alwaysFalse());
- assertFalse("does not match list of something", wtp.matches(javaUtilListOfSomething, TypePattern.STATIC).alwaysTrue());
-
- ResolvedType listOfNumber = TypeFactory.createParameterizedType(javaUtilList, new UnresolvedType[] { UnresolvedType
- .forName("java.lang.Number").resolve(world) }, world);
-
- ResolvedType listOfDouble = TypeFactory.createParameterizedType(javaUtilList, new UnresolvedType[] { UnresolvedType
- .forName("java.lang.Double").resolve(world) }, world);
-
- 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);
-
- 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,
- new UnresolvedType[] { extendsDouble }, world);
-
- assertFalse("does not match list of ? extends double", wtp.matches(listOfExtendsDouble, TypePattern.STATIC).alwaysTrue());
- }
-
- /**
- * Foo<? super Number>
- *
- */
- public void testSomethingSuper() {
- TypePattern rtp = resolveWildTypePattern("List<? super Double>", false);
-
- assertTrue("resolves to exact type", rtp instanceof ExactTypePattern);
- UnresolvedType exactType = rtp.getExactType();
- assertTrue(exactType.isParameterizedType());
- assertEquals("Pjava/util/List<-Ljava/lang/Double;>;", exactType.getSignature());
- assertTrue("got a bounded reference type", exactType.getTypeParameters()[0] instanceof BoundedReferenceType);
-
- ExactTypePattern etp = (ExactTypePattern) writeAndRead(rtp);
- exactType = etp.getExactType();
- exactType = exactType.resolve(world);
- assertTrue(exactType.isParameterizedType());
- assertEquals("Pjava/util/List<-Ljava/lang/Double;>;", exactType.getSignature());
- assertTrue("got a bounded reference type", exactType.getTypeParameters()[0] instanceof BoundedReferenceType);
-
- assertFalse("does not match List", etp.matches(javaUtilList, TypePattern.STATIC).alwaysTrue());
- assertFalse("does not match generic List", etp.matches(javaUtilList.getGenericType(), TypePattern.STATIC).alwaysTrue());
- assertFalse("does not match parameterized list", etp.matches(javaUtilListOfString, TypePattern.STATIC).alwaysTrue());
- assertFalse("does not match parameterized list of double", etp.matches(javaUtilListOfDouble, TypePattern.STATIC)
- .alwaysTrue());
- assertTrue("does not match String", etp.matches(javaLangString, TypePattern.STATIC).alwaysFalse());
- assertFalse("does not match list of something", etp.matches(javaUtilListOfSomething, TypePattern.STATIC).alwaysTrue());
-
- ResolvedType listOfNumber = TypeFactory.createParameterizedType(javaUtilList, new UnresolvedType[] { UnresolvedType
- .forName("java.lang.Number").resolve(world) }, world);
-
- ResolvedType listOfDouble = TypeFactory.createParameterizedType(javaUtilList, new UnresolvedType[] { UnresolvedType
- .forName("java.lang.Double").resolve(world) }, world);
-
- assertFalse("does not match list of number", etp.matches(listOfNumber, TypePattern.STATIC).alwaysTrue());
- assertFalse("does not match list of double", etp.matches(listOfDouble, TypePattern.STATIC).alwaysTrue());
-
- ResolvedType superDouble = TypeFactory.createTypeFromSignature("-Ljava/lang/Double;").resolve(world);
- ResolvedType listOfSuperDouble = TypeFactory.createParameterizedType(javaUtilList, new UnresolvedType[] { superDouble },
- world);
-
- assertTrue("matches list of ? super double", etp.matches(listOfSuperDouble, TypePattern.STATIC).alwaysTrue());
- }
-
- private TypePattern resolveWildTypePattern(String source, boolean requireExact) {
- WildTypePattern wtp = makeWildTypePattern(source);
- return wtp.resolveBindings(scope, bindings, false, requireExact);
- }
-
- private WildTypePattern makeWildTypePattern(String source) {
- PatternParser parser = new PatternParser(source);
- return (WildTypePattern) parser.parseTypePattern();
- }
-
- private TypePattern writeAndRead(TypePattern etp) {
- try {
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- ConstantPoolSimulator cps = new ConstantPoolSimulator();
- CompressingDataOutputStream dos = new CompressingDataOutputStream(baos, cps);
- etp.write(dos);
- dos.flush();
- dos.close();
- ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
- VersionedDataInputStream in = new VersionedDataInputStream(bais, cps);
- in.setVersion(new WeaverVersionInfo());
- TypePattern ret = TypePattern.read(in, null);
- return ret;
- } catch (IOException ioEx) {
- fail(ioEx + " thrown during serialization");
- }
- return null;
- }
-
- protected void setUp() throws Exception {
- super.setUp();
- this.world = new BcelWorld();
- this.world.setBehaveInJava5Way(true);
- this.bindings = new Bindings(0);
- this.scope = new SimpleScope(world, new FormalBinding[] {});
- this.scope.setImportedPrefixes(new String[] { "java.io.", "java.util.", "java.lang." });
- this.javaLangString = UnresolvedType.forName("java.lang.String").resolve(world);
- this.javaUtilList = UnresolvedType.forName("java.util.List").resolve(world);
- this.javaUtilListOfString = TypeFactory.createParameterizedType(javaUtilList, new UnresolvedType[] { javaLangString },
- world);
- this.javaUtilListOfDouble = TypeFactory.createParameterizedType(javaUtilList, new UnresolvedType[] { UnresolvedType
- .forName("java.lang.Double").resolve(world) }, world);
- this.javaUtilListOfSomething = TypeFactory.createParameterizedType(javaUtilList,
- new UnresolvedType[] { UnresolvedType.SOMETHING.resolve(world) }, world);
- }
-}
diff --git a/weaver5/java5-testsrc/org/aspectj/weaver/reflect/ReflectionBasedReferenceTypeDelegateTest.java b/weaver5/java5-testsrc/org/aspectj/weaver/reflect/ReflectionBasedReferenceTypeDelegateTest.java
deleted file mode 100644
index 72c7c85f7..000000000
--- a/weaver5/java5-testsrc/org/aspectj/weaver/reflect/ReflectionBasedReferenceTypeDelegateTest.java
+++ /dev/null
@@ -1,316 +0,0 @@
-/* *******************************************************************
- * 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.Method;
-import java.util.HashSet;
-import java.util.Set;
-
-import junit.framework.TestCase;
-
-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.bcel.BcelWorld;
-
-public abstract class ReflectionBasedReferenceTypeDelegateTest extends TestCase {
-
- protected ReflectionWorld world;
- private ResolvedType objectType;
- private ResolvedType classType;
-
- public void testIsAspect() {
- assertFalse(objectType.isAspect());
- }
-
- public void testIsAnnotationStyleAspect() {
- assertFalse(objectType.isAnnotationStyleAspect());
- }
-
- public void testIsInterface() {
- assertFalse(objectType.isInterface());
- assertTrue(world.resolve("java.io.Serializable").isInterface());
- }
-
- public void testIsEnum() {
- assertFalse(objectType.isEnum());
- }
-
- public void testIsAnnotation() {
- assertFalse(objectType.isAnnotation());
- }
-
- public void testIsAnnotationWithRuntimeRetention() {
- assertFalse(objectType.isAnnotationWithRuntimeRetention());
- }
-
- public void testIsClass() {
- assertTrue(objectType.isClass());
- assertFalse(world.resolve("java.io.Serializable").isClass());
- }
-
- public void testIsGeneric() {
- assertFalse(objectType.isGenericType());
- }
-
- public void testIsExposedToWeaver() {
- assertFalse(objectType.isExposedToWeaver());
- }
-
- public void testHasAnnotation() {
- assertFalse(objectType.hasAnnotation(UnresolvedType.forName("Foo")));
- }
-
- public void testGetAnnotations() {
- assertEquals("no entries", 0, objectType.getAnnotations().length);
- }
-
- public void testGetAnnotationTypes() {
- assertEquals("no entries", 0, objectType.getAnnotationTypes().length);
- }
-
- public void testGetTypeVariables() {
- assertEquals("no entries", 0, objectType.getTypeVariables().length);
- }
-
- public void testGetPerClause() {
- assertNull(objectType.getPerClause());
- }
-
- public void testGetModifiers() {
- assertEquals(Object.class.getModifiers(), objectType.getModifiers());
- }
-
- public void testGetSuperclass() {
- assertTrue("Superclass of object should be null, but it is: " + objectType.getSuperclass(),
- objectType.getSuperclass() == null);
- assertEquals(objectType, world.resolve("java.lang.Class").getSuperclass());
- ResolvedType d = world.resolve("reflect.tests.D");
- assertEquals(world.resolve("reflect.tests.C"), d.getSuperclass());
- }
-
- protected int findMethod(String name, ResolvedMember[] methods) {
- for (int i = 0; i < methods.length; i++) {
- if (name.equals(methods[i].getName())) {
- return i;
- }
- }
- return -1;
- }
-
- protected int findMethod(String name, int numArgs, ResolvedMember[] methods) {
- for (int i = 0; i < methods.length; i++) {
- if (name.equals(methods[i].getName()) && (methods[i].getParameterTypes().length == numArgs)) {
- return i;
- }
- }
- return -1;
- }
-
- public void testGetDeclaredMethods() {
- ResolvedMember[] methods = objectType.getDeclaredMethods();
- assertEquals(Object.class.getDeclaredMethods().length + Object.class.getDeclaredConstructors().length, methods.length);
-
- ResolvedType c = world.resolve("reflect.tests.C");
- methods = c.getDeclaredMethods();
- assertEquals(3, methods.length);
- int idx = findMethod("foo", methods);
- assertTrue(idx > -1);
-
- assertEquals(world.resolve("java.lang.String"), methods[idx].getReturnType());
- assertEquals(1, methods[idx].getParameterTypes().length);
- assertEquals(objectType, methods[idx].getParameterTypes()[0]);
- assertEquals(1, methods[idx].getExceptions().length);
- assertEquals(world.resolve("java.lang.Exception"), methods[idx].getExceptions()[0]);
- int baridx = findMethod("bar", methods);
- int initidx = findMethod("<init>", methods);
- assertTrue(baridx > -1);
- assertTrue(initidx > -1);
- assertTrue(baridx != initidx && baridx != idx && idx <= 2 && initidx <= 2 && baridx <= 2);
-
- ResolvedType d = world.resolve("reflect.tests.D");
- methods = d.getDeclaredMethods();
- assertEquals(2, methods.length);
-
- classType = world.resolve("java.lang.Class");
- methods = classType.getDeclaredMethods();
- assertEquals(Class.class.getDeclaredMethods().length + Class.class.getDeclaredConstructors().length, methods.length);
- }
-
- public void testGetDeclaredFields() {
- ResolvedMember[] fields = objectType.getDeclaredFields();
- assertEquals(0, fields.length);
-
- ResolvedType c = world.resolve("reflect.tests.C");
- fields = c.getDeclaredFields();
-
- assertEquals(2, fields.length);
- assertEquals("f", fields[0].getName());
- assertEquals("s", fields[1].getName());
- assertEquals(UnresolvedType.INT, fields[0].getReturnType());
- assertEquals(world.resolve("java.lang.String"), fields[1].getReturnType());
- }
-
- public void testGetDeclaredInterfaces() {
- ResolvedType[] interfaces = objectType.getDeclaredInterfaces();
- assertEquals(0, interfaces.length);
-
- ResolvedType d = world.resolve("reflect.tests.D");
- interfaces = d.getDeclaredInterfaces();
- assertEquals(1, interfaces.length);
- assertEquals(world.resolve("java.io.Serializable"), interfaces[0]);
- }
-
- public void testGetDeclaredPointcuts() {
- ResolvedMember[] pointcuts = objectType.getDeclaredPointcuts();
- assertEquals(0, pointcuts.length);
- }
-
- public void testSerializableSuperclass() {
- ResolvedType serializableType = world.resolve("java.io.Serializable");
- ResolvedType superType = serializableType.getSuperclass();
- assertTrue("Superclass of serializable should be Object but was " + superType, superType.equals(UnresolvedType.OBJECT));
-
- BcelWorld bcelworld = new BcelWorld();
- bcelworld.setBehaveInJava5Way(true);
- ResolvedType bcelSupertype = bcelworld.resolve(UnresolvedType.SERIALIZABLE).getSuperclass();
- assertTrue("Should be null but is " + bcelSupertype, bcelSupertype.equals(UnresolvedType.OBJECT));
- }
-
- public void testSubinterfaceSuperclass() {
- ResolvedType ifaceType = world.resolve("java.security.Key");
- ResolvedType superType = ifaceType.getSuperclass();
- assertTrue("Superclass should be Object but was " + superType, superType.equals(UnresolvedType.OBJECT));
-
- BcelWorld bcelworld = new BcelWorld();
- bcelworld.setBehaveInJava5Way(true);
- ResolvedType bcelSupertype = bcelworld.resolve("java.security.Key").getSuperclass();
- assertTrue("Should be null but is " + bcelSupertype, bcelSupertype.equals(UnresolvedType.OBJECT));
- }
-
- public void testVoidSuperclass() {
- ResolvedType voidType = world.resolve(Void.TYPE);
- ResolvedType superType = voidType.getSuperclass();
- assertNull(superType);
-
- BcelWorld bcelworld = new BcelWorld();
- bcelworld.setBehaveInJava5Way(true);
- ResolvedType bcelSupertype = bcelworld.resolve("void").getSuperclass();
- assertTrue("Should be null but is " + bcelSupertype, bcelSupertype == null);
- }
-
- public void testIntSuperclass() {
- ResolvedType voidType = world.resolve(Integer.TYPE);
- ResolvedType superType = voidType.getSuperclass();
- assertNull(superType);
-
- BcelWorld bcelworld = new BcelWorld();
- bcelworld.setBehaveInJava5Way(true);
- ResolvedType bcelSupertype = bcelworld.resolve("int").getSuperclass();
- assertTrue("Should be null but is " + bcelSupertype, bcelSupertype == null);
- }
-
- public void testGenericInterfaceSuperclass_BcelWorldResolution() {
- BcelWorld bcelworld = new BcelWorld();
- bcelworld.setBehaveInJava5Way(true);
-
- UnresolvedType javaUtilMap = UnresolvedType.forName("java.util.Map");
-
- ReferenceType rawType = (ReferenceType) bcelworld.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));
- }
-
- // FIXME asc maybe. The reflection list of methods returned doesn't include <clinit> (the static initializer) ... is that really
- // a problem.
- public void testCompareSubclassDelegates() {
-
- boolean barfIfClinitMissing = false;
- world.setBehaveInJava5Way(true);
-
- BcelWorld bcelWorld = new BcelWorld(getClass().getClassLoader(), IMessageHandler.THROW, null);
- bcelWorld.setBehaveInJava5Way(true);
- UnresolvedType javaUtilHashMap = UnresolvedType.forName("java.util.HashMap");
- ReferenceType rawType = (ReferenceType) bcelWorld.resolve(javaUtilHashMap);
-
- ReferenceType rawReflectType = (ReferenceType) world.resolve(javaUtilHashMap);
- ResolvedMember[] rms1 = rawType.getDelegate().getDeclaredMethods();
- ResolvedMember[] rms2 = rawReflectType.getDelegate().getDeclaredMethods();
- StringBuffer errors = new StringBuffer();
- Set one = new HashSet();
- for (int i = 0; i < rms1.length; i++) {
- one.add(rms1[i].toString());
- }
- Set two = new HashSet();
- for (int i = 0; i < rms2.length; i++) {
- two.add(rms2[i].toString());
- }
- for (int i = 0; i < rms2.length; i++) {
- if (!one.contains(rms2[i].toString())) {
- errors.append("Couldn't find " + rms2[i].toString() + " in the bcel set\n");
- }
- }
- for (int i = 0; i < rms1.length; i++) {
- if (!two.contains(rms1[i].toString())) {
- if (!barfIfClinitMissing && rms1[i].getName().equals("<clinit>"))
- continue;
- errors.append("Couldn't find " + rms1[i].toString() + " in the reflection set\n");
- }
- }
- assertTrue("Errors:" + errors.toString(), errors.length() == 0);
-
- // the good old ibm vm seems to offer clinit through its reflection support (see pr145322)
- if (rms1.length == rms2.length)
- return;
- if (barfIfClinitMissing) {
- // the numbers must be exact
- assertEquals(rms1.length, rms2.length);
- } else {
- // the numbers can be out by one in favour of bcel
- if (rms1.length != (rms2.length + 1)) {
- for (int i = 0; i < rms1.length; i++) {
- System.err.println("bcel" + i + " is " + rms1[i]);
- }
- for (int i = 0; i < rms2.length; i++) {
- System.err.println("refl" + i + " is " + rms2[i]);
- }
- }
- assertTrue("Should be one extra (clinit) in BCEL case, but bcel=" + rms1.length + " reflect=" + rms2.length,
- rms1.length == rms2.length + 1);
- }
- }
-
- 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 {
- world = new ReflectionWorld(getClass().getClassLoader());
- objectType = world.resolve("java.lang.Object");
- }
-}
diff --git a/weaver5/java5-testsrc/org/aspectj/weaver/reflect/ReflectionWorldReferenceTypeTest.java b/weaver5/java5-testsrc/org/aspectj/weaver/reflect/ReflectionWorldReferenceTypeTest.java
deleted file mode 100644
index 720c88289..000000000
--- a/weaver5/java5-testsrc/org/aspectj/weaver/reflect/ReflectionWorldReferenceTypeTest.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/* *******************************************************************
- * 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/weaver5/java5-testsrc/org/aspectj/weaver/reflect/ReflectionWorldTest.java b/weaver5/java5-testsrc/org/aspectj/weaver/reflect/ReflectionWorldTest.java
deleted file mode 100644
index 1108ca13c..000000000
--- a/weaver5/java5-testsrc/org/aspectj/weaver/reflect/ReflectionWorldTest.java
+++ /dev/null
@@ -1,290 +0,0 @@
-/* *******************************************************************
- * 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 testTypeConversions_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 testTypeConversions_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/weaver5/java5-testsrc/org/aspectj/weaver/tools/Java15PointcutExpressionTest.java b/weaver5/java5-testsrc/org/aspectj/weaver/tools/Java15PointcutExpressionTest.java
deleted file mode 100644
index f651a2f29..000000000
--- a/weaver5/java5-testsrc/org/aspectj/weaver/tools/Java15PointcutExpressionTest.java
+++ /dev/null
@@ -1,746 +0,0 @@
-/* *******************************************************************
- * 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/weaver5/java5-testsrc/test/A.java b/weaver5/java5-testsrc/test/A.java
deleted file mode 100644
index 12959cd51..000000000
--- a/weaver5/java5-testsrc/test/A.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/* *******************************************************************
- * 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/weaver5/java5-testsrc/test/A1.java b/weaver5/java5-testsrc/test/A1.java
deleted file mode 100644
index 616708345..000000000
--- a/weaver5/java5-testsrc/test/A1.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/* *******************************************************************
- * 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/weaver5/java5-testsrc/test/A1AnnotatedType.java b/weaver5/java5-testsrc/test/A1AnnotatedType.java
deleted file mode 100644
index e40addbf5..000000000
--- a/weaver5/java5-testsrc/test/A1AnnotatedType.java
+++ /dev/null
@@ -1,17 +0,0 @@
-/* *******************************************************************
- * 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/weaver5/java5-testsrc/test/A2.java b/weaver5/java5-testsrc/test/A2.java
deleted file mode 100644
index 48749a3d4..000000000
--- a/weaver5/java5-testsrc/test/A2.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/* *******************************************************************
- * 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/weaver5/java5-testsrc/test/A2AnnotatedType.java b/weaver5/java5-testsrc/test/A2AnnotatedType.java
deleted file mode 100644
index 0fa3b5c8a..000000000
--- a/weaver5/java5-testsrc/test/A2AnnotatedType.java
+++ /dev/null
@@ -1,17 +0,0 @@
-/* *******************************************************************
- * 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/weaver5/java5-testsrc/test/A3.java b/weaver5/java5-testsrc/test/A3.java
deleted file mode 100644
index ab54388ae..000000000
--- a/weaver5/java5-testsrc/test/A3.java
+++ /dev/null
@@ -1,19 +0,0 @@
-/* *******************************************************************
- * 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/weaver5/java5-testsrc/test/AnnoValues.java b/weaver5/java5-testsrc/test/AnnoValues.java
deleted file mode 100644
index 08301d1a0..000000000
--- a/weaver5/java5-testsrc/test/AnnoValues.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/* *******************************************************************
- * 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/weaver5/java5-testsrc/test/Color.java b/weaver5/java5-testsrc/test/Color.java
deleted file mode 100644
index dea2593ac..000000000
--- a/weaver5/java5-testsrc/test/Color.java
+++ /dev/null
@@ -1,14 +0,0 @@
-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/weaver5/testdata/logging.properties b/weaver5/testdata/logging.properties
deleted file mode 100644
index b65bfeaa5..000000000
--- a/weaver5/testdata/logging.properties
+++ /dev/null
@@ -1,60 +0,0 @@
-############################################################
-# 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/weaver5/testsrc/org/aspectj/weaver/Weaver5ModuleTests.java b/weaver5/testsrc/org/aspectj/weaver/Weaver5ModuleTests.java
deleted file mode 100644
index 96bc6d007..000000000
--- a/weaver5/testsrc/org/aspectj/weaver/Weaver5ModuleTests.java
+++ /dev/null
@@ -1,37 +0,0 @@
-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()});
- }
-
-}