From ed85c8869de16ef225b5a98610095782b9c9e6be Mon Sep 17 00:00:00 2001 From: aclement Date: Wed, 23 Nov 2005 09:21:36 +0000 Subject: [PATCH] fixes for pr115788. --- .../compiler/lookup/EclipseFactory.java | 31 +++++++++++++------ .../compiler/problem/AjProblemReporter.java | 13 ++++++++ 2 files changed, 35 insertions(+), 9 deletions(-) diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseFactory.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseFactory.java index 6d7b75480..f87d388e4 100644 --- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseFactory.java +++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseFactory.java @@ -81,7 +81,10 @@ public class EclipseFactory { private boolean xSerializableAspects; private World world; + // We can get clashes if we don't treat raw types differently - we end up looking + // up a raw and getting the generic type (pr115788) private Map/*UnresolvedType, TypeBinding*/ typexToBinding = new HashMap(); + private Map/*UnresolvedType, TypeBinding*/ rawTypeXToBinding = new HashMap(); //XXX currently unused // private Map/*TypeBinding, ResolvedType*/ bindingToResolvedTypeX = new HashMap(); @@ -447,7 +450,7 @@ public class EclipseFactory { public ResolvedMember makeResolvedMember(MethodBinding binding) { return makeResolvedMember(binding, binding.declaringClass); } - + public ResolvedMember makeResolvedMember(MethodBinding binding, Shadow.Kind shadowKind) { Member.Kind memberKind = binding.isConstructor() ? Member.CONSTRUCTOR : Member.METHOD; if (shadowKind == Shadow.AdviceExecution) memberKind = Member.ADVICE; @@ -486,7 +489,7 @@ public class EclipseFactory { } return result; } - + public ResolvedMember makeResolvedMember(MethodBinding binding, TypeBinding declaringType) { return makeResolvedMember(binding,declaringType, binding.isConstructor() ? Member.CONSTRUCTOR : Member.METHOD); @@ -556,21 +559,31 @@ public class EclipseFactory { TypeBinding ret = null; // looking up type variables can get us into trouble - if (!typeX.isTypeVariableReference()) - ret = (TypeBinding)typexToBinding.get(typeX); - + if (!typeX.isTypeVariableReference()) { + if (typeX.isRawType()) { + ret = (TypeBinding)rawTypeXToBinding.get(typeX); + } else { + ret = (TypeBinding)typexToBinding.get(typeX); + } + } + if (ret == null) { ret = makeTypeBinding1(typeX); - // FIXME asc keep type variables *out* of the map for now, they go in typeVariableToTypeBinding - if (!(typeX instanceof BoundedReferenceType) && !(typeX instanceof UnresolvedTypeVariableReferenceType)) - typexToBinding.put(typeX, ret); + if (!(typeX instanceof BoundedReferenceType) && + !(typeX instanceof UnresolvedTypeVariableReferenceType) + ) { + if (typeX.isRawType()) { + rawTypeXToBinding.put(typeX,ret); + } else { + typexToBinding.put(typeX, ret); + } + } } if (ret == null) { System.out.println("can't find: " + typeX); } return ret; } - // When converting a parameterized type from our world to the eclipse world, these get set so that // resolution of the type parameters may known in what context it is occurring (pr114744) private ReferenceBinding baseTypeForParameterizedType; diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/problem/AjProblemReporter.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/problem/AjProblemReporter.java index 4cacecc36..5817b50ef 100644 --- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/problem/AjProblemReporter.java +++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/problem/AjProblemReporter.java @@ -434,6 +434,19 @@ public class AjProblemReporter extends ProblemReporter { super.finalMethodCannotBeOverridden(currentMethod, inheritedMethod); } + /** + * The method verifier is a bit 'keen' and doesn't cope well with ITDMs which are + * of course to be considered a 'default' implementation if the target type doesn't + * supply one. This test may not be complete - it is possible that it should read if + * *either* is an ITD...but I dont have a testcase that shows that is required. yet. + * (pr115788) + */ + public void duplicateInheritedMethods(SourceTypeBinding type, MethodBinding inheritedMethod1, MethodBinding inheritedMethod2) { + if (!(inheritedMethod1 instanceof InterTypeMethodBinding && + inheritedMethod2 instanceof InterTypeMethodBinding)) + super.duplicateInheritedMethods(type,inheritedMethod1,inheritedMethod2); + } + /** * All problems end up routed through here at some point... */ -- 2.39.5