From f7ae7fb012e540252ff03e1a8e1dff022fb19027 Mon Sep 17 00:00:00 2001 From: Andy Clement Date: Thu, 23 Apr 2015 12:22:23 -0700 Subject: [PATCH] weaving generic types --- .../compiler/lookup/AjLookupEnvironment.java | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/AjLookupEnvironment.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/AjLookupEnvironment.java index 49b0f7371..7a27b709a 100644 --- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/AjLookupEnvironment.java +++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/AjLookupEnvironment.java @@ -1314,6 +1314,28 @@ public class AjLookupEnvironment extends LookupEnvironment implements AnonymousC // methods against in the verifier rather than compareTo(Object) if (!factory.getWorld().isInJava5Mode()) { parentBinding = (ReferenceBinding)convertToRawType(parentBinding, false /*do not force conversion of enclosing types*/); + } else if (sourceType.isGenericType()) { + RawTypeBinding rawTargetType = (RawTypeBinding)convertToRawType(sourceType, false); + if (rawTargetType != null) { + // assert: don't need to 'rememberTypeHierarchy' because the class file is constructed based on the generic type + if (parentBinding.isClass()) { + rawTargetType.superclass = parentBinding; + } else { + ReferenceBinding[] oldI = rawTargetType.superInterfaces; + ReferenceBinding[] newI; + if (oldI == null) { + newI = new ReferenceBinding[1]; + newI[0] = parentBinding; + } else { + int n = oldI.length; + newI = new ReferenceBinding[n + 1]; + System.arraycopy(oldI, 0, newI, 0, n); + newI[n] = parentBinding; + } + rawTargetType.superInterfaces = newI; + } + } + // TODO what about parameterized types? } sourceType.rememberTypeHierarchy(); if (parentBinding.isClass()) { -- 2.39.5