diff options
author | acolyer <acolyer> | 2005-07-11 09:37:21 +0000 |
---|---|---|
committer | acolyer <acolyer> | 2005-07-11 09:37:21 +0000 |
commit | b5ad17eebeb1b8baf6748ba0125219a15a8925e2 (patch) | |
tree | 9ad986ba0535178d64ca17a98ce19692491dcb4a /weaver/testsrc/org | |
parent | fe565243724dd55fe727d567eb41ae1c740d97e2 (diff) | |
download | aspectj-b5ad17eebeb1b8baf6748ba0125219a15a8925e2.tar.gz aspectj-b5ad17eebeb1b8baf6748ba0125219a15a8925e2.zip |
test case for Enum conversions
Diffstat (limited to 'weaver/testsrc/org')
-rw-r--r-- | weaver/testsrc/org/aspectj/weaver/bcel/BcelGenericSignatureToTypeXTestCase.java | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/weaver/testsrc/org/aspectj/weaver/bcel/BcelGenericSignatureToTypeXTestCase.java b/weaver/testsrc/org/aspectj/weaver/bcel/BcelGenericSignatureToTypeXTestCase.java new file mode 100644 index 000000000..241d939cb --- /dev/null +++ b/weaver/testsrc/org/aspectj/weaver/bcel/BcelGenericSignatureToTypeXTestCase.java @@ -0,0 +1,73 @@ +/* ******************************************************************* + * 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 org.aspectj.apache.bcel.Repository; +import org.aspectj.apache.bcel.classfile.GenericSignatureParser; +import org.aspectj.apache.bcel.classfile.JavaClass; +import org.aspectj.apache.bcel.classfile.Signature; +import org.aspectj.weaver.ResolvedTypeX; +import org.aspectj.weaver.TypeVariable; +import org.aspectj.weaver.TypeX; + +import junit.framework.TestCase; + +/** + * @author colyer + * + */ +public class BcelGenericSignatureToTypeXTestCase extends TestCase { + + public void testEnumFromHell() { + BcelWorld world = new BcelWorld(); + JavaClass javaLangEnum = Repository.lookupClass("java/lang/Enum"); + Signature.ClassSignature cSig = javaLangEnum.getGenericClassTypeSignature(); + TypeX superclass = + BcelGenericSignatureToTypeXConverter.classTypeSignature2TypeX( + cSig.superclassSignature, + cSig.formalTypeParameters, + world + ); + assertEquals("Ljava/lang/Object;",superclass.getSignature()); + assertEquals("2 superinterfaces",2,cSig.superInterfaceSignatures.length); + TypeX comparable = + BcelGenericSignatureToTypeXConverter.classTypeSignature2TypeX( + cSig.superInterfaceSignatures[0], + cSig.formalTypeParameters, + world + ); + assertEquals("Ljava/lang/Comparable<Ljava/lang/Enum<Ljava/lang/Object;>;>;",comparable.getSignature()); + TypeX serializable = + BcelGenericSignatureToTypeXConverter.classTypeSignature2TypeX( + cSig.superInterfaceSignatures[1], + cSig.formalTypeParameters, + world + ); + assertEquals("Ljava/io/Serializable;",serializable.getSignature()); + } + + public void testInners() { + BcelWorld world = new BcelWorld(); + Signature.ClassSignature cSig = new GenericSignatureParser().parseAsClassSignature("<T::LBase$Inner;>Ljava/lang/Object;LBase<TT;>;"); + TypeX resolved = BcelGenericSignatureToTypeXConverter.classTypeSignature2TypeX( + cSig.superclassSignature, + cSig.formalTypeParameters, + world); + assertEquals("Ljava/lang/Object;",resolved.getSignature()); + TypeX resolvedInt = BcelGenericSignatureToTypeXConverter.classTypeSignature2TypeX( + cSig.superInterfaceSignatures[0], + cSig.formalTypeParameters, + world); + + } + +} |