From b468ecc0132d75fdade0c403f78d99212342176d Mon Sep 17 00:00:00 2001 From: acolyer Date: Mon, 11 Jul 2005 13:50:39 +0000 Subject: [PATCH] add unresolved TypeVariableRefTypes which are created by EclipseFactory during conversion of bindings to TypeX, and resolved to TypeVariableReferenceTypes by the world. --- .../UnresolvedTypeVariableReferenceType.java | 44 +++++++++++++++++++ weaver/src/org/aspectj/weaver/World.java | 4 ++ 2 files changed, 48 insertions(+) create mode 100644 weaver/src/org/aspectj/weaver/UnresolvedTypeVariableReferenceType.java diff --git a/weaver/src/org/aspectj/weaver/UnresolvedTypeVariableReferenceType.java b/weaver/src/org/aspectj/weaver/UnresolvedTypeVariableReferenceType.java new file mode 100644 index 000000000..b33b100b8 --- /dev/null +++ b/weaver/src/org/aspectj/weaver/UnresolvedTypeVariableReferenceType.java @@ -0,0 +1,44 @@ +/* ******************************************************************* + * 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; + +/** + * @author colyer + * Represents a type variable encountered in the Eclipse Source world, + * which when resolved will turn into a TypeVariableReferenceType + */ +public class UnresolvedTypeVariableReferenceType extends TypeX { + + private TypeVariable typeVariable; + + // constructor used as place-holder when dealing with circular refs such as Enum + public UnresolvedTypeVariableReferenceType() { + super("Ljava/lang/Object;"); + } + + public UnresolvedTypeVariableReferenceType(TypeVariable aTypeVariable) { + super(aTypeVariable.getUpperBound().getSignature()); + this.typeVariable = aTypeVariable; + } + + // only used when resolving circular refs... + public void setTypeVariable(TypeVariable aTypeVariable) { + this.signature = aTypeVariable.getUpperBound().getSignature(); + this.typeVariable = aTypeVariable; + } + + public ResolvedTypeX resolve(World world) { + typeVariable.resolve(world); + return new TypeVariableReferenceType(typeVariable,world); + } + +} diff --git a/weaver/src/org/aspectj/weaver/World.java b/weaver/src/org/aspectj/weaver/World.java index 2bfda6c54..4efa5fe65 100644 --- a/weaver/src/org/aspectj/weaver/World.java +++ b/weaver/src/org/aspectj/weaver/World.java @@ -157,6 +157,10 @@ public abstract class World implements Dump.INode { public ResolvedTypeX resolve(TypeX ty, boolean allowMissing) { //System.out.println("resolve: " + ty + " world " + typeMap.keySet()); + if (ty instanceof UnresolvedTypeVariableReferenceType) { + // AMC - don't like this instanceof test, suggests some refactoring needed... + return ((UnresolvedTypeVariableReferenceType)ty).resolve(this); + } String signature = ty.getSignature(); ResolvedTypeX ret = typeMap.get(signature); if (ret != null) { ret.world = this; return ret; } // Set the world for the RTX -- 2.39.5