From cacc9d5602b7bbe6192d5ff1351605dc180cc108 Mon Sep 17 00:00:00 2001 From: Andy Clement Date: Mon, 10 Aug 2020 16:13:20 -0700 Subject: [PATCH] Add a debug flag to workaround issue until we can sort it (565713) --- .../weaver/AbstractReferenceTypeDelegate.java | 50 +++++++++++++------ 1 file changed, 35 insertions(+), 15 deletions(-) diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/AbstractReferenceTypeDelegate.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/AbstractReferenceTypeDelegate.java index 7f3fb60ee..bc4c219f2 100644 --- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/AbstractReferenceTypeDelegate.java +++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/AbstractReferenceTypeDelegate.java @@ -1,13 +1,13 @@ /* ******************************************************************* * Copyright (c) 2002 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 + * 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 * Andy Clement - June 2005 - separated out from ResolvedType * ******************************************************************/ package org.aspectj.weaver; @@ -18,6 +18,7 @@ import java.util.List; import org.aspectj.bridge.ISourceLocation; import org.aspectj.util.GenericSignature; import org.aspectj.util.GenericSignature.ClassSignature; +import org.aspectj.util.GenericSignature.FormalTypeParameter; import org.aspectj.util.GenericSignatureParser; import org.aspectj.weaver.AjAttribute.WeaverVersionInfo; @@ -38,10 +39,12 @@ public abstract class AbstractReferenceTypeDelegate implements ReferenceTypeDele this.exposedToWeaver = exposedToWeaver; } + @Override public final boolean isClass() { return !isAspect() && !isInterface(); } + @Override public boolean isCacheable() { return false; } @@ -49,18 +52,22 @@ public abstract class AbstractReferenceTypeDelegate implements ReferenceTypeDele /** * Designed to be overriden by EclipseType to disable collection of shadow mungers during pre-weave compilation phase */ + @Override public boolean doesNotExposeShadowMungers() { return false; } + @Override public boolean isExposedToWeaver() { return exposedToWeaver; } + @Override public ReferenceType getResolvedTypeX() { return resolvedTypeX; } + @Override public final String getSourcefilename() { return sourcefilename; } @@ -84,6 +91,7 @@ public abstract class AbstractReferenceTypeDelegate implements ReferenceTypeDele return getSourceContext().makeSourceLocation(0, 0); } + @Override public ISourceContext getSourceContext() { return sourceContext; } @@ -110,9 +118,16 @@ public abstract class AbstractReferenceTypeDelegate implements ReferenceTypeDele if (outerClassType == null) { return GenericSignature.FormalTypeParameter.NONE; } else { - throw new BCException("Whilst processing type '" + this.resolvedTypeX.getSignature() - + "' - cannot cast the outer type to a reference type. Signature=" + outerClassType.getSignature() - + " toString()=" + outerClassType.toString()+" class=" + outerClassType.getClassName()); + if (System.getProperty("aspectj.debug565713","false").toLowerCase().equals("true")) { + System.out.println("DEBUG 565713: Whilst processing type '" + this.resolvedTypeX.getSignature()+ + "' - cannot cast the outer type to a reference type. Signature=" + outerClassType.getSignature() + + " toString()=" + outerClassType.toString()+" class=" + outerClassType.getClassName()); + return GenericSignature.FormalTypeParameter.NONE; + } else { + throw new BCException("Whilst processing type '" + this.resolvedTypeX.getSignature() + + "' - cannot cast the outer type to a reference type. Signature=" + outerClassType.getSignature() + + " toString()=" + outerClassType.toString()+" class=" + outerClassType.getClassName()); + } } } ReferenceType outer = (ReferenceType) outerClassType; @@ -120,14 +135,14 @@ public abstract class AbstractReferenceTypeDelegate implements ReferenceTypeDele AbstractReferenceTypeDelegate outerObjectType = (AbstractReferenceTypeDelegate) outerDelegate; if (outerObjectType.isNested()) { GenericSignature.FormalTypeParameter[] parentParams = outerObjectType.getFormalTypeParametersFromOuterClass(); - for (int i = 0; i < parentParams.length; i++) { - typeParameters.add(parentParams[i]); + for (FormalTypeParameter parentParam : parentParams) { + typeParameters.add(parentParam); } } GenericSignature.ClassSignature outerSig = outerObjectType.getGenericClassTypeSignature(); if (outerSig != null) { - for (int i = 0; i < outerSig.formalTypeParameters.length; i++) { - typeParameters.add(outerSig.formalTypeParameters[i]); + for (FormalTypeParameter formalTypeParameter : outerSig.formalTypeParameters) { + typeParameters.add(formalTypeParameter); } } @@ -136,22 +151,27 @@ public abstract class AbstractReferenceTypeDelegate implements ReferenceTypeDele return ret; } + @Override public boolean copySourceContext() { return true; } + @Override public int getCompilerVersion() { return WeaverVersionInfo.getCurrentWeaverMajorVersion(); } + @Override public void ensureConsistent() { } + @Override public boolean isWeavable() { return false; } + @Override public boolean hasBeenWoven() { return false; } -- 2.39.5