issue_id
int64
2.04k
425k
title
stringlengths
9
251
body
stringlengths
4
32.8k
status
stringclasses
6 values
after_fix_sha
stringlengths
7
7
project_name
stringclasses
6 values
repo_url
stringclasses
6 values
repo_name
stringclasses
6 values
language
stringclasses
1 value
issue_url
null
before_fix_sha
null
pull_url
null
commit_datetime
timestamp[us, tz=UTC]
report_datetime
timestamp[us, tz=UTC]
updated_file
stringlengths
23
187
chunk_content
stringlengths
1
22k
353,349
Bug 353349 NPE in deleteNewAndDup
java.lang.NullPointerException at org.aspectj.weaver.bcel.BcelShadow.deleteNewAndDup(BcelShadow.java:179) at org.aspectj.weaver.bcel.BcelShadow.prepareForMungers(BcelShadow.java:303) at org.aspectj.weaver.Shadow.implement(Shadow.java:543) at org.aspectj.weaver.bcel.BcelClassWeaver.implement(BcelClassWeaver.java:3147) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:490) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:100) at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1687) at org.aspectj.weaver.bcel.BcelWeaver.weaveWithoutDump(BcelWeaver.java:1631) at org.aspectj.weaver.bcel.BcelWeaver.weaveAndNotify(BcelWeaver.java:1394) at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1180) at org.aspectj.weaver.tools.WeavingAdaptor.getWovenBytes(WeavingAdaptor.java:467) at org.aspectj.weaver.tools.WeavingAdaptor.weaveClass(WeavingAdaptor.java:318) at org.aspectj.weaver.loadtime.Aj.preProcess(Aj.java:96)
resolved fixed
e8ef5bf
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-07-28T20:48:42Z
2011-07-28T19:06:40Z
weaver/src/org/aspectj/weaver/bcel/BcelShadow.java
return new BcelVar(typeX.resolve(world), genTempVarIndex(typeX.getSize())); } public BcelVar genTempVar(UnresolvedType typeX, String localName) { BcelVar tv = genTempVar(typeX); return tv; } private int genTempVarIndex(int size) { return enclosingMethod.allocateLocal(size); } public InstructionFactory getFactory() { return getEnclosingClass().getFactory(); } @Override public ISourceLocation getSourceLocation() { int sourceLine = getSourceLine(); if (sourceLine == 0 || sourceLine == -1) { return getEnclosingClass().getType().getSourceLocation(); } else { if (getKind() == Shadow.StaticInitialization && getEnclosingClass().getType().getSourceLocation().getOffset() != 0) {
353,349
Bug 353349 NPE in deleteNewAndDup
java.lang.NullPointerException at org.aspectj.weaver.bcel.BcelShadow.deleteNewAndDup(BcelShadow.java:179) at org.aspectj.weaver.bcel.BcelShadow.prepareForMungers(BcelShadow.java:303) at org.aspectj.weaver.Shadow.implement(Shadow.java:543) at org.aspectj.weaver.bcel.BcelClassWeaver.implement(BcelClassWeaver.java:3147) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:490) at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:100) at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1687) at org.aspectj.weaver.bcel.BcelWeaver.weaveWithoutDump(BcelWeaver.java:1631) at org.aspectj.weaver.bcel.BcelWeaver.weaveAndNotify(BcelWeaver.java:1394) at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1180) at org.aspectj.weaver.tools.WeavingAdaptor.getWovenBytes(WeavingAdaptor.java:467) at org.aspectj.weaver.tools.WeavingAdaptor.weaveClass(WeavingAdaptor.java:318) at org.aspectj.weaver.loadtime.Aj.preProcess(Aj.java:96)
resolved fixed
e8ef5bf
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-07-28T20:48:42Z
2011-07-28T19:06:40Z
weaver/src/org/aspectj/weaver/bcel/BcelShadow.java
return getEnclosingClass().getType().getSourceLocation(); } else { int offset = 0; Kind kind = getKind(); if ((kind == MethodExecution) || (kind == ConstructorExecution) || (kind == AdviceExecution) || (kind == StaticInitialization) || (kind == PreInitialization) || (kind == Initialization)) { if (getEnclosingMethod().hasDeclaredLineNumberInfo()) { offset = getEnclosingMethod().getDeclarationOffset(); } } return getEnclosingClass().getType().getSourceContext().makeSourceLocation(sourceLine, offset); } } } public Shadow getEnclosingShadow() { return enclosingShadow; } public LazyMethodGen getEnclosingMethod() { return enclosingMethod; } public boolean isFallsThrough() { return !terminatesWithReturn(); } public void setActualTargetType(String className) { this.actualInstructionTargetType = className; } public String getActualTargetType() { return actualInstructionTargetType; } }
340,806
Bug 340806 Race condition in JavaLangTypeToResolvedTypeConverter (potentially exposed through Spring AOP)
null
resolved fixed
167b801
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-08-03T20:22:40Z
2011-03-23T19:53:20Z
weaver5/java5-src/org/aspectj/weaver/reflect/JavaLangTypeToResolvedTypeConverter.java
/* ******************************************************************* * 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:
340,806
Bug 340806 Race condition in JavaLangTypeToResolvedTypeConverter (potentially exposed through Spring AOP)
null
resolved fixed
167b801
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-08-03T20:22:40Z
2011-03-23T19:53:20Z
weaver5/java5-src/org/aspectj/weaver/reflect/JavaLangTypeToResolvedTypeConverter.java
* Adrian Colyer Initial implementation * ******************************************************************/ package org.aspectj.weaver.reflect; import java.lang.reflect.GenericArrayType; import java.lang.reflect.ParameterizedType; import java.lang.reflect.Type; import java.lang.reflect.WildcardType; import java.util.HashMap; import java.util.Map; import org.aspectj.weaver.BoundedReferenceType; import org.aspectj.weaver.ReferenceType; import org.aspectj.weaver.ResolvedType; import org.aspectj.weaver.TypeFactory; import org.aspectj.weaver.TypeVariable; import org.aspectj.weaver.TypeVariableReferenceType; import org.aspectj.weaver.UnresolvedType; import org.aspectj.weaver.World; /** * Handles the translation of java.lang.reflect.Type objects into AspectJ UnresolvedTypes. * */ public class JavaLangTypeToResolvedTypeConverter { private Map<Type, TypeVariableReferenceType> typeVariablesInProgress = new HashMap<Type, TypeVariableReferenceType>(); private final World world; public JavaLangTypeToResolvedTypeConverter(World aWorld) { this.world = aWorld; } private World getWorld() { return this.world;
340,806
Bug 340806 Race condition in JavaLangTypeToResolvedTypeConverter (potentially exposed through Spring AOP)
null
resolved fixed
167b801
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-08-03T20:22:40Z
2011-03-23T19:53:20Z
weaver5/java5-src/org/aspectj/weaver/reflect/JavaLangTypeToResolvedTypeConverter.java
} public ResolvedType fromType(Type aType) { if (aType instanceof Class) { Class clazz = (Class) aType; String name = clazz.getName(); /** * getName() can return: * * 1. If this class object represents a reference type that is not an array type then the binary name of the class is * returned 2. If this class object represents a primitive type or void, then the name returned is a String equal to the * Java language keyword corresponding to the primitive type or void. 3. If this class object represents a class of * arrays, then the internal form of the name consists of the name of the element type preceded by one or more '[' * characters representing the depth of the array nesting. */ if (clazz.isArray()) { UnresolvedType ut = UnresolvedType.forSignature(name.replace('.', '/')); return getWorld().resolve(ut); } else { return getWorld().resolve(name); } } else if (aType instanceof ParameterizedType) { ParameterizedType pt = (ParameterizedType) aType; ResolvedType baseType = fromType(pt.getRawType()); Type[] args = pt.getActualTypeArguments(); ResolvedType[] resolvedArgs = fromTypes(args); /* StringBuilder sb = new StringBuilder(); for (int i = 0; i < resolvedArgs.length; i++) { sb.append(resolvedArgs[i]).append(" "); } for (int i = 0; i < resolvedArgs.length; i++) {
340,806
Bug 340806 Race condition in JavaLangTypeToResolvedTypeConverter (potentially exposed through Spring AOP)
null
resolved fixed
167b801
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-08-03T20:22:40Z
2011-03-23T19:53:20Z
weaver5/java5-src/org/aspectj/weaver/reflect/JavaLangTypeToResolvedTypeConverter.java
if (resolvedArgs[i] == null) { String ss = ""; try { ss = aType.toString(); } catch (Exception e) { } throw new IllegalStateException("Parameterized type problem. basetype=" + baseType + " arguments=" + sb.toString() + " ss=" + ss); } } */ return TypeFactory.createParameterizedType(baseType, resolvedArgs, getWorld()); } else if (aType instanceof java.lang.reflect.TypeVariable) { if (typeVariablesInProgress.get(aType) != null) { return typeVariablesInProgress.get(aType); } java.lang.reflect.TypeVariable tv = (java.lang.reflect.TypeVariable) aType; TypeVariable rt_tv = new TypeVariable(tv.getName()); TypeVariableReferenceType tvrt = new TypeVariableReferenceType(rt_tv, getWorld()); typeVariablesInProgress.put(aType, tvrt); Type[] bounds = tv.getBounds(); ResolvedType[] resBounds = fromTypes(bounds); ResolvedType upperBound = resBounds[0]; ResolvedType[] additionalBounds = new ResolvedType[0]; if (resBounds.length > 1) { additionalBounds = new ResolvedType[resBounds.length - 1]; System.arraycopy(resBounds, 1, additionalBounds, 0, additionalBounds.length); } rt_tv.setUpperBound(upperBound); rt_tv.setAdditionalInterfaceBounds(additionalBounds);
340,806
Bug 340806 Race condition in JavaLangTypeToResolvedTypeConverter (potentially exposed through Spring AOP)
null
resolved fixed
167b801
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-08-03T20:22:40Z
2011-03-23T19:53:20Z
weaver5/java5-src/org/aspectj/weaver/reflect/JavaLangTypeToResolvedTypeConverter.java
typeVariablesInProgress.remove(aType); return tvrt; } else if (aType instanceof WildcardType) { WildcardType wildType = (WildcardType) aType; Type[] lowerBounds = wildType.getLowerBounds(); Type[] upperBounds = wildType.getUpperBounds(); ResolvedType bound = null; boolean isExtends = lowerBounds.length == 0; if (isExtends) { bound = fromType(upperBounds[0]); } else { bound = fromType(lowerBounds[0]); } return new BoundedReferenceType((ReferenceType) bound, isExtends, getWorld()); } else if (aType instanceof GenericArrayType) { GenericArrayType gt = (GenericArrayType) aType; Type componentType = gt.getGenericComponentType(); return UnresolvedType.makeArray(fromType(componentType), 1).resolve(getWorld()); } return ResolvedType.MISSING; } public ResolvedType[] fromTypes(Type[] types) { ResolvedType[] ret = new ResolvedType[types.length]; for (int i = 0; i < ret.length; i++) { ret[i] = fromType(types[i]); } return ret; } }
354,022
Bug 354022 constructor inlining can fail for some groovy built code
The file grails.util.BuildSettings contains bytecode where the constructors are recursive. You can't compile this in Java A() { this(); } but groovy generates some code where it switches on a value in the ctor and if it is a certain value, the recursive ctor call is made. I imagine this 'never happens' in practice but because it is in the bytecode it trips up the AspectJ code which inlines this() calls before weaving - since it gets into an infinite loop. For now, just keep track of ctors making the recursive call and so don't get trapped in the infinite loop.
resolved fixed
6ae463a
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-08-05T16:17:39Z
2011-08-05T16:00:00Z
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
/* ******************************************************************* * Copyright (c) 2002 Palo Alto Research Center, Incorporated (PARC). * 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 * ******************************************************************/ package org.aspectj.weaver.bcel; import java.lang.reflect.Modifier; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.LinkedHashSet; import java.util.List; import java.util.Map; import java.util.Properties; import java.util.Set; import org.aspectj.apache.bcel.Constants; import org.aspectj.apache.bcel.classfile.ConstantPool; import org.aspectj.apache.bcel.classfile.Method; import org.aspectj.apache.bcel.classfile.annotation.AnnotationGen;
354,022
Bug 354022 constructor inlining can fail for some groovy built code
The file grails.util.BuildSettings contains bytecode where the constructors are recursive. You can't compile this in Java A() { this(); } but groovy generates some code where it switches on a value in the ctor and if it is a certain value, the recursive ctor call is made. I imagine this 'never happens' in practice but because it is in the bytecode it trips up the AspectJ code which inlines this() calls before weaving - since it gets into an infinite loop. For now, just keep track of ctors making the recursive call and so don't get trapped in the infinite loop.
resolved fixed
6ae463a
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-08-05T16:17:39Z
2011-08-05T16:00:00Z
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
import org.aspectj.apache.bcel.generic.FieldGen; import org.aspectj.apache.bcel.generic.FieldInstruction; import org.aspectj.apache.bcel.generic.Instruction; import org.aspectj.apache.bcel.generic.InstructionBranch; import org.aspectj.apache.bcel.generic.InstructionCP; import org.aspectj.apache.bcel.generic.InstructionConstants; import org.aspectj.apache.bcel.generic.InstructionFactory; import org.aspectj.apache.bcel.generic.InstructionHandle; import org.aspectj.apache.bcel.generic.InstructionLV; import org.aspectj.apache.bcel.generic.InstructionList; import org.aspectj.apache.bcel.generic.InstructionSelect; import org.aspectj.apache.bcel.generic.InstructionTargeter; import org.aspectj.apache.bcel.generic.InvokeInstruction; import org.aspectj.apache.bcel.generic.LineNumberTag; import org.aspectj.apache.bcel.generic.LocalVariableTag; import org.aspectj.apache.bcel.generic.MULTIANEWARRAY; import org.aspectj.apache.bcel.generic.MethodGen; import org.aspectj.apache.bcel.generic.ObjectType; import org.aspectj.apache.bcel.generic.RET; import org.aspectj.apache.bcel.generic.Tag; import org.aspectj.apache.bcel.generic.Type; import org.aspectj.asm.AsmManager; import org.aspectj.bridge.IMessage; import org.aspectj.bridge.ISourceLocation; import org.aspectj.bridge.Message; import org.aspectj.bridge.MessageUtil; import org.aspectj.bridge.WeaveMessage; import org.aspectj.bridge.context.CompilationAndWeavingContext; import org.aspectj.bridge.context.ContextToken; import org.aspectj.util.PartialOrder;
354,022
Bug 354022 constructor inlining can fail for some groovy built code
The file grails.util.BuildSettings contains bytecode where the constructors are recursive. You can't compile this in Java A() { this(); } but groovy generates some code where it switches on a value in the ctor and if it is a certain value, the recursive ctor call is made. I imagine this 'never happens' in practice but because it is in the bytecode it trips up the AspectJ code which inlines this() calls before weaving - since it gets into an infinite loop. For now, just keep track of ctors making the recursive call and so don't get trapped in the infinite loop.
resolved fixed
6ae463a
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-08-05T16:17:39Z
2011-08-05T16:00:00Z
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
import org.aspectj.weaver.AjAttribute; import org.aspectj.weaver.AjcMemberMaker; import org.aspectj.weaver.AnnotationAJ; import org.aspectj.weaver.BCException; import org.aspectj.weaver.ConcreteTypeMunger; import org.aspectj.weaver.IClassWeaver; import org.aspectj.weaver.IntMap; import org.aspectj.weaver.Member; import org.aspectj.weaver.MissingResolvedTypeWithKnownSignature; import org.aspectj.weaver.NameMangler; import org.aspectj.weaver.NewConstructorTypeMunger; import org.aspectj.weaver.NewFieldTypeMunger; import org.aspectj.weaver.NewMethodTypeMunger; import org.aspectj.weaver.ResolvedMember; import org.aspectj.weaver.ResolvedMemberImpl; import org.aspectj.weaver.ResolvedType; import org.aspectj.weaver.ResolvedTypeMunger; import org.aspectj.weaver.Shadow; import org.aspectj.weaver.ShadowMunger; import org.aspectj.weaver.UnresolvedType; import org.aspectj.weaver.UnresolvedTypeVariableReferenceType; import org.aspectj.weaver.WeaverMessages; import org.aspectj.weaver.WeaverStateInfo; import org.aspectj.weaver.World; import org.aspectj.weaver.model.AsmRelationshipProvider; import org.aspectj.weaver.patterns.DeclareAnnotation; import org.aspectj.weaver.patterns.ExactTypePattern; import org.aspectj.weaver.tools.Trace; import org.aspectj.weaver.tools.TraceFactory; class BcelClassWeaver implements IClassWeaver {
354,022
Bug 354022 constructor inlining can fail for some groovy built code
The file grails.util.BuildSettings contains bytecode where the constructors are recursive. You can't compile this in Java A() { this(); } but groovy generates some code where it switches on a value in the ctor and if it is a certain value, the recursive ctor call is made. I imagine this 'never happens' in practice but because it is in the bytecode it trips up the AspectJ code which inlines this() calls before weaving - since it gets into an infinite loop. For now, just keep track of ctors making the recursive call and so don't get trapped in the infinite loop.
resolved fixed
6ae463a
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-08-05T16:17:39Z
2011-08-05T16:00:00Z
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
private static Trace trace = TraceFactory.getTraceFactory().getTrace(BcelClassWeaver.class); public static boolean weave(BcelWorld world, LazyClassGen clazz, List<ShadowMunger> shadowMungers, List<ConcreteTypeMunger> typeMungers, List<ConcreteTypeMunger> lateTypeMungers, boolean inReweavableMode) { BcelClassWeaver classWeaver = new BcelClassWeaver(world, clazz, shadowMungers, typeMungers, lateTypeMungers); classWeaver.setReweavableMode(inReweavableMode); boolean b = classWeaver.weave(); return b; } private final LazyClassGen clazz; private final List<ShadowMunger> shadowMungers; private final List<ConcreteTypeMunger> typeMungers; private final List<ConcreteTypeMunger> lateTypeMungers; private List<ShadowMunger>[] indexedShadowMungers; private boolean canMatchBodyShadows = false; private final BcelObjectType ty; private final BcelWorld world;
354,022
Bug 354022 constructor inlining can fail for some groovy built code
The file grails.util.BuildSettings contains bytecode where the constructors are recursive. You can't compile this in Java A() { this(); } but groovy generates some code where it switches on a value in the ctor and if it is a certain value, the recursive ctor call is made. I imagine this 'never happens' in practice but because it is in the bytecode it trips up the AspectJ code which inlines this() calls before weaving - since it gets into an infinite loop. For now, just keep track of ctors making the recursive call and so don't get trapped in the infinite loop.
resolved fixed
6ae463a
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-08-05T16:17:39Z
2011-08-05T16:00:00Z
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
private final ConstantPool cpg; private final InstructionFactory fact; private final List<LazyMethodGen> addedLazyMethodGens = new ArrayList<LazyMethodGen>(); private final Set<ResolvedMember> addedDispatchTargets = new HashSet<ResolvedMember>(); private boolean inReweavableMode = false; private List<IfaceInitList> addedSuperInitializersAsList = null; private final Map<ResolvedType, IfaceInitList> addedSuperInitializers = new HashMap<ResolvedType, IfaceInitList>(); private final List<ConcreteTypeMunger> addedThisInitializers = new ArrayList<ConcreteTypeMunger>(); private final List<ConcreteTypeMunger> addedClassInitializers = new ArrayList<ConcreteTypeMunger>(); private final Map<ResolvedMember, ResolvedType[]> mapToAnnotations = new HashMap<ResolvedMember, ResolvedType[]>(); /** * This holds the initialization and pre-initialization shadows for this class that were actually matched by mungers (if no * match, then we don't even create the shadows really). */ private final List<BcelShadow> initializationShadows = new ArrayList<BcelShadow>(); private BcelClassWeaver(BcelWorld world, LazyClassGen clazz, List<ShadowMunger> shadowMungers, List<ConcreteTypeMunger> typeMungers, List<ConcreteTypeMunger> lateTypeMungers) { super(); this.world = world; this.clazz = clazz; this.shadowMungers = shadowMungers; this.typeMungers = typeMungers; this.lateTypeMungers = lateTypeMungers; this.ty = clazz.getBcelObjectType(); this.cpg = clazz.getConstantPool(); this.fact = clazz.getFactory(); indexShadowMungers(); initializeSuperInitializerMap(ty.getResolvedTypeX()); if (!checkedXsetForLowLevelContextCapturing) {
354,022
Bug 354022 constructor inlining can fail for some groovy built code
The file grails.util.BuildSettings contains bytecode where the constructors are recursive. You can't compile this in Java A() { this(); } but groovy generates some code where it switches on a value in the ctor and if it is a certain value, the recursive ctor call is made. I imagine this 'never happens' in practice but because it is in the bytecode it trips up the AspectJ code which inlines this() calls before weaving - since it gets into an infinite loop. For now, just keep track of ctors making the recursive call and so don't get trapped in the infinite loop.
resolved fixed
6ae463a
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-08-05T16:17:39Z
2011-08-05T16:00:00Z
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
Properties p = world.getExtraConfiguration(); if (p != null) { String s = p.getProperty(World.xsetCAPTURE_ALL_CONTEXT, "false"); captureLowLevelContext = s.equalsIgnoreCase("true"); if (captureLowLevelContext) { world.getMessageHandler().handleMessage( MessageUtil.info("[" + World.xsetCAPTURE_ALL_CONTEXT + "=true] Enabling collection of low level context for debug/crash messages")); } } checkedXsetForLowLevelContextCapturing = true; } } private boolean canMatch(Shadow.Kind kind) { return indexedShadowMungers[kind.getKey()] != null; } private void initializeSuperInitializerMap(ResolvedType child) { ResolvedType[] superInterfaces = child.getDeclaredInterfaces(); for (int i = 0, len = superInterfaces.length; i < len; i++) {
354,022
Bug 354022 constructor inlining can fail for some groovy built code
The file grails.util.BuildSettings contains bytecode where the constructors are recursive. You can't compile this in Java A() { this(); } but groovy generates some code where it switches on a value in the ctor and if it is a certain value, the recursive ctor call is made. I imagine this 'never happens' in practice but because it is in the bytecode it trips up the AspectJ code which inlines this() calls before weaving - since it gets into an infinite loop. For now, just keep track of ctors making the recursive call and so don't get trapped in the infinite loop.
resolved fixed
6ae463a
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-08-05T16:17:39Z
2011-08-05T16:00:00Z
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
if (ty.getResolvedTypeX().isTopmostImplementor(superInterfaces[i])) { if (addSuperInitializer(superInterfaces[i])) { initializeSuperInitializerMap(superInterfaces[i]); } } } } /** * Process the shadow mungers into array 'buckets', each bucket represents a shadow kind and contains a list of shadowmungers * that could potentially apply at that shadow kind. */ private void indexShadowMungers() { indexedShadowMungers = new List[Shadow.MAX_SHADOW_KIND + 1]; for (ShadowMunger shadowMunger : shadowMungers) { int couldMatchKinds = shadowMunger.getPointcut().couldMatchKinds(); for (Shadow.Kind kind : Shadow.SHADOW_KINDS) { if (kind.isSet(couldMatchKinds)) { byte k = kind.getKey(); if (indexedShadowMungers[k] == null) { indexedShadowMungers[k] = new ArrayList<ShadowMunger>(); if (!kind.isEnclosingKind()) { canMatchBodyShadows = true; } } indexedShadowMungers[k].add(shadowMunger); } } } }
354,022
Bug 354022 constructor inlining can fail for some groovy built code
The file grails.util.BuildSettings contains bytecode where the constructors are recursive. You can't compile this in Java A() { this(); } but groovy generates some code where it switches on a value in the ctor and if it is a certain value, the recursive ctor call is made. I imagine this 'never happens' in practice but because it is in the bytecode it trips up the AspectJ code which inlines this() calls before weaving - since it gets into an infinite loop. For now, just keep track of ctors making the recursive call and so don't get trapped in the infinite loop.
resolved fixed
6ae463a
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-08-05T16:17:39Z
2011-08-05T16:00:00Z
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
private boolean addSuperInitializer(ResolvedType onType) { if (onType.isRawType() || onType.isParameterizedType()) { onType = onType.getGenericType(); } IfaceInitList l = addedSuperInitializers.get(onType); if (l != null) { return false; } l = new IfaceInitList(onType); addedSuperInitializers.put(onType, l); return true; } public void addInitializer(ConcreteTypeMunger cm) { NewFieldTypeMunger m = (NewFieldTypeMunger) cm.getMunger(); ResolvedType onType = m.getSignature().getDeclaringType().resolve(world); if (onType.isRawType()) { onType = onType.getGenericType(); } if (Modifier.isStatic(m.getSignature().getModifiers())) { addedClassInitializers.add(cm); } else { if (onType == ty.getResolvedTypeX()) { addedThisInitializers.add(cm); } else { IfaceInitList l = addedSuperInitializers.get(onType); l.list.add(cm); } } } private static class IfaceInitList implements PartialOrder.PartialComparable {
354,022
Bug 354022 constructor inlining can fail for some groovy built code
The file grails.util.BuildSettings contains bytecode where the constructors are recursive. You can't compile this in Java A() { this(); } but groovy generates some code where it switches on a value in the ctor and if it is a certain value, the recursive ctor call is made. I imagine this 'never happens' in practice but because it is in the bytecode it trips up the AspectJ code which inlines this() calls before weaving - since it gets into an infinite loop. For now, just keep track of ctors making the recursive call and so don't get trapped in the infinite loop.
resolved fixed
6ae463a
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-08-05T16:17:39Z
2011-08-05T16:00:00Z
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
final ResolvedType onType; List<ConcreteTypeMunger> list = new ArrayList<ConcreteTypeMunger>(); IfaceInitList(ResolvedType onType) { this.onType = onType; } public int compareTo(Object other) { IfaceInitList o = (IfaceInitList) other; if (onType.isAssignableFrom(o.onType)) { return +1; } else if (o.onType.isAssignableFrom(onType)) { return -1; } else { return 0; } }
354,022
Bug 354022 constructor inlining can fail for some groovy built code
The file grails.util.BuildSettings contains bytecode where the constructors are recursive. You can't compile this in Java A() { this(); } but groovy generates some code where it switches on a value in the ctor and if it is a certain value, the recursive ctor call is made. I imagine this 'never happens' in practice but because it is in the bytecode it trips up the AspectJ code which inlines this() calls before weaving - since it gets into an infinite loop. For now, just keep track of ctors making the recursive call and so don't get trapped in the infinite loop.
resolved fixed
6ae463a
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-08-05T16:17:39Z
2011-08-05T16:00:00Z
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
public int fallbackCompareTo(Object other) { return 0; } } public boolean addDispatchTarget(ResolvedMember m) { return addedDispatchTargets.add(m); } public void addLazyMethodGen(LazyMethodGen gen) { addedLazyMethodGens.add(gen); } public void addOrReplaceLazyMethodGen(LazyMethodGen mg) { if (alreadyDefined(clazz, mg)) { return; } for (Iterator<LazyMethodGen> i = addedLazyMethodGens.iterator(); i.hasNext();) { LazyMethodGen existing = i.next(); if (signaturesMatch(mg, existing)) { if (existing.definingType == null) { return; } else if (mg.definingType.isAssignableFrom(existing.definingType)) { return; } else if (existing.definingType.isAssignableFrom(mg.definingType)) { i.remove(); addedLazyMethodGens.add(mg); return; } else {
354,022
Bug 354022 constructor inlining can fail for some groovy built code
The file grails.util.BuildSettings contains bytecode where the constructors are recursive. You can't compile this in Java A() { this(); } but groovy generates some code where it switches on a value in the ctor and if it is a certain value, the recursive ctor call is made. I imagine this 'never happens' in practice but because it is in the bytecode it trips up the AspectJ code which inlines this() calls before weaving - since it gets into an infinite loop. For now, just keep track of ctors making the recursive call and so don't get trapped in the infinite loop.
resolved fixed
6ae463a
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-08-05T16:17:39Z
2011-08-05T16:00:00Z
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
throw new BCException("conflict between: " + mg + " and " + existing); } } } addedLazyMethodGens.add(mg); } private boolean alreadyDefined(LazyClassGen clazz, LazyMethodGen mg) { for (Iterator<LazyMethodGen> i = clazz.getMethodGens().iterator(); i.hasNext();) { LazyMethodGen existing = i.next(); if (signaturesMatch(mg, existing)) { if (!mg.isAbstract() && existing.isAbstract()) { i.remove(); return false; } return true; } } return false; } private boolean signaturesMatch(LazyMethodGen mg, LazyMethodGen existing) { return mg.getName().equals(existing.getName()) && mg.getSignature().equals(existing.getSignature()); } protected static LazyMethodGen makeBridgeMethod(LazyClassGen gen, ResolvedMember member) { int mods = member.getModifiers(); if (Modifier.isAbstract(mods)) { mods = mods - Modifier.ABSTRACT; } LazyMethodGen ret = new LazyMethodGen(mods, BcelWorld.makeBcelType(member.getReturnType()), member.getName(), BcelWorld.makeBcelTypes(member.getParameterTypes()), UnresolvedType.getNames(member.getExceptions()), gen);
354,022
Bug 354022 constructor inlining can fail for some groovy built code
The file grails.util.BuildSettings contains bytecode where the constructors are recursive. You can't compile this in Java A() { this(); } but groovy generates some code where it switches on a value in the ctor and if it is a certain value, the recursive ctor call is made. I imagine this 'never happens' in practice but because it is in the bytecode it trips up the AspectJ code which inlines this() calls before weaving - since it gets into an infinite loop. For now, just keep track of ctors making the recursive call and so don't get trapped in the infinite loop.
resolved fixed
6ae463a
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-08-05T16:17:39Z
2011-08-05T16:00:00Z
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
return ret; } /** * Create a single bridge method called 'theBridgeMethod' that bridges to 'whatToBridgeTo' */ private static void createBridgeMethod(BcelWorld world, LazyMethodGen whatToBridgeToMethodGen, LazyClassGen clazz, ResolvedMember theBridgeMethod) { InstructionList body; InstructionFactory fact; int pos = 0; ResolvedMember whatToBridgeTo = whatToBridgeToMethodGen.getMemberView(); if (whatToBridgeTo == null) { whatToBridgeTo = new ResolvedMemberImpl(Member.METHOD, whatToBridgeToMethodGen.getEnclosingClass().getType(), whatToBridgeToMethodGen.getAccessFlags(), whatToBridgeToMethodGen.getName(), whatToBridgeToMethodGen.getSignature()); } LazyMethodGen bridgeMethod = makeBridgeMethod(clazz, theBridgeMethod); int newflags = bridgeMethod.getAccessFlags() | 0x00000040; if ((newflags & 0x00000100) != 0) { newflags = newflags - 0x100; } bridgeMethod.setAccessFlags(newflags); Type returnType = BcelWorld.makeBcelType(theBridgeMethod.getReturnType()); Type[] paramTypes = BcelWorld.makeBcelTypes(theBridgeMethod.getParameterTypes()); Type[] newParamTypes = whatToBridgeToMethodGen.getArgumentTypes(); body = bridgeMethod.getBody(); fact = clazz.getFactory();
354,022
Bug 354022 constructor inlining can fail for some groovy built code
The file grails.util.BuildSettings contains bytecode where the constructors are recursive. You can't compile this in Java A() { this(); } but groovy generates some code where it switches on a value in the ctor and if it is a certain value, the recursive ctor call is made. I imagine this 'never happens' in practice but because it is in the bytecode it trips up the AspectJ code which inlines this() calls before weaving - since it gets into an infinite loop. For now, just keep track of ctors making the recursive call and so don't get trapped in the infinite loop.
resolved fixed
6ae463a
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-08-05T16:17:39Z
2011-08-05T16:00:00Z
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
if (!whatToBridgeToMethodGen.isStatic()) { body.append(InstructionFactory.createThis()); pos++; } for (int i = 0, len = paramTypes.length; i < len; i++) { Type paramType = paramTypes[i]; body.append(InstructionFactory.createLoad(paramType, pos)); if (!newParamTypes[i].equals(paramTypes[i])) { if (world.forDEBUG_bridgingCode) { System.err.println("Bridging: Cast " + newParamTypes[i] + " from " + paramTypes[i]); } body.append(fact.createCast(paramTypes[i], newParamTypes[i])); } pos += paramType.getSize(); } body.append(Utility.createInvoke(fact, world, whatToBridgeTo)); body.append(InstructionFactory.createReturn(returnType)); clazz.addMethodGen(bridgeMethod); } /** * Weave a class and indicate through the return value whether the class was modified. * * @return true if the class was modified */ public boolean weave() { if (clazz.isWoven() && !clazz.isReweavable()) { world.showMessage(IMessage.ERROR, WeaverMessages.format(WeaverMessages.ALREADY_WOVEN, clazz.getType().getName()), ty.getSourceLocation(), null); return false; }
354,022
Bug 354022 constructor inlining can fail for some groovy built code
The file grails.util.BuildSettings contains bytecode where the constructors are recursive. You can't compile this in Java A() { this(); } but groovy generates some code where it switches on a value in the ctor and if it is a certain value, the recursive ctor call is made. I imagine this 'never happens' in practice but because it is in the bytecode it trips up the AspectJ code which inlines this() calls before weaving - since it gets into an infinite loop. For now, just keep track of ctors making the recursive call and so don't get trapped in the infinite loop.
resolved fixed
6ae463a
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-08-05T16:17:39Z
2011-08-05T16:00:00Z
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
Set<String> aspectsAffectingType = null; if (inReweavableMode || clazz.getType().isAspect()) { aspectsAffectingType = new HashSet<String>(); } boolean isChanged = false; if (clazz.getType().isAspect()) { isChanged = true; } WeaverStateInfo typeWeaverState = (world.isOverWeaving() ? getLazyClassGen().getType().getWeaverState() : null); for (ConcreteTypeMunger o : typeMungers) { if (!(o instanceof BcelTypeMunger)) { continue; } BcelTypeMunger munger = (BcelTypeMunger) o; if (typeWeaverState != null && typeWeaverState.isAspectAlreadyApplied(munger.getAspectType())) { continue; } boolean typeMungerAffectedType = munger.munge(this); if (typeMungerAffectedType) { isChanged = true; if (inReweavableMode || clazz.getType().isAspect()) { aspectsAffectingType.add(munger.getAspectType().getSignature()); } } } isChanged = weaveDeclareAtMethodCtor(clazz) || isChanged;
354,022
Bug 354022 constructor inlining can fail for some groovy built code
The file grails.util.BuildSettings contains bytecode where the constructors are recursive. You can't compile this in Java A() { this(); } but groovy generates some code where it switches on a value in the ctor and if it is a certain value, the recursive ctor call is made. I imagine this 'never happens' in practice but because it is in the bytecode it trips up the AspectJ code which inlines this() calls before weaving - since it gets into an infinite loop. For now, just keep track of ctors making the recursive call and so don't get trapped in the infinite loop.
resolved fixed
6ae463a
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-08-05T16:17:39Z
2011-08-05T16:00:00Z
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
isChanged = weaveDeclareAtField(clazz) || isChanged; addedSuperInitializersAsList = new ArrayList<IfaceInitList>(addedSuperInitializers.values()); addedSuperInitializersAsList = PartialOrder.sort(addedSuperInitializersAsList); if (addedSuperInitializersAsList == null) { throw new BCException("circularity in inter-types"); } LazyMethodGen staticInit = clazz.getStaticInitializer(); staticInit.getBody().insert(genInitInstructions(addedClassInitializers, true)); List<LazyMethodGen> methodGens = new ArrayList<LazyMethodGen>(clazz.getMethodGens()); for (LazyMethodGen member : methodGens) { if (!member.hasBody()) { continue; } if (world.isJoinpointSynchronizationEnabled() && world.areSynchronizationPointcutsInUse() && member.getMethod().isSynchronized()) { transformSynchronizedMethod(member); } boolean shadowMungerMatched = match(member); if (shadowMungerMatched) {
354,022
Bug 354022 constructor inlining can fail for some groovy built code
The file grails.util.BuildSettings contains bytecode where the constructors are recursive. You can't compile this in Java A() { this(); } but groovy generates some code where it switches on a value in the ctor and if it is a certain value, the recursive ctor call is made. I imagine this 'never happens' in practice but because it is in the bytecode it trips up the AspectJ code which inlines this() calls before weaving - since it gets into an infinite loop. For now, just keep track of ctors making the recursive call and so don't get trapped in the infinite loop.
resolved fixed
6ae463a
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-08-05T16:17:39Z
2011-08-05T16:00:00Z
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
if (inReweavableMode || clazz.getType().isAspect()) { aspectsAffectingType.addAll(findAspectsForMungers(member)); } isChanged = true; } } for (LazyMethodGen methodGen : methodGens) { if (!methodGen.hasBody()) { continue; } implement(methodGen); } if (!initializationShadows.isEmpty()) { while (inlineSelfConstructors(methodGens)) { } positionAndImplement(initializationShadows); } if (lateTypeMungers != null) { for (Iterator<ConcreteTypeMunger> i = lateTypeMungers.iterator(); i.hasNext();) { BcelTypeMunger munger = (BcelTypeMunger) i.next(); if (munger.matches(clazz.getType())) { boolean typeMungerAffectedType = munger.munge(this); if (typeMungerAffectedType) { isChanged = true;
354,022
Bug 354022 constructor inlining can fail for some groovy built code
The file grails.util.BuildSettings contains bytecode where the constructors are recursive. You can't compile this in Java A() { this(); } but groovy generates some code where it switches on a value in the ctor and if it is a certain value, the recursive ctor call is made. I imagine this 'never happens' in practice but because it is in the bytecode it trips up the AspectJ code which inlines this() calls before weaving - since it gets into an infinite loop. For now, just keep track of ctors making the recursive call and so don't get trapped in the infinite loop.
resolved fixed
6ae463a
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-08-05T16:17:39Z
2011-08-05T16:00:00Z
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
if (inReweavableMode || clazz.getType().isAspect()) { aspectsAffectingType.add(munger.getAspectType().getSignature()); } } } } } if (isChanged) { clazz.getOrCreateWeaverStateInfo(inReweavableMode); weaveInAddedMethods(); } if (inReweavableMode) { WeaverStateInfo wsi = clazz.getOrCreateWeaverStateInfo(true); wsi.addAspectsAffectingType(aspectsAffectingType); wsi.setUnwovenClassFileData(ty.getJavaClass().getBytes()); wsi.setReweavable(true); } else { clazz.getOrCreateWeaverStateInfo(false).setReweavable(false); } for (LazyMethodGen mg : methodGens) { BcelMethod method = mg.getMemberView(); if (method != null) {
354,022
Bug 354022 constructor inlining can fail for some groovy built code
The file grails.util.BuildSettings contains bytecode where the constructors are recursive. You can't compile this in Java A() { this(); } but groovy generates some code where it switches on a value in the ctor and if it is a certain value, the recursive ctor call is made. I imagine this 'never happens' in practice but because it is in the bytecode it trips up the AspectJ code which inlines this() calls before weaving - since it gets into an infinite loop. For now, just keep track of ctors making the recursive call and so don't get trapped in the infinite loop.
resolved fixed
6ae463a
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-08-05T16:17:39Z
2011-08-05T16:00:00Z
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
method.wipeJoinpointSignatures(); } } return isChanged; } /** * Check if a particular method is overriding another - refactored into this helper so it can be used from multiple places. */ private static ResolvedMember isOverriding(ResolvedType typeToCheck, ResolvedMember methodThatMightBeGettingOverridden, String mname, String mrettype, int mmods, boolean inSamePackage, UnresolvedType[] methodParamsArray) { if (Modifier.isStatic(methodThatMightBeGettingOverridden.getModifiers())) { return null; } if (Modifier.isPrivate(methodThatMightBeGettingOverridden.getModifiers())) { return null; } if (!methodThatMightBeGettingOverridden.getName().equals(mname)) { return null; } if (methodThatMightBeGettingOverridden.getParameterTypes().length != methodParamsArray.length) { return null;
354,022
Bug 354022 constructor inlining can fail for some groovy built code
The file grails.util.BuildSettings contains bytecode where the constructors are recursive. You can't compile this in Java A() { this(); } but groovy generates some code where it switches on a value in the ctor and if it is a certain value, the recursive ctor call is made. I imagine this 'never happens' in practice but because it is in the bytecode it trips up the AspectJ code which inlines this() calls before weaving - since it gets into an infinite loop. For now, just keep track of ctors making the recursive call and so don't get trapped in the infinite loop.
resolved fixed
6ae463a
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-08-05T16:17:39Z
2011-08-05T16:00:00Z
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
} if (!isVisibilityOverride(mmods, methodThatMightBeGettingOverridden, inSamePackage)) { return null; } if (typeToCheck.getWorld().forDEBUG_bridgingCode) { System.err.println(" Bridging:seriously considering this might be getting overridden '" + methodThatMightBeGettingOverridden + "'"); } World w = typeToCheck.getWorld(); boolean sameParams = true; for (int p = 0, max = methodThatMightBeGettingOverridden.getParameterTypes().length; p < max; p++) { UnresolvedType mtmbgoParameter = methodThatMightBeGettingOverridden.getParameterTypes()[p]; UnresolvedType ptype = methodParamsArray[p]; if (mtmbgoParameter.isTypeVariableReference()) { if (!mtmbgoParameter.resolve(w).isAssignableFrom(ptype.resolve(w))) { sameParams = false; } } else { boolean b = !methodThatMightBeGettingOverridden.getParameterTypes()[p].getErasureSignature().equals( methodParamsArray[p].getErasureSignature()); UnresolvedType parameterType = methodThatMightBeGettingOverridden.getParameterTypes()[p]; if (parameterType instanceof UnresolvedTypeVariableReferenceType) { parameterType = ((UnresolvedTypeVariableReferenceType) parameterType).getTypeVariable().getFirstBound(); } if (b) { sameParams = false;
354,022
Bug 354022 constructor inlining can fail for some groovy built code
The file grails.util.BuildSettings contains bytecode where the constructors are recursive. You can't compile this in Java A() { this(); } but groovy generates some code where it switches on a value in the ctor and if it is a certain value, the recursive ctor call is made. I imagine this 'never happens' in practice but because it is in the bytecode it trips up the AspectJ code which inlines this() calls before weaving - since it gets into an infinite loop. For now, just keep track of ctors making the recursive call and so don't get trapped in the infinite loop.
resolved fixed
6ae463a
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-08-05T16:17:39Z
2011-08-05T16:00:00Z
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
} } } if (sameParams) { if (typeToCheck.isParameterizedType()) { return methodThatMightBeGettingOverridden.getBackingGenericMember(); } else if (!methodThatMightBeGettingOverridden.getReturnType().getErasureSignature().equals(mrettype)) { ResolvedType superReturn = typeToCheck.getWorld().resolve( UnresolvedType.forSignature(methodThatMightBeGettingOverridden.getReturnType().getErasureSignature())); ResolvedType subReturn = typeToCheck.getWorld().resolve(UnresolvedType.forSignature(mrettype)); if (superReturn.isAssignableFrom(subReturn)) { return methodThatMightBeGettingOverridden; }
354,022
Bug 354022 constructor inlining can fail for some groovy built code
The file grails.util.BuildSettings contains bytecode where the constructors are recursive. You can't compile this in Java A() { this(); } but groovy generates some code where it switches on a value in the ctor and if it is a certain value, the recursive ctor call is made. I imagine this 'never happens' in practice but because it is in the bytecode it trips up the AspectJ code which inlines this() calls before weaving - since it gets into an infinite loop. For now, just keep track of ctors making the recursive call and so don't get trapped in the infinite loop.
resolved fixed
6ae463a
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-08-05T16:17:39Z
2011-08-05T16:00:00Z
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
} else { return methodThatMightBeGettingOverridden; } } return null; } /** * Looks at the visibility modifiers between two methods, and knows whether they are from classes in the same package, and * decides whether one overrides the other. * * @return true if there is an overrides rather than a 'hides' relationship */ static boolean isVisibilityOverride(int methodMods, ResolvedMember inheritedMethod, boolean inSamePackage) { int inheritedModifiers = inheritedMethod.getModifiers(); if (Modifier.isStatic(inheritedModifiers)) { return false; } if (methodMods == inheritedModifiers) { return true; } if (Modifier.isPrivate(inheritedModifiers)) { return false; } boolean isPackageVisible = !Modifier.isPrivate(inheritedModifiers) && !Modifier.isProtected(inheritedModifiers) && !Modifier.isPublic(inheritedModifiers); if (isPackageVisible && !inSamePackage) { return false; } return true;
354,022
Bug 354022 constructor inlining can fail for some groovy built code
The file grails.util.BuildSettings contains bytecode where the constructors are recursive. You can't compile this in Java A() { this(); } but groovy generates some code where it switches on a value in the ctor and if it is a certain value, the recursive ctor call is made. I imagine this 'never happens' in practice but because it is in the bytecode it trips up the AspectJ code which inlines this() calls before weaving - since it gets into an infinite loop. For now, just keep track of ctors making the recursive call and so don't get trapped in the infinite loop.
resolved fixed
6ae463a
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-08-05T16:17:39Z
2011-08-05T16:00:00Z
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
} /** * This method recurses up a specified type looking for a method that overrides the one passed in. * * @return the method being overridden or null if none is found */ public static ResolvedMember checkForOverride(ResolvedType typeToCheck, String mname, String mparams, String mrettype, int mmods, String mpkg, UnresolvedType[] methodParamsArray) { if (typeToCheck == null) { return null; } if (typeToCheck instanceof MissingResolvedTypeWithKnownSignature) { return null; } if (typeToCheck.getWorld().forDEBUG_bridgingCode) { System.err.println(" Bridging:checking for override of " + mname + " in " + typeToCheck); } String packageName = typeToCheck.getPackageName(); if (packageName == null) { packageName = ""; } boolean inSamePackage = packageName.equals(mpkg); ResolvedMember[] methods = typeToCheck.getDeclaredMethods(); for (int ii = 0; ii < methods.length; ii++) { ResolvedMember methodThatMightBeGettingOverridden = methods[ii];
354,022
Bug 354022 constructor inlining can fail for some groovy built code
The file grails.util.BuildSettings contains bytecode where the constructors are recursive. You can't compile this in Java A() { this(); } but groovy generates some code where it switches on a value in the ctor and if it is a certain value, the recursive ctor call is made. I imagine this 'never happens' in practice but because it is in the bytecode it trips up the AspectJ code which inlines this() calls before weaving - since it gets into an infinite loop. For now, just keep track of ctors making the recursive call and so don't get trapped in the infinite loop.
resolved fixed
6ae463a
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-08-05T16:17:39Z
2011-08-05T16:00:00Z
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
ResolvedMember isOverriding = isOverriding(typeToCheck, methodThatMightBeGettingOverridden, mname, mrettype, mmods, inSamePackage, methodParamsArray); if (isOverriding != null) { return isOverriding; } } List<ConcreteTypeMunger> l = (typeToCheck.isRawType() ? typeToCheck.getGenericType().getInterTypeMungers() : typeToCheck .getInterTypeMungers()); for (Iterator<ConcreteTypeMunger> iterator = l.iterator(); iterator.hasNext();) { ConcreteTypeMunger o = iterator.next(); if (o instanceof BcelTypeMunger) { BcelTypeMunger element = (BcelTypeMunger) o; if (element.getMunger() instanceof NewMethodTypeMunger) { if (typeToCheck.getWorld().forDEBUG_bridgingCode) { System.err.println("Possible ITD candidate " + element); } ResolvedMember aMethod = element.getSignature(); ResolvedMember isOverriding = isOverriding(typeToCheck, aMethod, mname, mrettype, mmods, inSamePackage, methodParamsArray); if (isOverriding != null) { return isOverriding; } } }
354,022
Bug 354022 constructor inlining can fail for some groovy built code
The file grails.util.BuildSettings contains bytecode where the constructors are recursive. You can't compile this in Java A() { this(); } but groovy generates some code where it switches on a value in the ctor and if it is a certain value, the recursive ctor call is made. I imagine this 'never happens' in practice but because it is in the bytecode it trips up the AspectJ code which inlines this() calls before weaving - since it gets into an infinite loop. For now, just keep track of ctors making the recursive call and so don't get trapped in the infinite loop.
resolved fixed
6ae463a
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-08-05T16:17:39Z
2011-08-05T16:00:00Z
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
} if (typeToCheck.equals(UnresolvedType.OBJECT)) { return null; } ResolvedType superclass = typeToCheck.getSuperclass(); ResolvedMember overriddenMethod = checkForOverride(superclass, mname, mparams, mrettype, mmods, mpkg, methodParamsArray); if (overriddenMethod != null) { return overriddenMethod; } ResolvedType[] interfaces = typeToCheck.getDeclaredInterfaces(); for (int i = 0; i < interfaces.length; i++) { ResolvedType anInterface = interfaces[i]; overriddenMethod = checkForOverride(anInterface, mname, mparams, mrettype, mmods, mpkg, methodParamsArray); if (overriddenMethod != null) { return overriddenMethod; } } return null; } /** * We need to determine if any methods in this type require bridge methods - this method should only be called if necessary to * do this calculation, i.e. we are on a 1.5 VM (where covariance/generics exist) and the type hierarchy for the specified class * has changed (via decp/itd). * * See pr108101 */ public static boolean calculateAnyRequiredBridgeMethods(BcelWorld world, LazyClassGen clazz) { world.ensureAdvancedConfigurationProcessed(); if (!world.isInJava5Mode()) { return false;
354,022
Bug 354022 constructor inlining can fail for some groovy built code
The file grails.util.BuildSettings contains bytecode where the constructors are recursive. You can't compile this in Java A() { this(); } but groovy generates some code where it switches on a value in the ctor and if it is a certain value, the recursive ctor call is made. I imagine this 'never happens' in practice but because it is in the bytecode it trips up the AspectJ code which inlines this() calls before weaving - since it gets into an infinite loop. For now, just keep track of ctors making the recursive call and so don't get trapped in the infinite loop.
resolved fixed
6ae463a
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-08-05T16:17:39Z
2011-08-05T16:00:00Z
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
} if (clazz.isInterface()) { return false; } boolean didSomething = false; List<LazyMethodGen> methods = clazz.getMethodGens(); Set<String> methodsSet = new HashSet<String>(); for (int i = 0; i < methods.size(); i++) { LazyMethodGen aMethod = methods.get(i); methodsSet.add(aMethod.getName() + aMethod.getSignature()); } for (int i = 0; i < methods.size(); i++) { LazyMethodGen bridgeToCandidate = methods.get(i); if (bridgeToCandidate.isBridgeMethod()) { continue; } String name = bridgeToCandidate.getName(); String psig = bridgeToCandidate.getParameterSignature(); String rsig = bridgeToCandidate.getReturnType().getSignature(); if (bridgeToCandidate.isStatic()) { continue;
354,022
Bug 354022 constructor inlining can fail for some groovy built code
The file grails.util.BuildSettings contains bytecode where the constructors are recursive. You can't compile this in Java A() { this(); } but groovy generates some code where it switches on a value in the ctor and if it is a certain value, the recursive ctor call is made. I imagine this 'never happens' in practice but because it is in the bytecode it trips up the AspectJ code which inlines this() calls before weaving - since it gets into an infinite loop. For now, just keep track of ctors making the recursive call and so don't get trapped in the infinite loop.
resolved fixed
6ae463a
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-08-05T16:17:39Z
2011-08-05T16:00:00Z
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
} if (name.endsWith("init>")) { continue; } if (world.forDEBUG_bridgingCode) { System.err.println("Bridging: Determining if we have to bridge to " + clazz.getName() + "." + name + "" + bridgeToCandidate.getSignature()); } ResolvedType theSuperclass = clazz.getSuperClass(); if (world.forDEBUG_bridgingCode) { System.err.println("Bridging: Checking supertype " + theSuperclass); } String pkgName = clazz.getPackageName(); UnresolvedType[] bm = BcelWorld.fromBcel(bridgeToCandidate.getArgumentTypes()); ResolvedMember overriddenMethod = checkForOverride(theSuperclass, name, psig, rsig, bridgeToCandidate.getAccessFlags(), pkgName, bm); if (overriddenMethod != null) { String key = new StringBuffer().append(overriddenMethod.getName()).append(overriddenMethod.getSignatureErased()) .toString(); boolean alreadyHaveABridgeMethod = methodsSet.contains(key); if (!alreadyHaveABridgeMethod) { if (world.forDEBUG_bridgingCode) { System.err.println("Bridging:bridging to '" + overriddenMethod + "'"); } createBridgeMethod(world, bridgeToCandidate, clazz, overriddenMethod); methodsSet.add(key); didSomething = true; continue; }
354,022
Bug 354022 constructor inlining can fail for some groovy built code
The file grails.util.BuildSettings contains bytecode where the constructors are recursive. You can't compile this in Java A() { this(); } but groovy generates some code where it switches on a value in the ctor and if it is a certain value, the recursive ctor call is made. I imagine this 'never happens' in practice but because it is in the bytecode it trips up the AspectJ code which inlines this() calls before weaving - since it gets into an infinite loop. For now, just keep track of ctors making the recursive call and so don't get trapped in the infinite loop.
resolved fixed
6ae463a
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-08-05T16:17:39Z
2011-08-05T16:00:00Z
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
} String[] interfaces = clazz.getInterfaceNames(); for (int j = 0; j < interfaces.length; j++) { if (world.forDEBUG_bridgingCode) { System.err.println("Bridging:checking superinterface " + interfaces[j]); } ResolvedType interfaceType = world.resolve(interfaces[j]); overriddenMethod = checkForOverride(interfaceType, name, psig, rsig, bridgeToCandidate.getAccessFlags(), clazz.getPackageName(), bm); if (overriddenMethod != null) { String key = new StringBuffer().append(overriddenMethod.getName()) .append(overriddenMethod.getSignatureErased()).toString(); boolean alreadyHaveABridgeMethod = methodsSet.contains(key); if (!alreadyHaveABridgeMethod) { createBridgeMethod(world, bridgeToCandidate, clazz, overriddenMethod); methodsSet.add(key); didSomething = true; if (world.forDEBUG_bridgingCode) { System.err.println("Bridging:bridging to " + overriddenMethod); } continue; } } } } return didSomething; }
354,022
Bug 354022 constructor inlining can fail for some groovy built code
The file grails.util.BuildSettings contains bytecode where the constructors are recursive. You can't compile this in Java A() { this(); } but groovy generates some code where it switches on a value in the ctor and if it is a certain value, the recursive ctor call is made. I imagine this 'never happens' in practice but because it is in the bytecode it trips up the AspectJ code which inlines this() calls before weaving - since it gets into an infinite loop. For now, just keep track of ctors making the recursive call and so don't get trapped in the infinite loop.
resolved fixed
6ae463a
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-08-05T16:17:39Z
2011-08-05T16:00:00Z
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
/** * Weave any declare @method/@ctor statements into the members of the supplied class */ private boolean weaveDeclareAtMethodCtor(LazyClassGen clazz) { List<Integer> reportedProblems = new ArrayList<Integer>(); List<DeclareAnnotation> allDecams = world.getDeclareAnnotationOnMethods(); if (allDecams.isEmpty()) { return false; } boolean isChanged = false; List<ConcreteTypeMunger> itdMethodsCtors = getITDSubset(clazz, ResolvedTypeMunger.Method); itdMethodsCtors.addAll(getITDSubset(clazz, ResolvedTypeMunger.Constructor)); if (!itdMethodsCtors.isEmpty()) { isChanged = weaveAtMethodOnITDSRepeatedly(allDecams, itdMethodsCtors, reportedProblems); } List<LazyMethodGen> members = clazz.getMethodGens(); List<DeclareAnnotation> decaMs = getMatchingSubset(allDecams, clazz.getType()); if (decaMs.isEmpty()) { return false; } if (!members.isEmpty()) { Set<DeclareAnnotation> unusedDecams = new HashSet<DeclareAnnotation>(); unusedDecams.addAll(decaMs); for (int memberCounter = 0; memberCounter < members.size(); memberCounter++) { LazyMethodGen mg = members.get(memberCounter);
354,022
Bug 354022 constructor inlining can fail for some groovy built code
The file grails.util.BuildSettings contains bytecode where the constructors are recursive. You can't compile this in Java A() { this(); } but groovy generates some code where it switches on a value in the ctor and if it is a certain value, the recursive ctor call is made. I imagine this 'never happens' in practice but because it is in the bytecode it trips up the AspectJ code which inlines this() calls before weaving - since it gets into an infinite loop. For now, just keep track of ctors making the recursive call and so don't get trapped in the infinite loop.
resolved fixed
6ae463a
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-08-05T16:17:39Z
2011-08-05T16:00:00Z
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
if (!mg.getName().startsWith(NameMangler.PREFIX)) { List<DeclareAnnotation> worthRetrying = new ArrayList<DeclareAnnotation>(); boolean modificationOccured = false; List<AnnotationGen> annotationsToAdd = null; for (DeclareAnnotation decaM : decaMs) { if (decaM.matches(mg.getMemberView(), world)) { if (doesAlreadyHaveAnnotation(mg.getMemberView(), decaM, reportedProblems)) { unusedDecams.remove(decaM); continue; } if (annotationsToAdd == null) { annotationsToAdd = new ArrayList<AnnotationGen>(); } AnnotationGen a = ((BcelAnnotation) decaM.getAnnotation()).getBcelAnnotation(); AnnotationGen ag = new AnnotationGen(a, clazz.getConstantPool(), true); annotationsToAdd.add(ag); mg.addAnnotation(decaM.getAnnotation()); AsmRelationshipProvider.addDeclareAnnotationMethodRelationship(decaM.getSourceLocation(), clazz.getName(), mg.getMemberView(), world.getModelAsAsmManager()); reportMethodCtorWeavingMessage(clazz, mg.getMemberView(), decaM, mg.getDeclarationLineNumber()); isChanged = true; modificationOccured = true; unusedDecams.remove(decaM); } else { if (!decaM.isStarredAnnotationPattern()) {
354,022
Bug 354022 constructor inlining can fail for some groovy built code
The file grails.util.BuildSettings contains bytecode where the constructors are recursive. You can't compile this in Java A() { this(); } but groovy generates some code where it switches on a value in the ctor and if it is a certain value, the recursive ctor call is made. I imagine this 'never happens' in practice but because it is in the bytecode it trips up the AspectJ code which inlines this() calls before weaving - since it gets into an infinite loop. For now, just keep track of ctors making the recursive call and so don't get trapped in the infinite loop.
resolved fixed
6ae463a
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-08-05T16:17:39Z
2011-08-05T16:00:00Z
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
worthRetrying.add(decaM); } } } while (!worthRetrying.isEmpty() && modificationOccured) { modificationOccured = false; List<DeclareAnnotation> forRemoval = new ArrayList<DeclareAnnotation>(); for (DeclareAnnotation decaM : worthRetrying) { if (decaM.matches(mg.getMemberView(), world)) { if (doesAlreadyHaveAnnotation(mg.getMemberView(), decaM, reportedProblems)) { unusedDecams.remove(decaM); continue; } if (annotationsToAdd == null) { annotationsToAdd = new ArrayList<AnnotationGen>(); } AnnotationGen a = ((BcelAnnotation) decaM.getAnnotation()).getBcelAnnotation(); AnnotationGen ag = new AnnotationGen(a, clazz.getConstantPool(), true); annotationsToAdd.add(ag); mg.addAnnotation(decaM.getAnnotation());
354,022
Bug 354022 constructor inlining can fail for some groovy built code
The file grails.util.BuildSettings contains bytecode where the constructors are recursive. You can't compile this in Java A() { this(); } but groovy generates some code where it switches on a value in the ctor and if it is a certain value, the recursive ctor call is made. I imagine this 'never happens' in practice but because it is in the bytecode it trips up the AspectJ code which inlines this() calls before weaving - since it gets into an infinite loop. For now, just keep track of ctors making the recursive call and so don't get trapped in the infinite loop.
resolved fixed
6ae463a
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-08-05T16:17:39Z
2011-08-05T16:00:00Z
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
AsmRelationshipProvider.addDeclareAnnotationMethodRelationship(decaM.getSourceLocation(), clazz.getName(), mg.getMemberView(), world.getModelAsAsmManager()); isChanged = true; modificationOccured = true; forRemoval.add(decaM); unusedDecams.remove(decaM); } } worthRetrying.removeAll(forRemoval); } if (annotationsToAdd != null) { Method oldMethod = mg.getMethod(); MethodGen myGen = new MethodGen(oldMethod, clazz.getClassName(), clazz.getConstantPool(), false); for (AnnotationGen a : annotationsToAdd) { myGen.addAnnotation(a); } Method newMethod = myGen.getMethod(); members.set(memberCounter, new LazyMethodGen(newMethod, clazz)); } } } checkUnusedDeclareAts(unusedDecams, false); } return isChanged; } private void reportMethodCtorWeavingMessage(LazyClassGen clazz, ResolvedMember member, DeclareAnnotation decaM, int memberLineNumber) {
354,022
Bug 354022 constructor inlining can fail for some groovy built code
The file grails.util.BuildSettings contains bytecode where the constructors are recursive. You can't compile this in Java A() { this(); } but groovy generates some code where it switches on a value in the ctor and if it is a certain value, the recursive ctor call is made. I imagine this 'never happens' in practice but because it is in the bytecode it trips up the AspectJ code which inlines this() calls before weaving - since it gets into an infinite loop. For now, just keep track of ctors making the recursive call and so don't get trapped in the infinite loop.
resolved fixed
6ae463a
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-08-05T16:17:39Z
2011-08-05T16:00:00Z
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
if (!getWorld().getMessageHandler().isIgnoring(IMessage.WEAVEINFO)) { StringBuffer parmString = new StringBuffer("("); UnresolvedType[] paramTypes = member.getParameterTypes(); for (int i = 0; i < paramTypes.length; i++) { UnresolvedType type = paramTypes[i]; String s = org.aspectj.apache.bcel.classfile.Utility.signatureToString(type.getSignature()); if (s.lastIndexOf('.') != -1) { s = s.substring(s.lastIndexOf('.') + 1); } parmString.append(s); if ((i + 1) < paramTypes.length) { parmString.append(","); } } parmString.append(")"); String methodName = member.getName(); StringBuffer sig = new StringBuffer(); sig.append(org.aspectj.apache.bcel.classfile.Utility.accessToString(member.getModifiers())); sig.append(" "); sig.append(member.getReturnType().toString()); sig.append(" "); sig.append(member.getDeclaringType().toString()); sig.append("."); sig.append(methodName.equals("<init>") ? "new" : methodName); sig.append(parmString); StringBuffer loc = new StringBuffer(); if (clazz.getFileName() == null) { loc.append("no debug info available"); } else { loc.append(clazz.getFileName());
354,022
Bug 354022 constructor inlining can fail for some groovy built code
The file grails.util.BuildSettings contains bytecode where the constructors are recursive. You can't compile this in Java A() { this(); } but groovy generates some code where it switches on a value in the ctor and if it is a certain value, the recursive ctor call is made. I imagine this 'never happens' in practice but because it is in the bytecode it trips up the AspectJ code which inlines this() calls before weaving - since it gets into an infinite loop. For now, just keep track of ctors making the recursive call and so don't get trapped in the infinite loop.
resolved fixed
6ae463a
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-08-05T16:17:39Z
2011-08-05T16:00:00Z
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
if (memberLineNumber != -1) { loc.append(":" + memberLineNumber); } } getWorld().getMessageHandler().handleMessage( WeaveMessage.constructWeavingMessage( WeaveMessage.WEAVEMESSAGE_ANNOTATES, new String[] { sig.toString(), loc.toString(), decaM.getAnnotationString(), methodName.startsWith("<init>") ? "constructor" : "method", decaM.getAspect().toString(), Utility.beautifyLocation(decaM.getSourceLocation()) })); } } /** * Looks through a list of declare annotation statements and only returns those that could possibly match on a field/method/ctor * in type. */ private List<DeclareAnnotation> getMatchingSubset(List<DeclareAnnotation> declareAnnotations, ResolvedType type) { List<DeclareAnnotation> subset = new ArrayList<DeclareAnnotation>(); for (DeclareAnnotation da : declareAnnotations) { if (da.couldEverMatch(type)) { subset.add(da); } } return subset; } /** * Get a subset of all the type mungers defined on this aspect */ private List<ConcreteTypeMunger> getITDSubset(LazyClassGen clazz, ResolvedTypeMunger.Kind wantedKind) { List<ConcreteTypeMunger> subset = new ArrayList<ConcreteTypeMunger>();
354,022
Bug 354022 constructor inlining can fail for some groovy built code
The file grails.util.BuildSettings contains bytecode where the constructors are recursive. You can't compile this in Java A() { this(); } but groovy generates some code where it switches on a value in the ctor and if it is a certain value, the recursive ctor call is made. I imagine this 'never happens' in practice but because it is in the bytecode it trips up the AspectJ code which inlines this() calls before weaving - since it gets into an infinite loop. For now, just keep track of ctors making the recursive call and so don't get trapped in the infinite loop.
resolved fixed
6ae463a
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-08-05T16:17:39Z
2011-08-05T16:00:00Z
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
for (ConcreteTypeMunger typeMunger : clazz.getBcelObjectType().getTypeMungers()) { if (typeMunger.getMunger().getKind() == wantedKind) { subset.add(typeMunger); } } return subset; } public LazyMethodGen locateAnnotationHolderForFieldMunger(LazyClassGen clazz, ConcreteTypeMunger fieldMunger) { NewFieldTypeMunger newFieldMunger = (NewFieldTypeMunger) fieldMunger.getMunger(); ResolvedMember lookingFor = AjcMemberMaker.interFieldInitializer(newFieldMunger.getSignature(), clazz.getType()); for (LazyMethodGen method : clazz.getMethodGens()) { if (method.getName().equals(lookingFor.getName())) { return method; } } return null; } public LazyMethodGen locateAnnotationHolderForMethodCtorMunger(LazyClassGen clazz, ConcreteTypeMunger methodCtorMunger) { ResolvedTypeMunger rtMunger = methodCtorMunger.getMunger(); ResolvedMember lookingFor = null; if (rtMunger instanceof NewMethodTypeMunger) { NewMethodTypeMunger nftm = (NewMethodTypeMunger) rtMunger; lookingFor = AjcMemberMaker.interMethodDispatcher(nftm.getSignature(), methodCtorMunger.getAspectType()); } else if (rtMunger instanceof NewConstructorTypeMunger) { NewConstructorTypeMunger nftm = (NewConstructorTypeMunger) rtMunger; lookingFor = AjcMemberMaker.postIntroducedConstructor(methodCtorMunger.getAspectType(), nftm.getSignature() .getDeclaringType(), nftm.getSignature().getParameterTypes()); } else { throw new BCException("Not sure what this is: " + methodCtorMunger);
354,022
Bug 354022 constructor inlining can fail for some groovy built code
The file grails.util.BuildSettings contains bytecode where the constructors are recursive. You can't compile this in Java A() { this(); } but groovy generates some code where it switches on a value in the ctor and if it is a certain value, the recursive ctor call is made. I imagine this 'never happens' in practice but because it is in the bytecode it trips up the AspectJ code which inlines this() calls before weaving - since it gets into an infinite loop. For now, just keep track of ctors making the recursive call and so don't get trapped in the infinite loop.
resolved fixed
6ae463a
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-08-05T16:17:39Z
2011-08-05T16:00:00Z
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
} String name = lookingFor.getName(); String paramSignature = lookingFor.getParameterSignature(); for (LazyMethodGen member : clazz.getMethodGens()) { if (member.getName().equals(name) && member.getParameterSignature().equals(paramSignature)) { return member; } } return null; } /** * Applies some set of declare @field constructs (List<DeclareAnnotation>) to some bunch of ITDfields (List<BcelTypeMunger>. It * will iterate over the fields repeatedly until everything has been applied. * */ private boolean weaveAtFieldRepeatedly(List<DeclareAnnotation> decaFs, List<ConcreteTypeMunger> itdFields, List<Integer> reportedErrors) { boolean isChanged = false; for (Iterator<ConcreteTypeMunger> iter = itdFields.iterator(); iter.hasNext();) { BcelTypeMunger fieldMunger = (BcelTypeMunger) iter.next(); ResolvedMember itdIsActually = fieldMunger.getSignature(); Set<DeclareAnnotation> worthRetrying = new LinkedHashSet<DeclareAnnotation>(); boolean modificationOccured = false; for (Iterator<DeclareAnnotation> iter2 = decaFs.iterator(); iter2.hasNext();) { DeclareAnnotation decaF = iter2.next(); if (decaF.matches(itdIsActually, world)) { if (decaF.isRemover()) { LazyMethodGen annotationHolder = locateAnnotationHolderForFieldMunger(clazz, fieldMunger); if (annotationHolder.hasAnnotation(decaF.getAnnotationType())) { isChanged = true;
354,022
Bug 354022 constructor inlining can fail for some groovy built code
The file grails.util.BuildSettings contains bytecode where the constructors are recursive. You can't compile this in Java A() { this(); } but groovy generates some code where it switches on a value in the ctor and if it is a certain value, the recursive ctor call is made. I imagine this 'never happens' in practice but because it is in the bytecode it trips up the AspectJ code which inlines this() calls before weaving - since it gets into an infinite loop. For now, just keep track of ctors making the recursive call and so don't get trapped in the infinite loop.
resolved fixed
6ae463a
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-08-05T16:17:39Z
2011-08-05T16:00:00Z
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
annotationHolder.removeAnnotation(decaF.getAnnotationType()); AsmRelationshipProvider.addDeclareAnnotationRelationship(world.getModelAsAsmManager(), decaF.getSourceLocation(), itdIsActually.getSourceLocation(), true); } else { worthRetrying.add(decaF); } } else { LazyMethodGen annotationHolder = locateAnnotationHolderForFieldMunger(clazz, fieldMunger); if (doesAlreadyHaveAnnotation(annotationHolder, itdIsActually, decaF, reportedErrors)) { continue; } annotationHolder.addAnnotation(decaF.getAnnotation()); AsmRelationshipProvider.addDeclareAnnotationRelationship(world.getModelAsAsmManager(), decaF.getSourceLocation(), itdIsActually.getSourceLocation(), false); isChanged = true; modificationOccured = true; } } else { if (!decaF.isStarredAnnotationPattern()) { worthRetrying.add(decaF); } } } while (!worthRetrying.isEmpty() && modificationOccured) { modificationOccured = false; List<DeclareAnnotation> forRemoval = new ArrayList<DeclareAnnotation>(); for (Iterator<DeclareAnnotation> iter2 = worthRetrying.iterator(); iter2.hasNext();) {
354,022
Bug 354022 constructor inlining can fail for some groovy built code
The file grails.util.BuildSettings contains bytecode where the constructors are recursive. You can't compile this in Java A() { this(); } but groovy generates some code where it switches on a value in the ctor and if it is a certain value, the recursive ctor call is made. I imagine this 'never happens' in practice but because it is in the bytecode it trips up the AspectJ code which inlines this() calls before weaving - since it gets into an infinite loop. For now, just keep track of ctors making the recursive call and so don't get trapped in the infinite loop.
resolved fixed
6ae463a
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-08-05T16:17:39Z
2011-08-05T16:00:00Z
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
DeclareAnnotation decaF = iter2.next(); if (decaF.matches(itdIsActually, world)) { if (decaF.isRemover()) { LazyMethodGen annotationHolder = locateAnnotationHolderForFieldMunger(clazz, fieldMunger); if (annotationHolder.hasAnnotation(decaF.getAnnotationType())) { isChanged = true; annotationHolder.removeAnnotation(decaF.getAnnotationType()); AsmRelationshipProvider.addDeclareAnnotationRelationship(world.getModelAsAsmManager(), decaF.getSourceLocation(), itdIsActually.getSourceLocation(), true); forRemoval.add(decaF); } } else { LazyMethodGen annotationHolder = locateAnnotationHolderForFieldMunger(clazz, fieldMunger); if (doesAlreadyHaveAnnotation(annotationHolder, itdIsActually, decaF, reportedErrors)) { continue; } annotationHolder.addAnnotation(decaF.getAnnotation()); AsmRelationshipProvider.addDeclareAnnotationRelationship(world.getModelAsAsmManager(), decaF.getSourceLocation(), itdIsActually.getSourceLocation(), false); isChanged = true; modificationOccured = true; forRemoval.add(decaF); } } } worthRetrying.removeAll(forRemoval); } } return isChanged;
354,022
Bug 354022 constructor inlining can fail for some groovy built code
The file grails.util.BuildSettings contains bytecode where the constructors are recursive. You can't compile this in Java A() { this(); } but groovy generates some code where it switches on a value in the ctor and if it is a certain value, the recursive ctor call is made. I imagine this 'never happens' in practice but because it is in the bytecode it trips up the AspectJ code which inlines this() calls before weaving - since it gets into an infinite loop. For now, just keep track of ctors making the recursive call and so don't get trapped in the infinite loop.
resolved fixed
6ae463a
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-08-05T16:17:39Z
2011-08-05T16:00:00Z
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
} /** * Applies some set of declare @method/@ctor constructs (List<DeclareAnnotation>) to some bunch of ITDmembers * (List<BcelTypeMunger>. It will iterate over the fields repeatedly until everything has been applied. */ private boolean weaveAtMethodOnITDSRepeatedly(List<DeclareAnnotation> decaMCs, List<ConcreteTypeMunger> itdsForMethodAndConstructor, List<Integer> reportedErrors) { boolean isChanged = false; AsmManager asmManager = world.getModelAsAsmManager(); for (ConcreteTypeMunger methodctorMunger : itdsForMethodAndConstructor) { ResolvedMember unMangledInterMethod = methodctorMunger.getSignature(); List<DeclareAnnotation> worthRetrying = new ArrayList<DeclareAnnotation>(); boolean modificationOccured = false; for (Iterator<DeclareAnnotation> iter2 = decaMCs.iterator(); iter2.hasNext();) { DeclareAnnotation decaMC = iter2.next(); if (decaMC.matches(unMangledInterMethod, world)) { LazyMethodGen annotationHolder = locateAnnotationHolderForMethodCtorMunger(clazz, methodctorMunger); if (annotationHolder == null || doesAlreadyHaveAnnotation(annotationHolder, unMangledInterMethod, decaMC, reportedErrors)) { continue; } annotationHolder.addAnnotation(decaMC.getAnnotation()); isChanged = true; AsmRelationshipProvider.addDeclareAnnotationRelationship(asmManager, decaMC.getSourceLocation(), unMangledInterMethod.getSourceLocation(), false); reportMethodCtorWeavingMessage(clazz, unMangledInterMethod, decaMC, -1); modificationOccured = true; } else {
354,022
Bug 354022 constructor inlining can fail for some groovy built code
The file grails.util.BuildSettings contains bytecode where the constructors are recursive. You can't compile this in Java A() { this(); } but groovy generates some code where it switches on a value in the ctor and if it is a certain value, the recursive ctor call is made. I imagine this 'never happens' in practice but because it is in the bytecode it trips up the AspectJ code which inlines this() calls before weaving - since it gets into an infinite loop. For now, just keep track of ctors making the recursive call and so don't get trapped in the infinite loop.
resolved fixed
6ae463a
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-08-05T16:17:39Z
2011-08-05T16:00:00Z
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
if (!decaMC.isStarredAnnotationPattern()) { worthRetrying.add(decaMC); } } } while (!worthRetrying.isEmpty() && modificationOccured) { modificationOccured = false; List<DeclareAnnotation> forRemoval = new ArrayList<DeclareAnnotation>(); for (Iterator<DeclareAnnotation> iter2 = worthRetrying.iterator(); iter2.hasNext();) { DeclareAnnotation decaMC = iter2.next(); if (decaMC.matches(unMangledInterMethod, world)) { LazyMethodGen annotationHolder = locateAnnotationHolderForFieldMunger(clazz, methodctorMunger); if (doesAlreadyHaveAnnotation(annotationHolder, unMangledInterMethod, decaMC, reportedErrors)) { continue; } annotationHolder.addAnnotation(decaMC.getAnnotation()); unMangledInterMethod.addAnnotation(decaMC.getAnnotation()); AsmRelationshipProvider.addDeclareAnnotationRelationship(asmManager, decaMC.getSourceLocation(), unMangledInterMethod.getSourceLocation(), false); isChanged = true; modificationOccured = true; forRemoval.add(decaMC); } worthRetrying.removeAll(forRemoval); } } } return isChanged; }
354,022
Bug 354022 constructor inlining can fail for some groovy built code
The file grails.util.BuildSettings contains bytecode where the constructors are recursive. You can't compile this in Java A() { this(); } but groovy generates some code where it switches on a value in the ctor and if it is a certain value, the recursive ctor call is made. I imagine this 'never happens' in practice but because it is in the bytecode it trips up the AspectJ code which inlines this() calls before weaving - since it gets into an infinite loop. For now, just keep track of ctors making the recursive call and so don't get trapped in the infinite loop.
resolved fixed
6ae463a
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-08-05T16:17:39Z
2011-08-05T16:00:00Z
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
private boolean dontAddTwice(DeclareAnnotation decaF, AnnotationAJ[] dontAddMeTwice) { for (AnnotationAJ ann : dontAddMeTwice) { if (ann != null && decaF.getAnnotation().getTypeName().equals(ann.getTypeName())) { return true; } } return false; } /** * Weave any declare @field statements into the fields of the supplied class. This will attempt to apply them to the ITDs too. * * Interesting case relating to public ITDd fields. The annotations are really stored against the interfieldinit method in the * aspect, but the public field is placed in the target type and then is processed in the 2nd pass over fields that occurs. I * think it would be more expensive to avoid putting the annotation on that inserted public field than just to have it put there * as well as on the interfieldinit method. */ private boolean weaveDeclareAtField(LazyClassGen clazz) { List<Integer> reportedProblems = new ArrayList<Integer>(); List<DeclareAnnotation> allDecafs = world.getDeclareAnnotationOnFields(); if (allDecafs.isEmpty()) { return false; } boolean typeIsChanged = false; List<ConcreteTypeMunger> relevantItdFields = getITDSubset(clazz, ResolvedTypeMunger.Field); if (relevantItdFields != null) {
354,022
Bug 354022 constructor inlining can fail for some groovy built code
The file grails.util.BuildSettings contains bytecode where the constructors are recursive. You can't compile this in Java A() { this(); } but groovy generates some code where it switches on a value in the ctor and if it is a certain value, the recursive ctor call is made. I imagine this 'never happens' in practice but because it is in the bytecode it trips up the AspectJ code which inlines this() calls before weaving - since it gets into an infinite loop. For now, just keep track of ctors making the recursive call and so don't get trapped in the infinite loop.
resolved fixed
6ae463a
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-08-05T16:17:39Z
2011-08-05T16:00:00Z
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
typeIsChanged = weaveAtFieldRepeatedly(allDecafs, relevantItdFields, reportedProblems); } List<DeclareAnnotation> decafs = getMatchingSubset(allDecafs, clazz.getType()); if (decafs.isEmpty()) { return typeIsChanged; } List<BcelField> fields = clazz.getFieldGens(); if (fields != null) { Set<DeclareAnnotation> unusedDecafs = new HashSet<DeclareAnnotation>(); unusedDecafs.addAll(decafs); for (BcelField field : fields) { if (!field.getName().startsWith(NameMangler.PREFIX)) { Set<DeclareAnnotation> worthRetrying = new LinkedHashSet<DeclareAnnotation>(); boolean modificationOccured = false; AnnotationAJ[] dontAddMeTwice = field.getAnnotations(); for (DeclareAnnotation decaf : decafs) { if (decaf.getAnnotation() == null) { return false; } if (decaf.matches(field, world)) { if (decaf.isRemover()) { AnnotationAJ annotation = decaf.getAnnotation(); if (field.hasAnnotation(annotation.getType())) { typeIsChanged = true; field.removeAnnotation(annotation); AsmRelationshipProvider.addDeclareAnnotationFieldRelationship(world.getModelAsAsmManager(), decaf.getSourceLocation(), clazz.getName(), field, true);
354,022
Bug 354022 constructor inlining can fail for some groovy built code
The file grails.util.BuildSettings contains bytecode where the constructors are recursive. You can't compile this in Java A() { this(); } but groovy generates some code where it switches on a value in the ctor and if it is a certain value, the recursive ctor call is made. I imagine this 'never happens' in practice but because it is in the bytecode it trips up the AspectJ code which inlines this() calls before weaving - since it gets into an infinite loop. For now, just keep track of ctors making the recursive call and so don't get trapped in the infinite loop.
resolved fixed
6ae463a
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-08-05T16:17:39Z
2011-08-05T16:00:00Z
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
reportFieldAnnotationWeavingMessage(clazz, field, decaf, true); } else { worthRetrying.add(decaf); } unusedDecafs.remove(decaf); } else { if (!dontAddTwice(decaf, dontAddMeTwice)) { if (doesAlreadyHaveAnnotation(field, decaf, reportedProblems)) { unusedDecafs.remove(decaf); continue; } field.addAnnotation(decaf.getAnnotation()); } AsmRelationshipProvider.addDeclareAnnotationFieldRelationship(world.getModelAsAsmManager(), decaf.getSourceLocation(), clazz.getName(), field, false); reportFieldAnnotationWeavingMessage(clazz, field, decaf, false); typeIsChanged = true; modificationOccured = true; unusedDecafs.remove(decaf); } } else if (!decaf.isStarredAnnotationPattern() || decaf.isRemover()) { worthRetrying.add(decaf); } } while (!worthRetrying.isEmpty() && modificationOccured) { modificationOccured = false; List<DeclareAnnotation> forRemoval = new ArrayList<DeclareAnnotation>();
354,022
Bug 354022 constructor inlining can fail for some groovy built code
The file grails.util.BuildSettings contains bytecode where the constructors are recursive. You can't compile this in Java A() { this(); } but groovy generates some code where it switches on a value in the ctor and if it is a certain value, the recursive ctor call is made. I imagine this 'never happens' in practice but because it is in the bytecode it trips up the AspectJ code which inlines this() calls before weaving - since it gets into an infinite loop. For now, just keep track of ctors making the recursive call and so don't get trapped in the infinite loop.
resolved fixed
6ae463a
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-08-05T16:17:39Z
2011-08-05T16:00:00Z
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
for (Iterator<DeclareAnnotation> iter = worthRetrying.iterator(); iter.hasNext();) { DeclareAnnotation decaF = iter.next(); if (decaF.matches(field, world)) { if (decaF.isRemover()) { AnnotationAJ annotation = decaF.getAnnotation(); if (field.hasAnnotation(annotation.getType())) { typeIsChanged = modificationOccured = true; forRemoval.add(decaF); field.removeAnnotation(annotation); AsmRelationshipProvider.addDeclareAnnotationFieldRelationship(world.getModelAsAsmManager(), decaF.getSourceLocation(), clazz.getName(), field, true); reportFieldAnnotationWeavingMessage(clazz, field, decaF, true); } } else { unusedDecafs.remove(decaF); if (doesAlreadyHaveAnnotation(field, decaF, reportedProblems)) { continue; } field.addAnnotation(decaF.getAnnotation()); AsmRelationshipProvider.addDeclareAnnotationFieldRelationship(world.getModelAsAsmManager(), decaF.getSourceLocation(), clazz.getName(), field, false); typeIsChanged = modificationOccured = true; forRemoval.add(decaF); } } } worthRetrying.removeAll(forRemoval); }
354,022
Bug 354022 constructor inlining can fail for some groovy built code
The file grails.util.BuildSettings contains bytecode where the constructors are recursive. You can't compile this in Java A() { this(); } but groovy generates some code where it switches on a value in the ctor and if it is a certain value, the recursive ctor call is made. I imagine this 'never happens' in practice but because it is in the bytecode it trips up the AspectJ code which inlines this() calls before weaving - since it gets into an infinite loop. For now, just keep track of ctors making the recursive call and so don't get trapped in the infinite loop.
resolved fixed
6ae463a
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-08-05T16:17:39Z
2011-08-05T16:00:00Z
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
} } checkUnusedDeclareAts(unusedDecafs, true); } return typeIsChanged; } /** * Report an error if the reason a "declare @method/ctor/field" was not used was because the member specified does not exist. * This method is passed some set of declare statements that didn't match and a flag indicating whether the set contains declare @field * or declare @method/ctor entries. */ private void checkUnusedDeclareAts(Set<DeclareAnnotation> unusedDecaTs, boolean isDeclareAtField) { for (DeclareAnnotation declA : unusedDecaTs) { boolean shouldCheck = declA.isExactPattern() || declA.getSignaturePattern().getExactDeclaringTypes().size() != 0; if (shouldCheck && declA.getKind() != DeclareAnnotation.AT_CONSTRUCTOR) { if (declA.getSignaturePattern().isMatchOnAnyName()) { shouldCheck = false; } else { List<ExactTypePattern> declaringTypePatterns = declA.getSignaturePattern().getExactDeclaringTypes(); if (declaringTypePatterns.size() == 0) { shouldCheck = false; } else { for (ExactTypePattern exactTypePattern : declaringTypePatterns) { if (exactTypePattern.isIncludeSubtypes()) { shouldCheck = false; break; } }
354,022
Bug 354022 constructor inlining can fail for some groovy built code
The file grails.util.BuildSettings contains bytecode where the constructors are recursive. You can't compile this in Java A() { this(); } but groovy generates some code where it switches on a value in the ctor and if it is a certain value, the recursive ctor call is made. I imagine this 'never happens' in practice but because it is in the bytecode it trips up the AspectJ code which inlines this() calls before weaving - since it gets into an infinite loop. For now, just keep track of ctors making the recursive call and so don't get trapped in the infinite loop.
resolved fixed
6ae463a
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-08-05T16:17:39Z
2011-08-05T16:00:00Z
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
} } } if (shouldCheck) { boolean itdMatch = false; List<ConcreteTypeMunger> lst = clazz.getType().getInterTypeMungers(); for (Iterator<ConcreteTypeMunger> iterator = lst.iterator(); iterator.hasNext() && !itdMatch;) { ConcreteTypeMunger element = iterator.next(); if (element.getMunger() instanceof NewFieldTypeMunger) { NewFieldTypeMunger nftm = (NewFieldTypeMunger) element.getMunger(); itdMatch = declA.matches(nftm.getSignature(), world); } else if (element.getMunger() instanceof NewMethodTypeMunger) { NewMethodTypeMunger nmtm = (NewMethodTypeMunger) element.getMunger(); itdMatch = declA.matches(nmtm.getSignature(), world); } else if (element.getMunger() instanceof NewConstructorTypeMunger) { NewConstructorTypeMunger nctm = (NewConstructorTypeMunger) element.getMunger(); itdMatch = declA.matches(nctm.getSignature(), world); } } if (!itdMatch) { IMessage message = null; if (isDeclareAtField) { message = new Message("The field '" + declA.getSignaturePattern().toString() + "' does not exist", declA.getSourceLocation(), true); } else { message = new Message("The method '" + declA.getSignaturePattern().toString() + "' does not exist", declA.getSourceLocation(), true); } world.getMessageHandler().handleMessage(message);
354,022
Bug 354022 constructor inlining can fail for some groovy built code
The file grails.util.BuildSettings contains bytecode where the constructors are recursive. You can't compile this in Java A() { this(); } but groovy generates some code where it switches on a value in the ctor and if it is a certain value, the recursive ctor call is made. I imagine this 'never happens' in practice but because it is in the bytecode it trips up the AspectJ code which inlines this() calls before weaving - since it gets into an infinite loop. For now, just keep track of ctors making the recursive call and so don't get trapped in the infinite loop.
resolved fixed
6ae463a
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-08-05T16:17:39Z
2011-08-05T16:00:00Z
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
} } } } private void reportFieldAnnotationWeavingMessage(LazyClassGen clazz, BcelField theField, DeclareAnnotation decaf, boolean isRemove) { if (!getWorld().getMessageHandler().isIgnoring(IMessage.WEAVEINFO)) { world.getMessageHandler().handleMessage( WeaveMessage.constructWeavingMessage( isRemove ? WeaveMessage.WEAVEMESSAGE_REMOVES_ANNOTATION : WeaveMessage.WEAVEMESSAGE_ANNOTATES, new String[] { theField.getFieldAsIs().toString() + "' of type '" + clazz.getName(), clazz.getFileName(), decaf.getAnnotationString(), "field", decaf.getAspect().toString(), Utility.beautifyLocation(decaf.getSourceLocation()) })); } } /** * Check if a resolved member (field/method/ctor) already has an annotation, if it does then put out a warning and return true */ private boolean doesAlreadyHaveAnnotation(ResolvedMember rm, DeclareAnnotation deca, List<Integer> reportedProblems) { if (rm.hasAnnotation(deca.getAnnotationType())) { if (world.getLint().elementAlreadyAnnotated.isEnabled()) { Integer uniqueID = new Integer(rm.hashCode() * deca.hashCode()); if (!reportedProblems.contains(uniqueID)) { reportedProblems.add(uniqueID); world.getLint().elementAlreadyAnnotated.signal(new String[] { rm.toString(), deca.getAnnotationType().toString() }, rm.getSourceLocation(), new ISourceLocation[] { deca.getSourceLocation() }); } }
354,022
Bug 354022 constructor inlining can fail for some groovy built code
The file grails.util.BuildSettings contains bytecode where the constructors are recursive. You can't compile this in Java A() { this(); } but groovy generates some code where it switches on a value in the ctor and if it is a certain value, the recursive ctor call is made. I imagine this 'never happens' in practice but because it is in the bytecode it trips up the AspectJ code which inlines this() calls before weaving - since it gets into an infinite loop. For now, just keep track of ctors making the recursive call and so don't get trapped in the infinite loop.
resolved fixed
6ae463a
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-08-05T16:17:39Z
2011-08-05T16:00:00Z
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
return true; } return false; } private boolean doesAlreadyHaveAnnotation(LazyMethodGen rm, ResolvedMember itdfieldsig, DeclareAnnotation deca, List<Integer> reportedProblems) { if (rm != null && rm.hasAnnotation(deca.getAnnotationType())) { if (world.getLint().elementAlreadyAnnotated.isEnabled()) { Integer uniqueID = new Integer(rm.hashCode() * deca.hashCode()); if (!reportedProblems.contains(uniqueID)) { reportedProblems.add(uniqueID); reportedProblems.add(new Integer(itdfieldsig.hashCode() * deca.hashCode())); world.getLint().elementAlreadyAnnotated.signal(new String[] { itdfieldsig.toString(), deca.getAnnotationType().toString() }, rm.getSourceLocation(), new ISourceLocation[] { deca.getSourceLocation() }); } } return true; } return false; } private Set<String> findAspectsForMungers(LazyMethodGen mg) { Set<String> aspectsAffectingType = new HashSet<String>(); for (BcelShadow shadow : mg.matchedShadows) { for (ShadowMunger munger : shadow.getMungers()) { if (munger instanceof BcelAdvice) { BcelAdvice bcelAdvice = (BcelAdvice) munger; if (bcelAdvice.getConcreteAspect() != null) { aspectsAffectingType.add(bcelAdvice.getConcreteAspect().getSignature()); }
354,022
Bug 354022 constructor inlining can fail for some groovy built code
The file grails.util.BuildSettings contains bytecode where the constructors are recursive. You can't compile this in Java A() { this(); } but groovy generates some code where it switches on a value in the ctor and if it is a certain value, the recursive ctor call is made. I imagine this 'never happens' in practice but because it is in the bytecode it trips up the AspectJ code which inlines this() calls before weaving - since it gets into an infinite loop. For now, just keep track of ctors making the recursive call and so don't get trapped in the infinite loop.
resolved fixed
6ae463a
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-08-05T16:17:39Z
2011-08-05T16:00:00Z
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
} else { } } } return aspectsAffectingType; } private boolean inlineSelfConstructors(List<LazyMethodGen> methodGens) { boolean inlinedSomething = false; for (LazyMethodGen methodGen : methodGens) { if (!methodGen.getName().equals("<init>")) { continue; } InstructionHandle ih = findSuperOrThisCall(methodGen); if (ih != null && isThisCall(ih)) { LazyMethodGen donor = getCalledMethod(ih); inlineMethod(donor, methodGen, ih); inlinedSomething = true; } } return inlinedSomething; } private void positionAndImplement(List<BcelShadow> initializationShadows) { for (BcelShadow s : initializationShadows) { positionInitializationShadow(s); s.implement(); } }
354,022
Bug 354022 constructor inlining can fail for some groovy built code
The file grails.util.BuildSettings contains bytecode where the constructors are recursive. You can't compile this in Java A() { this(); } but groovy generates some code where it switches on a value in the ctor and if it is a certain value, the recursive ctor call is made. I imagine this 'never happens' in practice but because it is in the bytecode it trips up the AspectJ code which inlines this() calls before weaving - since it gets into an infinite loop. For now, just keep track of ctors making the recursive call and so don't get trapped in the infinite loop.
resolved fixed
6ae463a
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-08-05T16:17:39Z
2011-08-05T16:00:00Z
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
private void positionInitializationShadow(BcelShadow s) { LazyMethodGen mg = s.getEnclosingMethod(); InstructionHandle call = findSuperOrThisCall(mg); InstructionList body = mg.getBody(); ShadowRange r = new ShadowRange(body); r.associateWithShadow(s); if (s.getKind() == Shadow.PreInitialization) { r.associateWithTargets(Range.genStart(body, body.getStart().getNext()), Range.genEnd(body, call.getPrev())); } else { r.associateWithTargets(Range.genStart(body, call.getNext()), Range.genEnd(body)); } } private boolean isThisCall(InstructionHandle ih) { InvokeInstruction inst = (InvokeInstruction) ih.getInstruction(); return inst.getClassName(cpg).equals(clazz.getName()); } /** * inline a particular call in bytecode. * * @param donor the method we want to inline * @param recipient the method containing the call we want to inline * @param call the instructionHandle in recipient's body holding the call we want to inline. */ public static void inlineMethod(LazyMethodGen donor, LazyMethodGen recipient, InstructionHandle call) {
354,022
Bug 354022 constructor inlining can fail for some groovy built code
The file grails.util.BuildSettings contains bytecode where the constructors are recursive. You can't compile this in Java A() { this(); } but groovy generates some code where it switches on a value in the ctor and if it is a certain value, the recursive ctor call is made. I imagine this 'never happens' in practice but because it is in the bytecode it trips up the AspectJ code which inlines this() calls before weaving - since it gets into an infinite loop. For now, just keep track of ctors making the recursive call and so don't get trapped in the infinite loop.
resolved fixed
6ae463a
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-08-05T16:17:39Z
2011-08-05T16:00:00Z
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
/* * Implementation notes: * * We allocate two slots for every tempvar so we don't screw up longs and doubles which may share space. This could be * conservatively avoided (no reference to a long/double instruction, don't do it) or packed later. Right now we don't * bother to pack. * * Allocate a new var for each formal param of the inlined. Fill with stack contents. Then copy the inlined instructions in * with the appropriate remap table. Any framelocs used by locals in inlined are reallocated to top of frame, */ final InstructionFactory fact = recipient.getEnclosingClass().getFactory(); IntMap frameEnv = new IntMap(); InstructionList argumentStores = genArgumentStores(donor, recipient, frameEnv, fact); InstructionList inlineInstructions = genInlineInstructions(donor, recipient, frameEnv, fact, false); inlineInstructions.insert(argumentStores); recipient.getBody().append(call, inlineInstructions); Utility.deleteInstruction(call, recipient); } /** * Input method is a synchronized method, we remove the bit flag for synchronized and then insert a try..finally block *
354,022
Bug 354022 constructor inlining can fail for some groovy built code
The file grails.util.BuildSettings contains bytecode where the constructors are recursive. You can't compile this in Java A() { this(); } but groovy generates some code where it switches on a value in the ctor and if it is a certain value, the recursive ctor call is made. I imagine this 'never happens' in practice but because it is in the bytecode it trips up the AspectJ code which inlines this() calls before weaving - since it gets into an infinite loop. For now, just keep track of ctors making the recursive call and so don't get trapped in the infinite loop.
resolved fixed
6ae463a
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-08-05T16:17:39Z
2011-08-05T16:00:00Z
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
* Some jumping through firey hoops required - depending on the input code level (1.5 or not) we may or may not be able to use * the LDC instruction that takes a class literal (doesnt on <1.5). * * FIXME asc Before promoting -Xjoinpoints:synchronization to be a standard option, this needs a bunch of tidying up - there is * some duplication that can be removed. */ public static void transformSynchronizedMethod(LazyMethodGen synchronizedMethod) { if (trace.isTraceEnabled()) { trace.enter("transformSynchronizedMethod", synchronizedMethod); } final InstructionFactory fact = synchronizedMethod.getEnclosingClass().getFactory(); InstructionList body = synchronizedMethod.getBody(); InstructionList prepend = new InstructionList(); Type enclosingClassType = BcelWorld.makeBcelType(synchronizedMethod.getEnclosingClass().getType()); if (synchronizedMethod.isStatic()) { if (synchronizedMethod.getEnclosingClass().isAtLeastJava5()) { int slotForLockObject = synchronizedMethod.allocateLocal(enclosingClassType); prepend.append(fact.createConstant(enclosingClassType)); prepend.append(InstructionFactory.createDup(1)); prepend.append(InstructionFactory.createStore(enclosingClassType, slotForLockObject));
354,022
Bug 354022 constructor inlining can fail for some groovy built code
The file grails.util.BuildSettings contains bytecode where the constructors are recursive. You can't compile this in Java A() { this(); } but groovy generates some code where it switches on a value in the ctor and if it is a certain value, the recursive ctor call is made. I imagine this 'never happens' in practice but because it is in the bytecode it trips up the AspectJ code which inlines this() calls before weaving - since it gets into an infinite loop. For now, just keep track of ctors making the recursive call and so don't get trapped in the infinite loop.
resolved fixed
6ae463a
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-08-05T16:17:39Z
2011-08-05T16:00:00Z
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
prepend.append(InstructionFactory.MONITORENTER); InstructionList finallyBlock = new InstructionList(); finallyBlock.append(InstructionFactory.createLoad(Type.getType(java.lang.Class.class), slotForLockObject)); finallyBlock.append(InstructionConstants.MONITOREXIT); finallyBlock.append(InstructionConstants.ATHROW);
354,022
Bug 354022 constructor inlining can fail for some groovy built code
The file grails.util.BuildSettings contains bytecode where the constructors are recursive. You can't compile this in Java A() { this(); } but groovy generates some code where it switches on a value in the ctor and if it is a certain value, the recursive ctor call is made. I imagine this 'never happens' in practice but because it is in the bytecode it trips up the AspectJ code which inlines this() calls before weaving - since it gets into an infinite loop. For now, just keep track of ctors making the recursive call and so don't get trapped in the infinite loop.
resolved fixed
6ae463a
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-08-05T16:17:39Z
2011-08-05T16:00:00Z
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
InstructionHandle walker = body.getStart(); List<InstructionHandle> rets = new ArrayList<InstructionHandle>(); while (walker != null) { if (walker.getInstruction().isReturnInstruction()) { rets.add(walker); } walker = walker.getNext(); } if (!rets.isEmpty()) { for (Iterator<InstructionHandle> iter = rets.iterator(); iter.hasNext();) { InstructionHandle element = iter.next(); InstructionList monitorExitBlock = new InstructionList(); monitorExitBlock.append(InstructionFactory.createLoad(enclosingClassType, slotForLockObject)); monitorExitBlock.append(InstructionConstants.MONITOREXIT); InstructionHandle monitorExitBlockStart = body.insert(element, monitorExitBlock); for (InstructionTargeter targeter : element.getTargetersCopy()) {
354,022
Bug 354022 constructor inlining can fail for some groovy built code
The file grails.util.BuildSettings contains bytecode where the constructors are recursive. You can't compile this in Java A() { this(); } but groovy generates some code where it switches on a value in the ctor and if it is a certain value, the recursive ctor call is made. I imagine this 'never happens' in practice but because it is in the bytecode it trips up the AspectJ code which inlines this() calls before weaving - since it gets into an infinite loop. For now, just keep track of ctors making the recursive call and so don't get trapped in the infinite loop.
resolved fixed
6ae463a
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-08-05T16:17:39Z
2011-08-05T16:00:00Z
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
if (targeter instanceof LocalVariableTag) { } else if (targeter instanceof LineNumberTag) { } else if (targeter instanceof InstructionBranch) { targeter.updateTarget(element, monitorExitBlockStart); } else { throw new BCException("Unexpected targeter encountered during transform: " + targeter); } } } } InstructionHandle finallyStart = finallyBlock.getStart(); InstructionHandle tryPosition = body.getStart(); InstructionHandle catchPosition = body.getEnd(); body.insert(body.getStart(), prepend); synchronizedMethod.getBody().append(finallyBlock); synchronizedMethod.addExceptionHandler(tryPosition, catchPosition, finallyStart, null, false); synchronizedMethod.addExceptionHandler(finallyStart, finallyStart.getNext(), finallyStart, null, false); } else {
354,022
Bug 354022 constructor inlining can fail for some groovy built code
The file grails.util.BuildSettings contains bytecode where the constructors are recursive. You can't compile this in Java A() { this(); } but groovy generates some code where it switches on a value in the ctor and if it is a certain value, the recursive ctor call is made. I imagine this 'never happens' in practice but because it is in the bytecode it trips up the AspectJ code which inlines this() calls before weaving - since it gets into an infinite loop. For now, just keep track of ctors making the recursive call and so don't get trapped in the infinite loop.
resolved fixed
6ae463a
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-08-05T16:17:39Z
2011-08-05T16:00:00Z
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
Type classType = BcelWorld.makeBcelType(synchronizedMethod.getEnclosingClass().getType());
354,022
Bug 354022 constructor inlining can fail for some groovy built code
The file grails.util.BuildSettings contains bytecode where the constructors are recursive. You can't compile this in Java A() { this(); } but groovy generates some code where it switches on a value in the ctor and if it is a certain value, the recursive ctor call is made. I imagine this 'never happens' in practice but because it is in the bytecode it trips up the AspectJ code which inlines this() calls before weaving - since it gets into an infinite loop. For now, just keep track of ctors making the recursive call and so don't get trapped in the infinite loop.
resolved fixed
6ae463a
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-08-05T16:17:39Z
2011-08-05T16:00:00Z
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
Type clazzType = Type.getType(Class.class); InstructionList parttwo = new InstructionList(); parttwo.append(InstructionFactory.createDup(1)); int slotForThis = synchronizedMethod.allocateLocal(classType); parttwo.append(InstructionFactory.createStore(clazzType, slotForThis)); parttwo.append(InstructionFactory.MONITORENTER); String fieldname = synchronizedMethod.getEnclosingClass().allocateField("class$"); FieldGen f = new FieldGen(Modifier.STATIC | Modifier.PRIVATE, Type.getType(Class.class), fieldname, synchronizedMethod.getEnclosingClass().getConstantPool()); synchronizedMethod.getEnclosingClass().addField(f, null); String name = synchronizedMethod.getEnclosingClass().getName(); prepend.append(fact.createGetStatic(name, fieldname, Type.getType(Class.class))); prepend.append(InstructionFactory.createDup(1)); prepend.append(InstructionFactory.createBranchInstruction(Constants.IFNONNULL, parttwo.getStart())); prepend.append(InstructionFactory.POP); prepend.append(fact.createConstant(name));
354,022
Bug 354022 constructor inlining can fail for some groovy built code
The file grails.util.BuildSettings contains bytecode where the constructors are recursive. You can't compile this in Java A() { this(); } but groovy generates some code where it switches on a value in the ctor and if it is a certain value, the recursive ctor call is made. I imagine this 'never happens' in practice but because it is in the bytecode it trips up the AspectJ code which inlines this() calls before weaving - since it gets into an infinite loop. For now, just keep track of ctors making the recursive call and so don't get trapped in the infinite loop.
resolved fixed
6ae463a
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-08-05T16:17:39Z
2011-08-05T16:00:00Z
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
InstructionHandle tryInstruction = prepend.getEnd(); prepend.append(fact.createInvoke("java.lang.Class", "forName", clazzType, new Type[] { Type.getType(String.class) }, Constants.INVOKESTATIC)); InstructionHandle catchInstruction = prepend.getEnd(); prepend.append(InstructionFactory.createDup(1)); prepend.append(fact.createPutStatic(synchronizedMethod.getEnclosingClass().getType().getName(), fieldname, Type.getType(Class.class))); prepend.append(InstructionFactory.createBranchInstruction(Constants.GOTO, parttwo.getStart())); InstructionList catchBlockForLiteralLoadingFail = new InstructionList(); catchBlockForLiteralLoadingFail.append(fact.createNew((ObjectType) Type.getType(NoClassDefFoundError.class))); catchBlockForLiteralLoadingFail.append(InstructionFactory.createDup_1(1)); catchBlockForLiteralLoadingFail.append(InstructionFactory.SWAP); catchBlockForLiteralLoadingFail.append(fact.createInvoke("java.lang.Throwable", "getMessage", Type.getType(String.class), new Type[] {}, Constants.INVOKEVIRTUAL)); catchBlockForLiteralLoadingFail.append(fact.createInvoke("java.lang.NoClassDefFoundError", "<init>", Type.VOID, new Type[] { Type.getType(String.class) }, Constants.INVOKESPECIAL)); catchBlockForLiteralLoadingFail.append(InstructionFactory.ATHROW); InstructionHandle catchBlockStart = catchBlockForLiteralLoadingFail.getStart(); prepend.append(catchBlockForLiteralLoadingFail); prepend.append(parttwo);
354,022
Bug 354022 constructor inlining can fail for some groovy built code
The file grails.util.BuildSettings contains bytecode where the constructors are recursive. You can't compile this in Java A() { this(); } but groovy generates some code where it switches on a value in the ctor and if it is a certain value, the recursive ctor call is made. I imagine this 'never happens' in practice but because it is in the bytecode it trips up the AspectJ code which inlines this() calls before weaving - since it gets into an infinite loop. For now, just keep track of ctors making the recursive call and so don't get trapped in the infinite loop.
resolved fixed
6ae463a
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-08-05T16:17:39Z
2011-08-05T16:00:00Z
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
InstructionList finallyBlock = new InstructionList(); finallyBlock.append(InstructionFactory.createLoad(Type.getType(java.lang.Class.class), slotForThis)); finallyBlock.append(InstructionConstants.MONITOREXIT); finallyBlock.append(InstructionConstants.ATHROW);
354,022
Bug 354022 constructor inlining can fail for some groovy built code
The file grails.util.BuildSettings contains bytecode where the constructors are recursive. You can't compile this in Java A() { this(); } but groovy generates some code where it switches on a value in the ctor and if it is a certain value, the recursive ctor call is made. I imagine this 'never happens' in practice but because it is in the bytecode it trips up the AspectJ code which inlines this() calls before weaving - since it gets into an infinite loop. For now, just keep track of ctors making the recursive call and so don't get trapped in the infinite loop.
resolved fixed
6ae463a
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-08-05T16:17:39Z
2011-08-05T16:00:00Z
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
InstructionHandle walker = body.getStart(); List<InstructionHandle> rets = new ArrayList<InstructionHandle>(); while (walker != null) { if (walker.getInstruction().isReturnInstruction()) { rets.add(walker); } walker = walker.getNext(); } if (rets.size() > 0) { for (InstructionHandle ret : rets) { InstructionList monitorExitBlock = new InstructionList(); monitorExitBlock.append(InstructionFactory.createLoad(classType, slotForThis)); monitorExitBlock.append(InstructionConstants.MONITOREXIT);
354,022
Bug 354022 constructor inlining can fail for some groovy built code
The file grails.util.BuildSettings contains bytecode where the constructors are recursive. You can't compile this in Java A() { this(); } but groovy generates some code where it switches on a value in the ctor and if it is a certain value, the recursive ctor call is made. I imagine this 'never happens' in practice but because it is in the bytecode it trips up the AspectJ code which inlines this() calls before weaving - since it gets into an infinite loop. For now, just keep track of ctors making the recursive call and so don't get trapped in the infinite loop.
resolved fixed
6ae463a
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-08-05T16:17:39Z
2011-08-05T16:00:00Z
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
InstructionHandle monitorExitBlockStart = body.insert(ret, monitorExitBlock); for (InstructionTargeter targeter : ret.getTargetersCopy()) { if (targeter instanceof LocalVariableTag) { } else if (targeter instanceof LineNumberTag) { } else if (targeter instanceof InstructionBranch) { targeter.updateTarget(ret, monitorExitBlockStart); } else { throw new BCException("Unexpected targeter encountered during transform: " + targeter); } } } } InstructionHandle finallyStart = finallyBlock.getStart();
354,022
Bug 354022 constructor inlining can fail for some groovy built code
The file grails.util.BuildSettings contains bytecode where the constructors are recursive. You can't compile this in Java A() { this(); } but groovy generates some code where it switches on a value in the ctor and if it is a certain value, the recursive ctor call is made. I imagine this 'never happens' in practice but because it is in the bytecode it trips up the AspectJ code which inlines this() calls before weaving - since it gets into an infinite loop. For now, just keep track of ctors making the recursive call and so don't get trapped in the infinite loop.
resolved fixed
6ae463a
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-08-05T16:17:39Z
2011-08-05T16:00:00Z
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
InstructionHandle tryPosition = body.getStart(); InstructionHandle catchPosition = body.getEnd(); body.insert(body.getStart(), prepend); synchronizedMethod.getBody().append(finallyBlock); synchronizedMethod.addExceptionHandler(tryPosition, catchPosition, finallyStart, null, false); synchronizedMethod.addExceptionHandler(tryInstruction, catchInstruction, catchBlockStart, (ObjectType) Type.getType(ClassNotFoundException.class), true); synchronizedMethod.addExceptionHandler(finallyStart, finallyStart.getNext(), finallyStart, null, false); } } else { Type classType = BcelWorld.makeBcelType(synchronizedMethod.getEnclosingClass().getType()); prepend.append(InstructionFactory.createLoad(classType, 0)); prepend.append(InstructionFactory.createDup(1)); int slotForThis = synchronizedMethod.allocateLocal(classType); prepend.append(InstructionFactory.createStore(classType, slotForThis)); prepend.append(InstructionFactory.MONITORENTER);
354,022
Bug 354022 constructor inlining can fail for some groovy built code
The file grails.util.BuildSettings contains bytecode where the constructors are recursive. You can't compile this in Java A() { this(); } but groovy generates some code where it switches on a value in the ctor and if it is a certain value, the recursive ctor call is made. I imagine this 'never happens' in practice but because it is in the bytecode it trips up the AspectJ code which inlines this() calls before weaving - since it gets into an infinite loop. For now, just keep track of ctors making the recursive call and so don't get trapped in the infinite loop.
resolved fixed
6ae463a
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-08-05T16:17:39Z
2011-08-05T16:00:00Z
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
InstructionList finallyBlock = new InstructionList(); finallyBlock.append(InstructionFactory.createLoad(classType, slotForThis)); finallyBlock.append(InstructionConstants.MONITOREXIT); finallyBlock.append(InstructionConstants.ATHROW); InstructionHandle walker = body.getStart(); List<InstructionHandle> rets = new ArrayList<InstructionHandle>(); while (walker != null) { if (walker.getInstruction().isReturnInstruction()) {
354,022
Bug 354022 constructor inlining can fail for some groovy built code
The file grails.util.BuildSettings contains bytecode where the constructors are recursive. You can't compile this in Java A() { this(); } but groovy generates some code where it switches on a value in the ctor and if it is a certain value, the recursive ctor call is made. I imagine this 'never happens' in practice but because it is in the bytecode it trips up the AspectJ code which inlines this() calls before weaving - since it gets into an infinite loop. For now, just keep track of ctors making the recursive call and so don't get trapped in the infinite loop.
resolved fixed
6ae463a
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-08-05T16:17:39Z
2011-08-05T16:00:00Z
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
rets.add(walker); } walker = walker.getNext(); } if (!rets.isEmpty()) { for (Iterator<InstructionHandle> iter = rets.iterator(); iter.hasNext();) { InstructionHandle element = iter.next(); InstructionList monitorExitBlock = new InstructionList(); monitorExitBlock.append(InstructionFactory.createLoad(classType, slotForThis)); monitorExitBlock.append(InstructionConstants.MONITOREXIT); InstructionHandle monitorExitBlockStart = body.insert(element, monitorExitBlock); for (InstructionTargeter targeter : element.getTargetersCopy()) { if (targeter instanceof LocalVariableTag) { } else if (targeter instanceof LineNumberTag) {
354,022
Bug 354022 constructor inlining can fail for some groovy built code
The file grails.util.BuildSettings contains bytecode where the constructors are recursive. You can't compile this in Java A() { this(); } but groovy generates some code where it switches on a value in the ctor and if it is a certain value, the recursive ctor call is made. I imagine this 'never happens' in practice but because it is in the bytecode it trips up the AspectJ code which inlines this() calls before weaving - since it gets into an infinite loop. For now, just keep track of ctors making the recursive call and so don't get trapped in the infinite loop.
resolved fixed
6ae463a
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-08-05T16:17:39Z
2011-08-05T16:00:00Z
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
} else if (targeter instanceof InstructionBranch) { targeter.updateTarget(element, monitorExitBlockStart); } else { throw new BCException("Unexpected targeter encountered during transform: " + targeter); } } } } InstructionHandle finallyStart = finallyBlock.getStart(); InstructionHandle tryPosition = body.getStart(); InstructionHandle catchPosition = body.getEnd(); body.insert(body.getStart(), prepend); synchronizedMethod.getBody().append(finallyBlock); synchronizedMethod.addExceptionHandler(tryPosition, catchPosition, finallyStart, null, false); synchronizedMethod.addExceptionHandler(finallyStart, finallyStart.getNext(), finallyStart, null, false); } if (trace.isTraceEnabled()) {
354,022
Bug 354022 constructor inlining can fail for some groovy built code
The file grails.util.BuildSettings contains bytecode where the constructors are recursive. You can't compile this in Java A() { this(); } but groovy generates some code where it switches on a value in the ctor and if it is a certain value, the recursive ctor call is made. I imagine this 'never happens' in practice but because it is in the bytecode it trips up the AspectJ code which inlines this() calls before weaving - since it gets into an infinite loop. For now, just keep track of ctors making the recursive call and so don't get trapped in the infinite loop.
resolved fixed
6ae463a
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-08-05T16:17:39Z
2011-08-05T16:00:00Z
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
trace.exit("transformSynchronizedMethod"); } } /** * generate the instructions to be inlined. * * @param donor the method from which we will copy (and adjust frame and jumps) instructions. * @param recipient the method the instructions will go into. Used to get the frame size so we can allocate new frame locations * for locals in donor. * @param frameEnv an environment to map from donor frame to recipient frame, initially populated with argument locations. * @param fact an instruction factory for recipient */ static InstructionList genInlineInstructions(LazyMethodGen donor, LazyMethodGen recipient, IntMap frameEnv, InstructionFactory fact, boolean keepReturns) { InstructionList footer = new InstructionList(); InstructionHandle end = footer.append(InstructionConstants.NOP); InstructionList ret = new InstructionList(); InstructionList sourceList = donor.getBody(); Map<InstructionHandle, InstructionHandle> srcToDest = new HashMap<InstructionHandle, InstructionHandle>(); ConstantPool donorCpg = donor.getEnclosingClass().getConstantPool(); ConstantPool recipientCpg = recipient.getEnclosingClass().getConstantPool(); boolean isAcrossClass = donorCpg != recipientCpg; for (InstructionHandle src = sourceList.getStart(); src != null; src = src.getNext()) { Instruction fresh = Utility.copyInstruction(src.getInstruction()); InstructionHandle dest; if (fresh.isConstantPoolInstruction()) {
354,022
Bug 354022 constructor inlining can fail for some groovy built code
The file grails.util.BuildSettings contains bytecode where the constructors are recursive. You can't compile this in Java A() { this(); } but groovy generates some code where it switches on a value in the ctor and if it is a certain value, the recursive ctor call is made. I imagine this 'never happens' in practice but because it is in the bytecode it trips up the AspectJ code which inlines this() calls before weaving - since it gets into an infinite loop. For now, just keep track of ctors making the recursive call and so don't get trapped in the infinite loop.
resolved fixed
6ae463a
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-08-05T16:17:39Z
2011-08-05T16:00:00Z
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
if (isAcrossClass) { InstructionCP cpi = (InstructionCP) fresh; cpi.setIndex(recipientCpg.addConstant(donorCpg.getConstant(cpi.getIndex()), donorCpg)); } } if (src.getInstruction() == Range.RANGEINSTRUCTION) { dest = ret.append(Range.RANGEINSTRUCTION); } else if (fresh.isReturnInstruction()) { if (keepReturns) { dest = ret.append(fresh); } else { dest = ret.append(InstructionFactory.createBranchInstruction(Constants.GOTO, end)); } } else if (fresh instanceof InstructionBranch) { dest = ret.append((InstructionBranch) fresh); } else if (fresh.isLocalVariableInstruction() || fresh instanceof RET) { int oldIndex = fresh.getIndex(); int freshIndex; if (!frameEnv.hasKey(oldIndex)) { freshIndex = recipient.allocateLocal(2); frameEnv.put(oldIndex, freshIndex); } else { freshIndex = frameEnv.get(oldIndex); } if (fresh instanceof RET) { fresh.setIndex(freshIndex);
354,022
Bug 354022 constructor inlining can fail for some groovy built code
The file grails.util.BuildSettings contains bytecode where the constructors are recursive. You can't compile this in Java A() { this(); } but groovy generates some code where it switches on a value in the ctor and if it is a certain value, the recursive ctor call is made. I imagine this 'never happens' in practice but because it is in the bytecode it trips up the AspectJ code which inlines this() calls before weaving - since it gets into an infinite loop. For now, just keep track of ctors making the recursive call and so don't get trapped in the infinite loop.
resolved fixed
6ae463a
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-08-05T16:17:39Z
2011-08-05T16:00:00Z
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
} else { fresh = ((InstructionLV) fresh).setIndexAndCopyIfNecessary(freshIndex); } dest = ret.append(fresh); } else { dest = ret.append(fresh); } srcToDest.put(src, dest); } Map<Tag, Tag> tagMap = new HashMap<Tag, Tag>(); Map<BcelShadow, BcelShadow> shadowMap = new HashMap<BcelShadow, BcelShadow>(); for (InstructionHandle dest = ret.getStart(), src = sourceList.getStart(); dest != null; dest = dest.getNext(), src = src .getNext()) { Instruction inst = dest.getInstruction(); if (inst instanceof InstructionBranch) { InstructionBranch branch = (InstructionBranch) inst; InstructionHandle oldTarget = branch.getTarget(); InstructionHandle newTarget = srcToDest.get(oldTarget); if (newTarget == null) { } else { branch.setTarget(newTarget); if (branch instanceof InstructionSelect) { InstructionSelect select = (InstructionSelect) branch; InstructionHandle[] oldTargets = select.getTargets(); for (int k = oldTargets.length - 1; k >= 0; k--) { select.setTarget(k, srcToDest.get(oldTargets[k]));
354,022
Bug 354022 constructor inlining can fail for some groovy built code
The file grails.util.BuildSettings contains bytecode where the constructors are recursive. You can't compile this in Java A() { this(); } but groovy generates some code where it switches on a value in the ctor and if it is a certain value, the recursive ctor call is made. I imagine this 'never happens' in practice but because it is in the bytecode it trips up the AspectJ code which inlines this() calls before weaving - since it gets into an infinite loop. For now, just keep track of ctors making the recursive call and so don't get trapped in the infinite loop.
resolved fixed
6ae463a
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-08-05T16:17:39Z
2011-08-05T16:00:00Z
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
} } } } Iterator<InstructionTargeter> tIter = src.getTargeters().iterator(); while (tIter.hasNext()) { InstructionTargeter old = tIter.next(); if (old instanceof Tag) { Tag oldTag = (Tag) old; Tag fresh = tagMap.get(oldTag); if (fresh == null) { fresh = oldTag.copy(); if (old instanceof LocalVariableTag) { LocalVariableTag lvTag = (LocalVariableTag) old; LocalVariableTag lvTagFresh = (LocalVariableTag) fresh; if (lvTag.getSlot() == 0) { fresh = new LocalVariableTag(lvTag.getRealType().getSignature(), "ajc$aspectInstance", frameEnv.get(lvTag.getSlot()), 0); } else { lvTagFresh.updateSlot(frameEnv.get(lvTag.getSlot())); } } tagMap.put(oldTag, fresh); }
354,022
Bug 354022 constructor inlining can fail for some groovy built code
The file grails.util.BuildSettings contains bytecode where the constructors are recursive. You can't compile this in Java A() { this(); } but groovy generates some code where it switches on a value in the ctor and if it is a certain value, the recursive ctor call is made. I imagine this 'never happens' in practice but because it is in the bytecode it trips up the AspectJ code which inlines this() calls before weaving - since it gets into an infinite loop. For now, just keep track of ctors making the recursive call and so don't get trapped in the infinite loop.
resolved fixed
6ae463a
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-08-05T16:17:39Z
2011-08-05T16:00:00Z
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
dest.addTargeter(fresh); } else if (old instanceof ExceptionRange) { ExceptionRange er = (ExceptionRange) old; if (er.getStart() == src) { ExceptionRange freshEr = new ExceptionRange(recipient.getBody(), er.getCatchType(), er.getPriority()); freshEr.associateWithTargets(dest, srcToDest.get(er.getEnd()), srcToDest.get(er.getHandler())); } } else if (old instanceof ShadowRange) { ShadowRange oldRange = (ShadowRange) old; if (oldRange.getStart() == src) { BcelShadow oldShadow = oldRange.getShadow(); BcelShadow freshEnclosing = oldShadow.getEnclosingShadow() == null ? null : (BcelShadow) shadowMap .get(oldShadow.getEnclosingShadow()); BcelShadow freshShadow = oldShadow.copyInto(recipient, freshEnclosing); ShadowRange freshRange = new ShadowRange(recipient.getBody()); freshRange.associateWithShadow(freshShadow); freshRange.associateWithTargets(dest, srcToDest.get(oldRange.getEnd())); shadowMap.put(oldShadow, freshShadow); } } } } if (!keepReturns) {
354,022
Bug 354022 constructor inlining can fail for some groovy built code
The file grails.util.BuildSettings contains bytecode where the constructors are recursive. You can't compile this in Java A() { this(); } but groovy generates some code where it switches on a value in the ctor and if it is a certain value, the recursive ctor call is made. I imagine this 'never happens' in practice but because it is in the bytecode it trips up the AspectJ code which inlines this() calls before weaving - since it gets into an infinite loop. For now, just keep track of ctors making the recursive call and so don't get trapped in the infinite loop.
resolved fixed
6ae463a
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-08-05T16:17:39Z
2011-08-05T16:00:00Z
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
ret.append(footer); } return ret; }
354,022
Bug 354022 constructor inlining can fail for some groovy built code
The file grails.util.BuildSettings contains bytecode where the constructors are recursive. You can't compile this in Java A() { this(); } but groovy generates some code where it switches on a value in the ctor and if it is a certain value, the recursive ctor call is made. I imagine this 'never happens' in practice but because it is in the bytecode it trips up the AspectJ code which inlines this() calls before weaving - since it gets into an infinite loop. For now, just keep track of ctors making the recursive call and so don't get trapped in the infinite loop.
resolved fixed
6ae463a
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-08-05T16:17:39Z
2011-08-05T16:00:00Z
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
/** * generate the argument stores in preparation for inlining. * * @param donor the method we will inline from. Used to get the signature. * @param recipient the method we will inline into. Used to get the frame size so we can allocate fresh locations. * @param frameEnv an empty environment we populate with a map from donor frame to recipient frame.
354,022
Bug 354022 constructor inlining can fail for some groovy built code
The file grails.util.BuildSettings contains bytecode where the constructors are recursive. You can't compile this in Java A() { this(); } but groovy generates some code where it switches on a value in the ctor and if it is a certain value, the recursive ctor call is made. I imagine this 'never happens' in practice but because it is in the bytecode it trips up the AspectJ code which inlines this() calls before weaving - since it gets into an infinite loop. For now, just keep track of ctors making the recursive call and so don't get trapped in the infinite loop.
resolved fixed
6ae463a
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-08-05T16:17:39Z
2011-08-05T16:00:00Z
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
* @param fact an instruction factory for recipient */ private static InstructionList genArgumentStores(LazyMethodGen donor, LazyMethodGen recipient, IntMap frameEnv, InstructionFactory fact) { InstructionList ret = new InstructionList(); int donorFramePos = 0; if (!donor.isStatic()) { int targetSlot = recipient.allocateLocal(Type.OBJECT); ret.insert(InstructionFactory.createStore(Type.OBJECT, targetSlot)); frameEnv.put(donorFramePos, targetSlot); donorFramePos += 1; } Type[] argTypes = donor.getArgumentTypes(); for (int i = 0, len = argTypes.length; i < len; i++) { Type argType = argTypes[i]; int argSlot = recipient.allocateLocal(argType); ret.insert(InstructionFactory.createStore(argType, argSlot)); frameEnv.put(donorFramePos, argSlot); donorFramePos += argType.getSize(); } return ret; } /** * get a called method: Assumes the called method is in this class, and the reference to it is exact (a la INVOKESPECIAL). * * @param ih The InvokeInstruction instructionHandle pointing to the called method. */ private LazyMethodGen getCalledMethod(InstructionHandle ih) { InvokeInstruction inst = (InvokeInstruction) ih.getInstruction();
354,022
Bug 354022 constructor inlining can fail for some groovy built code
The file grails.util.BuildSettings contains bytecode where the constructors are recursive. You can't compile this in Java A() { this(); } but groovy generates some code where it switches on a value in the ctor and if it is a certain value, the recursive ctor call is made. I imagine this 'never happens' in practice but because it is in the bytecode it trips up the AspectJ code which inlines this() calls before weaving - since it gets into an infinite loop. For now, just keep track of ctors making the recursive call and so don't get trapped in the infinite loop.
resolved fixed
6ae463a
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-08-05T16:17:39Z
2011-08-05T16:00:00Z
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
String methodName = inst.getName(cpg); String signature = inst.getSignature(cpg); return clazz.getLazyMethodGen(methodName, signature); } private void weaveInAddedMethods() { Collections.sort(addedLazyMethodGens, new Comparator<LazyMethodGen>() { public int compare(LazyMethodGen aa, LazyMethodGen bb) { int i = aa.getName().compareTo(bb.getName()); if (i != 0) { return i; } return aa.getSignature().compareTo(bb.getSignature()); } }); for (LazyMethodGen addedMember : addedLazyMethodGens) { clazz.addMethodGen(addedMember); } }
354,022
Bug 354022 constructor inlining can fail for some groovy built code
The file grails.util.BuildSettings contains bytecode where the constructors are recursive. You can't compile this in Java A() { this(); } but groovy generates some code where it switches on a value in the ctor and if it is a certain value, the recursive ctor call is made. I imagine this 'never happens' in practice but because it is in the bytecode it trips up the AspectJ code which inlines this() calls before weaving - since it gets into an infinite loop. For now, just keep track of ctors making the recursive call and so don't get trapped in the infinite loop.
resolved fixed
6ae463a
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-08-05T16:17:39Z
2011-08-05T16:00:00Z
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
/** * Returns null if this is not a Java constructor, and then we won't weave into it at all */ private InstructionHandle findSuperOrThisCall(LazyMethodGen mg) { int depth = 1; InstructionHandle start = mg.getBody().getStart(); while (true) { if (start == null) { return null; } Instruction inst = start.getInstruction(); if (inst.opcode == Constants.INVOKESPECIAL && ((InvokeInstruction) inst).getName(cpg).equals("<init>")) { depth--; if (depth == 0) { return start; } } else if (inst.opcode == Constants.NEW) { depth++; } start = start.getNext(); } } private boolean match(LazyMethodGen mg) { BcelShadow enclosingShadow;
354,022
Bug 354022 constructor inlining can fail for some groovy built code
The file grails.util.BuildSettings contains bytecode where the constructors are recursive. You can't compile this in Java A() { this(); } but groovy generates some code where it switches on a value in the ctor and if it is a certain value, the recursive ctor call is made. I imagine this 'never happens' in practice but because it is in the bytecode it trips up the AspectJ code which inlines this() calls before weaving - since it gets into an infinite loop. For now, just keep track of ctors making the recursive call and so don't get trapped in the infinite loop.
resolved fixed
6ae463a
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-08-05T16:17:39Z
2011-08-05T16:00:00Z
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
List<BcelShadow> shadowAccumulator = new ArrayList<BcelShadow>(); boolean isOverweaving = world.isOverWeaving(); boolean startsAngly = mg.getName().charAt(0) == '<'; if (startsAngly && mg.getName().equals("<init>")) { return matchInit(mg, shadowAccumulator); } else if (!shouldWeaveBody(mg)) { return false; } else { if (startsAngly && mg.getName().equals("<clinit>")) { enclosingShadow = BcelShadow.makeStaticInitialization(world, mg); } else if (mg.isAdviceMethod()) { enclosingShadow = BcelShadow.makeAdviceExecution(world, mg); } else { AjAttribute.EffectiveSignatureAttribute effective = mg.getEffectiveSignature(); if (effective == null) { if (isOverweaving && mg.getName().startsWith(NameMangler.PREFIX)) { return false; } enclosingShadow = BcelShadow.makeMethodExecution(world, mg, !canMatchBodyShadows); } else if (effective.isWeaveBody()) { ResolvedMember rm = effective.getEffectiveSignature();
354,022
Bug 354022 constructor inlining can fail for some groovy built code
The file grails.util.BuildSettings contains bytecode where the constructors are recursive. You can't compile this in Java A() { this(); } but groovy generates some code where it switches on a value in the ctor and if it is a certain value, the recursive ctor call is made. I imagine this 'never happens' in practice but because it is in the bytecode it trips up the AspectJ code which inlines this() calls before weaving - since it gets into an infinite loop. For now, just keep track of ctors making the recursive call and so don't get trapped in the infinite loop.
resolved fixed
6ae463a
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-08-05T16:17:39Z
2011-08-05T16:00:00Z
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
fixParameterNamesForResolvedMember(rm, mg.getMemberView()); fixAnnotationsForResolvedMember(rm, mg.getMemberView()); enclosingShadow = BcelShadow.makeShadowForMethod(world, mg, effective.getShadowKind(), rm); } else { return false; } } if (canMatchBodyShadows) { for (InstructionHandle h = mg.getBody().getStart(); h != null; h = h.getNext()) { match(mg, h, enclosingShadow, shadowAccumulator); } } if (canMatch(enclosingShadow.getKind()) && !(mg.getName().charAt(0) == 'a' && mg.getName().startsWith("ajc$interFieldInit"))) { if (match(enclosingShadow, shadowAccumulator)) { enclosingShadow.init(); } } mg.matchedShadows = shadowAccumulator; return !shadowAccumulator.isEmpty(); } } private boolean matchInit(LazyMethodGen mg, List<BcelShadow> shadowAccumulator) { BcelShadow enclosingShadow; InstructionHandle superOrThisCall = findSuperOrThisCall(mg); if (superOrThisCall == null) {
354,022
Bug 354022 constructor inlining can fail for some groovy built code
The file grails.util.BuildSettings contains bytecode where the constructors are recursive. You can't compile this in Java A() { this(); } but groovy generates some code where it switches on a value in the ctor and if it is a certain value, the recursive ctor call is made. I imagine this 'never happens' in practice but because it is in the bytecode it trips up the AspectJ code which inlines this() calls before weaving - since it gets into an infinite loop. For now, just keep track of ctors making the recursive call and so don't get trapped in the infinite loop.
resolved fixed
6ae463a
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-08-05T16:17:39Z
2011-08-05T16:00:00Z
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
return false; } enclosingShadow = BcelShadow.makeConstructorExecution(world, mg, superOrThisCall); if (mg.getEffectiveSignature() != null) { enclosingShadow.setMatchingSignature(mg.getEffectiveSignature().getEffectiveSignature()); } boolean beforeSuperOrThisCall = true; if (shouldWeaveBody(mg)) { if (canMatchBodyShadows) { for (InstructionHandle h = mg.getBody().getStart(); h != null; h = h.getNext()) { if (h == superOrThisCall) { beforeSuperOrThisCall = false; continue; } match(mg, h, beforeSuperOrThisCall ? null : enclosingShadow, shadowAccumulator); } } if (canMatch(Shadow.ConstructorExecution)) { match(enclosingShadow, shadowAccumulator); } } if (!isThisCall(superOrThisCall)) { InstructionHandle curr = enclosingShadow.getRange().getStart(); for (Iterator<IfaceInitList> i = addedSuperInitializersAsList.iterator(); i.hasNext();) { IfaceInitList l = i.next(); Member ifaceInitSig = AjcMemberMaker.interfaceConstructor(l.onType); BcelShadow initShadow = BcelShadow.makeIfaceInitialization(world, mg, ifaceInitSig);
354,022
Bug 354022 constructor inlining can fail for some groovy built code
The file grails.util.BuildSettings contains bytecode where the constructors are recursive. You can't compile this in Java A() { this(); } but groovy generates some code where it switches on a value in the ctor and if it is a certain value, the recursive ctor call is made. I imagine this 'never happens' in practice but because it is in the bytecode it trips up the AspectJ code which inlines this() calls before weaving - since it gets into an infinite loop. For now, just keep track of ctors making the recursive call and so don't get trapped in the infinite loop.
resolved fixed
6ae463a
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-08-05T16:17:39Z
2011-08-05T16:00:00Z
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
InstructionList inits = genInitInstructions(l.list, false); if (match(initShadow, shadowAccumulator) || !inits.isEmpty()) { initShadow.initIfaceInitializer(curr); initShadow.getRange().insert(inits, Range.OutsideBefore); } } InstructionList inits = genInitInstructions(addedThisInitializers, false); enclosingShadow.getRange().insert(inits, Range.OutsideBefore); } boolean addedInitialization = match(BcelShadow.makeUnfinishedInitialization(world, mg), initializationShadows); addedInitialization |= match(BcelShadow.makeUnfinishedPreinitialization(world, mg), initializationShadows); mg.matchedShadows = shadowAccumulator; return addedInitialization || !shadowAccumulator.isEmpty(); } private boolean shouldWeaveBody(LazyMethodGen mg) { if (mg.isBridgeMethod()) { return false; } if (mg.isAjSynthetic()) { return mg.getName().equals("<clinit>"); } AjAttribute.EffectiveSignatureAttribute a = mg.getEffectiveSignature();
354,022
Bug 354022 constructor inlining can fail for some groovy built code
The file grails.util.BuildSettings contains bytecode where the constructors are recursive. You can't compile this in Java A() { this(); } but groovy generates some code where it switches on a value in the ctor and if it is a certain value, the recursive ctor call is made. I imagine this 'never happens' in practice but because it is in the bytecode it trips up the AspectJ code which inlines this() calls before weaving - since it gets into an infinite loop. For now, just keep track of ctors making the recursive call and so don't get trapped in the infinite loop.
resolved fixed
6ae463a
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-08-05T16:17:39Z
2011-08-05T16:00:00Z
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
if (a != null) { return a.isWeaveBody(); } return true; } /** * first sorts the mungers, then gens the initializers in the right order */ private InstructionList genInitInstructions(List<ConcreteTypeMunger> list, boolean isStatic) { list = PartialOrder.sort(list); if (list == null) { throw new BCException("circularity in inter-types"); } InstructionList ret = new InstructionList(); for (ConcreteTypeMunger cmunger : list) { NewFieldTypeMunger munger = (NewFieldTypeMunger) cmunger.getMunger(); ResolvedMember initMethod = munger.getInitMethod(cmunger.getAspectType()); if (!isStatic) { ret.append(InstructionConstants.ALOAD_0); } ret.append(Utility.createInvoke(fact, world, initMethod)); } return ret; } private void match(LazyMethodGen mg, InstructionHandle ih, BcelShadow enclosingShadow, List<BcelShadow> shadowAccumulator) { Instruction i = ih.getInstruction(); if (canMatch(Shadow.ExceptionHandler) && !Range.isRangeHandle(ih)) { Set<InstructionTargeter> targeters = ih.getTargetersCopy(); for (InstructionTargeter t : targeters) {
354,022
Bug 354022 constructor inlining can fail for some groovy built code
The file grails.util.BuildSettings contains bytecode where the constructors are recursive. You can't compile this in Java A() { this(); } but groovy generates some code where it switches on a value in the ctor and if it is a certain value, the recursive ctor call is made. I imagine this 'never happens' in practice but because it is in the bytecode it trips up the AspectJ code which inlines this() calls before weaving - since it gets into an infinite loop. For now, just keep track of ctors making the recursive call and so don't get trapped in the infinite loop.
resolved fixed
6ae463a
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-08-05T16:17:39Z
2011-08-05T16:00:00Z
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
if (t instanceof ExceptionRange) { ExceptionRange er = (ExceptionRange) t; if (er.getCatchType() == null) { continue; } if (isInitFailureHandler(ih)) { return; } if (!ih.getInstruction().isStoreInstruction() && ih.getInstruction().getOpcode() != Constants.NOP) { mg.getBody().insert(ih, InstructionConstants.NOP); InstructionHandle newNOP = ih.getPrev(); er.updateTarget(ih, newNOP, mg.getBody()); for (InstructionTargeter t2 : targeters) { newNOP.addTargeter(t2); }
354,022
Bug 354022 constructor inlining can fail for some groovy built code
The file grails.util.BuildSettings contains bytecode where the constructors are recursive. You can't compile this in Java A() { this(); } but groovy generates some code where it switches on a value in the ctor and if it is a certain value, the recursive ctor call is made. I imagine this 'never happens' in practice but because it is in the bytecode it trips up the AspectJ code which inlines this() calls before weaving - since it gets into an infinite loop. For now, just keep track of ctors making the recursive call and so don't get trapped in the infinite loop.
resolved fixed
6ae463a
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-08-05T16:17:39Z
2011-08-05T16:00:00Z
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
ih.removeAllTargeters(); match(BcelShadow.makeExceptionHandler(world, er, mg, newNOP, enclosingShadow), shadowAccumulator); } else { match(BcelShadow.makeExceptionHandler(world, er, mg, ih, enclosingShadow), shadowAccumulator); } } } } if ((i instanceof FieldInstruction) && (canMatch(Shadow.FieldGet) || canMatch(Shadow.FieldSet))) { FieldInstruction fi = (FieldInstruction) i; if (fi.opcode == Constants.PUTFIELD || fi.opcode == Constants.PUTSTATIC) { InstructionHandle prevHandle = ih.getPrev(); Instruction prevI = prevHandle.getInstruction(); if (Utility.isConstantPushInstruction(prevI)) { Member field = BcelWorld.makeFieldJoinPointSignature(clazz, (FieldInstruction) i); ResolvedMember resolvedField = field.resolve(world); if (resolvedField == null) { } else if (Modifier.isFinal(resolvedField.getModifiers())) {
354,022
Bug 354022 constructor inlining can fail for some groovy built code
The file grails.util.BuildSettings contains bytecode where the constructors are recursive. You can't compile this in Java A() { this(); } but groovy generates some code where it switches on a value in the ctor and if it is a certain value, the recursive ctor call is made. I imagine this 'never happens' in practice but because it is in the bytecode it trips up the AspectJ code which inlines this() calls before weaving - since it gets into an infinite loop. For now, just keep track of ctors making the recursive call and so don't get trapped in the infinite loop.
resolved fixed
6ae463a
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-08-05T16:17:39Z
2011-08-05T16:00:00Z
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
} else { if (canMatch(Shadow.FieldSet)) { matchSetInstruction(mg, ih, enclosingShadow, shadowAccumulator); } } } else { if (canMatch(Shadow.FieldSet)) { matchSetInstruction(mg, ih, enclosingShadow, shadowAccumulator); } } } else { if (canMatch(Shadow.FieldGet)) { matchGetInstruction(mg, ih, enclosingShadow, shadowAccumulator); } } } else if (i instanceof InvokeInstruction) { InvokeInstruction ii = (InvokeInstruction) i; if (ii.getMethodName(clazz.getConstantPool()).equals("<init>")) { if (canMatch(Shadow.ConstructorCall)) { match(BcelShadow.makeConstructorCall(world, mg, ih, enclosingShadow), shadowAccumulator); } } else if (ii.opcode == Constants.INVOKESPECIAL) { String onTypeName = ii.getClassName(cpg); if (onTypeName.equals(mg.getEnclosingClass().getName())) { matchInvokeInstruction(mg, ih, ii, enclosingShadow, shadowAccumulator); } else { }
354,022
Bug 354022 constructor inlining can fail for some groovy built code
The file grails.util.BuildSettings contains bytecode where the constructors are recursive. You can't compile this in Java A() { this(); } but groovy generates some code where it switches on a value in the ctor and if it is a certain value, the recursive ctor call is made. I imagine this 'never happens' in practice but because it is in the bytecode it trips up the AspectJ code which inlines this() calls before weaving - since it gets into an infinite loop. For now, just keep track of ctors making the recursive call and so don't get trapped in the infinite loop.
resolved fixed
6ae463a
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-08-05T16:17:39Z
2011-08-05T16:00:00Z
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
} else { matchInvokeInstruction(mg, ih, ii, enclosingShadow, shadowAccumulator); } } else if (world.isJoinpointArrayConstructionEnabled() && i.isArrayCreationInstruction()) { if (canMatch(Shadow.ConstructorCall)) { if (i.opcode == Constants.ANEWARRAY) { BcelShadow ctorCallShadow = BcelShadow.makeArrayConstructorCall(world, mg, ih, enclosingShadow); match(ctorCallShadow, shadowAccumulator); } else if (i.opcode == Constants.NEWARRAY) { BcelShadow ctorCallShadow = BcelShadow.makeArrayConstructorCall(world, mg, ih, enclosingShadow); match(ctorCallShadow, shadowAccumulator); } else if (i instanceof MULTIANEWARRAY) { BcelShadow ctorCallShadow = BcelShadow.makeArrayConstructorCall(world, mg, ih, enclosingShadow); match(ctorCallShadow, shadowAccumulator); } }
354,022
Bug 354022 constructor inlining can fail for some groovy built code
The file grails.util.BuildSettings contains bytecode where the constructors are recursive. You can't compile this in Java A() { this(); } but groovy generates some code where it switches on a value in the ctor and if it is a certain value, the recursive ctor call is made. I imagine this 'never happens' in practice but because it is in the bytecode it trips up the AspectJ code which inlines this() calls before weaving - since it gets into an infinite loop. For now, just keep track of ctors making the recursive call and so don't get trapped in the infinite loop.
resolved fixed
6ae463a
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-08-05T16:17:39Z
2011-08-05T16:00:00Z
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
} else if (world.isJoinpointSynchronizationEnabled() && ((i.getOpcode() == Constants.MONITORENTER) || (i.getOpcode() == Constants.MONITOREXIT))) { if (i.getOpcode() == Constants.MONITORENTER) { BcelShadow monitorEntryShadow = BcelShadow.makeMonitorEnter(world, mg, ih, enclosingShadow); match(monitorEntryShadow, shadowAccumulator); } else { BcelShadow monitorExitShadow = BcelShadow.makeMonitorExit(world, mg, ih, enclosingShadow); match(monitorExitShadow, shadowAccumulator); } } } private boolean isInitFailureHandler(InstructionHandle ih) { InstructionHandle twoInstructionsAway = ih.getNext().getNext(); if (twoInstructionsAway.getInstruction().opcode == Constants.PUTSTATIC) { String name = ((FieldInstruction) twoInstructionsAway.getInstruction()).getFieldName(cpg); if (name.equals(NameMangler.INITFAILURECAUSE_FIELD_NAME)) { return true; } } return false; } private void matchSetInstruction(LazyMethodGen mg, InstructionHandle ih, BcelShadow enclosingShadow, List<BcelShadow> shadowAccumulator) {
354,022
Bug 354022 constructor inlining can fail for some groovy built code
The file grails.util.BuildSettings contains bytecode where the constructors are recursive. You can't compile this in Java A() { this(); } but groovy generates some code where it switches on a value in the ctor and if it is a certain value, the recursive ctor call is made. I imagine this 'never happens' in practice but because it is in the bytecode it trips up the AspectJ code which inlines this() calls before weaving - since it gets into an infinite loop. For now, just keep track of ctors making the recursive call and so don't get trapped in the infinite loop.
resolved fixed
6ae463a
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-08-05T16:17:39Z
2011-08-05T16:00:00Z
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
FieldInstruction fi = (FieldInstruction) ih.getInstruction(); Member field = BcelWorld.makeFieldJoinPointSignature(clazz, fi); if (field.getName().startsWith(NameMangler.PREFIX)) { return; } ResolvedMember resolvedField = field.resolve(world); if (resolvedField == null) { return; } else if (Modifier.isFinal(resolvedField.getModifiers()) && Utility.isConstantPushInstruction(ih.getPrev().getInstruction())) { return; } else if (resolvedField.isSynthetic()) { return; } else { BcelShadow bs = BcelShadow.makeFieldSet(world, resolvedField, mg, ih, enclosingShadow); String cname = fi.getClassName(cpg); if (!resolvedField.getDeclaringType().getName().equals(cname)) { bs.setActualTargetType(cname); } match(bs, shadowAccumulator); } } private void matchGetInstruction(LazyMethodGen mg, InstructionHandle ih, BcelShadow enclosingShadow, List<BcelShadow> shadowAccumulator) {
354,022
Bug 354022 constructor inlining can fail for some groovy built code
The file grails.util.BuildSettings contains bytecode where the constructors are recursive. You can't compile this in Java A() { this(); } but groovy generates some code where it switches on a value in the ctor and if it is a certain value, the recursive ctor call is made. I imagine this 'never happens' in practice but because it is in the bytecode it trips up the AspectJ code which inlines this() calls before weaving - since it gets into an infinite loop. For now, just keep track of ctors making the recursive call and so don't get trapped in the infinite loop.
resolved fixed
6ae463a
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-08-05T16:17:39Z
2011-08-05T16:00:00Z
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
FieldInstruction fi = (FieldInstruction) ih.getInstruction(); Member field = BcelWorld.makeFieldJoinPointSignature(clazz, fi); if (field.getName().startsWith(NameMangler.PREFIX)) { return; } ResolvedMember resolvedField = field.resolve(world); if (resolvedField == null) { return; } else if (resolvedField.isSynthetic()) { return; } else { BcelShadow bs = BcelShadow.makeFieldGet(world, resolvedField, mg, ih, enclosingShadow); String cname = fi.getClassName(cpg); if (!resolvedField.getDeclaringType().getName().equals(cname)) { bs.setActualTargetType(cname); } match(bs, shadowAccumulator); } } /** * For some named resolved type, this method looks for a member with a particular name - it should only be used when you truly * believe there is only one member with that name in the type as it returns the first one it finds. */ private ResolvedMember findResolvedMemberNamed(ResolvedType type, String methodName) { ResolvedMember[] allMethods = type.getDeclaredMethods(); for (int i = 0; i < allMethods.length; i++) { ResolvedMember member = allMethods[i];
354,022
Bug 354022 constructor inlining can fail for some groovy built code
The file grails.util.BuildSettings contains bytecode where the constructors are recursive. You can't compile this in Java A() { this(); } but groovy generates some code where it switches on a value in the ctor and if it is a certain value, the recursive ctor call is made. I imagine this 'never happens' in practice but because it is in the bytecode it trips up the AspectJ code which inlines this() calls before weaving - since it gets into an infinite loop. For now, just keep track of ctors making the recursive call and so don't get trapped in the infinite loop.
resolved fixed
6ae463a
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-08-05T16:17:39Z
2011-08-05T16:00:00Z
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
if (member.getName().equals(methodName)) { return member; } } return null; } /** * Find the specified member in the specified type. * * @param type the type to search for the member * @param methodName the name of the method to find * @param params the method parameters that the discovered method should have */ private ResolvedMember findResolvedMemberNamed(ResolvedType type, String methodName, UnresolvedType[] params) { ResolvedMember[] allMethods = type.getDeclaredMethods(); List<ResolvedMember> candidates = new ArrayList<ResolvedMember>(); for (int i = 0; i < allMethods.length; i++) { ResolvedMember candidate = allMethods[i]; if (candidate.getName().equals(methodName)) { if (candidate.getArity() == params.length) { candidates.add(candidate); } } } if (candidates.size() == 0) { return null; } else if (candidates.size() == 1) { return candidates.get(0); } else {
354,022
Bug 354022 constructor inlining can fail for some groovy built code
The file grails.util.BuildSettings contains bytecode where the constructors are recursive. You can't compile this in Java A() { this(); } but groovy generates some code where it switches on a value in the ctor and if it is a certain value, the recursive ctor call is made. I imagine this 'never happens' in practice but because it is in the bytecode it trips up the AspectJ code which inlines this() calls before weaving - since it gets into an infinite loop. For now, just keep track of ctors making the recursive call and so don't get trapped in the infinite loop.
resolved fixed
6ae463a
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-08-05T16:17:39Z
2011-08-05T16:00:00Z
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
for (ResolvedMember candidate : candidates) { boolean allOK = true; UnresolvedType[] candidateParams = candidate.getParameterTypes(); for (int p = 0; p < candidateParams.length; p++) { if (!candidateParams[p].getErasureSignature().equals(params[p].getErasureSignature())) { allOK = false; break; } } if (allOK) { return candidate; } } } return null; } /** * For a given resolvedmember, this will discover the real annotations for it. <b>Should only be used when the resolvedmember is * the contents of an effective signature attribute, as thats the only time when the annotations aren't stored directly in the * resolvedMember</b> * * @param rm the sig we want it to pretend to be 'int A.m()' or somesuch ITD like thing * @param declaredSig the real sig 'blah.ajc$xxx' */ private void fixParameterNamesForResolvedMember(ResolvedMember rm, ResolvedMember declaredSig) { UnresolvedType memberHostType = declaredSig.getDeclaringType(); String methodName = declaredSig.getName(); String[] pnames = null;
354,022
Bug 354022 constructor inlining can fail for some groovy built code
The file grails.util.BuildSettings contains bytecode where the constructors are recursive. You can't compile this in Java A() { this(); } but groovy generates some code where it switches on a value in the ctor and if it is a certain value, the recursive ctor call is made. I imagine this 'never happens' in practice but because it is in the bytecode it trips up the AspectJ code which inlines this() calls before weaving - since it gets into an infinite loop. For now, just keep track of ctors making the recursive call and so don't get trapped in the infinite loop.
resolved fixed
6ae463a
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-08-05T16:17:39Z
2011-08-05T16:00:00Z
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
if (rm.getKind() == Member.METHOD && !rm.isAbstract()) { if (methodName.startsWith("ajc$inlineAccessMethod") || methodName.startsWith("ajc$superDispatch")) { ResolvedMember resolvedDooberry = world.resolve(declaredSig); pnames = resolvedDooberry.getParameterNames(); } else { ResolvedMember realthing = AjcMemberMaker.interMethodDispatcher(rm.resolve(world), memberHostType).resolve(world); ResolvedMember theRealMember = findResolvedMemberNamed(memberHostType.resolve(world), realthing.getName()); if (theRealMember != null) { pnames = theRealMember.getParameterNames(); if (pnames.length > 0 && pnames[0].equals("ajc$this_")) { String[] pnames2 = new String[pnames.length - 1]; System.arraycopy(pnames, 1, pnames2, 0, pnames2.length); pnames = pnames2; } } } } rm.setParameterNames(pnames); } /** * For a given resolvedmember, this will discover the real annotations for it. <b>Should only be used when the resolvedmember is * the contents of an effective signature attribute, as thats the only time when the annotations aren't stored directly in the * resolvedMember</b> * * @param rm the sig we want it to pretend to be 'int A.m()' or somesuch ITD like thing * @param declaredSig the real sig 'blah.ajc$xxx' */ private void fixAnnotationsForResolvedMember(ResolvedMember rm, ResolvedMember declaredSig) {
354,022
Bug 354022 constructor inlining can fail for some groovy built code
The file grails.util.BuildSettings contains bytecode where the constructors are recursive. You can't compile this in Java A() { this(); } but groovy generates some code where it switches on a value in the ctor and if it is a certain value, the recursive ctor call is made. I imagine this 'never happens' in practice but because it is in the bytecode it trips up the AspectJ code which inlines this() calls before weaving - since it gets into an infinite loop. For now, just keep track of ctors making the recursive call and so don't get trapped in the infinite loop.
resolved fixed
6ae463a
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-08-05T16:17:39Z
2011-08-05T16:00:00Z
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
try { UnresolvedType memberHostType = declaredSig.getDeclaringType(); ResolvedType[] annotations = mapToAnnotations.get(rm); String methodName = declaredSig.getName(); if (annotations == null) { if (rm.getKind() == Member.FIELD) { if (methodName.startsWith("ajc$inlineAccessField")) { ResolvedMember resolvedDooberry = world.resolve(rm); annotations = resolvedDooberry.getAnnotationTypes(); } else { ResolvedMember realthing = AjcMemberMaker.interFieldInitializer(rm, memberHostType); ResolvedMember resolvedDooberry = world.resolve(realthing); annotations = resolvedDooberry.getAnnotationTypes(); } } else if (rm.getKind() == Member.METHOD && !rm.isAbstract()) { if (methodName.startsWith("ajc$inlineAccessMethod") || methodName.startsWith("ajc$superDispatch")) { ResolvedMember resolvedDooberry = world.resolve(declaredSig); annotations = resolvedDooberry.getAnnotationTypes(); } else { ResolvedMember realthing = AjcMemberMaker.interMethodDispatcher(rm.resolve(world), memberHostType).resolve( world); ResolvedMember theRealMember = findResolvedMemberNamed(memberHostType.resolve(world), realthing.getName(), realthing.getParameterTypes()); if (theRealMember == null) { throw new UnsupportedOperationException( "Known limitation in M4 - can't find ITD members when type variable is used as an argument and has upper bound specified"); } annotations = theRealMember.getAnnotationTypes(); }
354,022
Bug 354022 constructor inlining can fail for some groovy built code
The file grails.util.BuildSettings contains bytecode where the constructors are recursive. You can't compile this in Java A() { this(); } but groovy generates some code where it switches on a value in the ctor and if it is a certain value, the recursive ctor call is made. I imagine this 'never happens' in practice but because it is in the bytecode it trips up the AspectJ code which inlines this() calls before weaving - since it gets into an infinite loop. For now, just keep track of ctors making the recursive call and so don't get trapped in the infinite loop.
resolved fixed
6ae463a
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-08-05T16:17:39Z
2011-08-05T16:00:00Z
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
} else if (rm.getKind() == Member.CONSTRUCTOR) { ResolvedMember realThing = AjcMemberMaker.postIntroducedConstructor(memberHostType.resolve(world), rm.getDeclaringType(), rm.getParameterTypes()); ResolvedMember resolvedDooberry = world.resolve(realThing); if (resolvedDooberry == null) { throw new UnsupportedOperationException( "Known limitation in M4 - can't find ITD members when type variable is used as an argument and has upper bound specified"); } annotations = resolvedDooberry.getAnnotationTypes(); } if (annotations == null) { annotations = new ResolvedType[0]; } mapToAnnotations.put(rm, annotations); } rm.setAnnotationTypes(annotations); } catch (UnsupportedOperationException ex) { throw ex; } catch (Throwable t) { throw new BCException("Unexpectedly went bang when searching for annotations on " + rm, t); } } private void matchInvokeInstruction(LazyMethodGen mg, InstructionHandle ih, InvokeInstruction invoke, BcelShadow enclosingShadow, List<BcelShadow> shadowAccumulator) { String methodName = invoke.getName(cpg); if (methodName.startsWith(NameMangler.PREFIX)) { Member jpSig = world.makeJoinPointSignatureForMethodInvocation(clazz, invoke);
354,022
Bug 354022 constructor inlining can fail for some groovy built code
The file grails.util.BuildSettings contains bytecode where the constructors are recursive. You can't compile this in Java A() { this(); } but groovy generates some code where it switches on a value in the ctor and if it is a certain value, the recursive ctor call is made. I imagine this 'never happens' in practice but because it is in the bytecode it trips up the AspectJ code which inlines this() calls before weaving - since it gets into an infinite loop. For now, just keep track of ctors making the recursive call and so don't get trapped in the infinite loop.
resolved fixed
6ae463a
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-08-05T16:17:39Z
2011-08-05T16:00:00Z
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
ResolvedMember declaredSig = jpSig.resolve(world); if (declaredSig == null) { return; } if (declaredSig.getKind() == Member.FIELD) { Shadow.Kind kind; if (jpSig.getReturnType().equals(ResolvedType.VOID)) { kind = Shadow.FieldSet; } else { kind = Shadow.FieldGet; } if (canMatch(Shadow.FieldGet) || canMatch(Shadow.FieldSet)) { match(BcelShadow.makeShadowForMethodCall(world, mg, ih, enclosingShadow, kind, declaredSig), shadowAccumulator); } } else { AjAttribute.EffectiveSignatureAttribute effectiveSig = declaredSig.getEffectiveSignature(); if (effectiveSig == null) { return; } if (effectiveSig.isWeaveBody()) { return; } ResolvedMember rm = effectiveSig.getEffectiveSignature(); fixParameterNamesForResolvedMember(rm, declaredSig); fixAnnotationsForResolvedMember(rm, declaredSig); if (canMatch(effectiveSig.getShadowKind())) { match(BcelShadow.makeShadowForMethodCall(world, mg, ih, enclosingShadow, effectiveSig.getShadowKind(), rm),
354,022
Bug 354022 constructor inlining can fail for some groovy built code
The file grails.util.BuildSettings contains bytecode where the constructors are recursive. You can't compile this in Java A() { this(); } but groovy generates some code where it switches on a value in the ctor and if it is a certain value, the recursive ctor call is made. I imagine this 'never happens' in practice but because it is in the bytecode it trips up the AspectJ code which inlines this() calls before weaving - since it gets into an infinite loop. For now, just keep track of ctors making the recursive call and so don't get trapped in the infinite loop.
resolved fixed
6ae463a
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-08-05T16:17:39Z
2011-08-05T16:00:00Z
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
shadowAccumulator); } } } else { if (canMatch(Shadow.MethodCall)) { boolean proceed = true; if (world.isOverWeaving()) { String s = invoke.getClassName(mg.getConstantPool()); if (s.length() > 4 && s.charAt(4) == 'a' && (s.equals("org.aspectj.runtime.internal.CFlowCounter") || s.equals("org.aspectj.runtime.internal.CFlowStack") || s .equals("org.aspectj.runtime.reflect.Factory"))) { proceed = false; } else { if (methodName.equals("aspectOf")) { proceed = false; } } } if (proceed) { match(BcelShadow.makeMethodCall(world, mg, ih, enclosingShadow), shadowAccumulator); } } } }