]> source.dussan.org Git - aspectj.git/commitdiff
Add a debug flag to workaround issue until we can sort it (565713)
authorAndy Clement <aclement@pivotal.io>
Mon, 10 Aug 2020 23:13:20 +0000 (16:13 -0700)
committerAndy Clement <aclement@pivotal.io>
Mon, 10 Aug 2020 23:13:20 +0000 (16:13 -0700)
org.aspectj.matcher/src/main/java/org/aspectj/weaver/AbstractReferenceTypeDelegate.java

index 7f3fb60ee4f3e0ccdf4a44842e229ba5c10f2a89..bc4c219f23e0ab4630a87c35a23e6734231470c7 100644 (file)
@@ -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;
        }