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
350,855
Bug 350855 overweaving misbehaving when subclassing WeavingURLClassLoader
Raised by the Spring Insight team, they observed that in a system where they are using a special classloader (subclassing weaving url classloader) they see it fail to weave an aspect if overweaving is on.
resolved fixed
2302e94
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-06-30T15:34:56Z
2011-06-30T16:06:40Z
weaver/src/org/aspectj/weaver/bcel/BcelWeaver.java
private void weaveParentsFor(List<String> typesForWeaving, String typeToWeave, ResolvedType resolvedTypeToWeave) { if (resolvedTypeToWeave == null) { resolvedTypeToWeave = world.resolve(typeToWeave); } ResolvedType superclassType = resolvedTypeToWeave.getSuperclass(); String superclassTypename = (superclassType == null ? null : superclassType.getName()); if (superclassType != null && !superclassType.isTypeHierarchyComplete() && superclassType.isExposedToWeaver() && typesForWeaving.contains(superclassTypename)) { weaveParentsFor(typesForWeaving, superclassTypename, superclassType); } ResolvedType[] interfaceTypes = resolvedTypeToWeave.getDeclaredInterfaces(); for (ResolvedType resolvedSuperInterface : interfaceTypes) { if (!resolvedSuperInterface.isTypeHierarchyComplete()) { String interfaceTypename = resolvedSuperInterface.getName(); if (resolvedSuperInterface.isExposedToWeaver()) { weaveParentsFor(typesForWeaving, interfaceTypename, resolvedSuperInterface); } } } ContextToken tok = CompilationAndWeavingContext.enteringPhase(CompilationAndWeavingContext.PROCESSING_DECLARE_PARENTS, resolvedTypeToWeave.getName()); weaveParentTypeMungers(resolvedTypeToWeave); CompilationAndWeavingContext.leavingPhase(tok); typesForWeaving.remove(typeToWeave); resolvedTypeToWeave.tagAsTypeHierarchyComplete(); }
350,855
Bug 350855 overweaving misbehaving when subclassing WeavingURLClassLoader
Raised by the Spring Insight team, they observed that in a system where they are using a special classloader (subclassing weaving url classloader) they see it fail to weave an aspect if overweaving is on.
resolved fixed
2302e94
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-06-30T15:34:56Z
2011-06-30T16:06:40Z
weaver/src/org/aspectj/weaver/bcel/BcelWeaver.java
public void prepareToProcessReweavableState() { } public void processReweavableStateIfPresent(String className, BcelObjectType classType) { WeaverStateInfo wsi = classType.getWeaverState(); if (wsi != null && wsi.isReweavable()) { world.showMessage(IMessage.INFO, WeaverMessages.format(WeaverMessages.PROCESSING_REWEAVABLE, className, classType .getSourceLocation().getSourceFile()), null, null); Set<String> aspectsPreviouslyInWorld = wsi.getAspectsAffectingType(); Set<String> alreadyConfirmedReweavableState = new HashSet<String>(); for (String requiredTypeSignature : aspectsPreviouslyInWorld) { if (!alreadyConfirmedReweavableState.contains(requiredTypeSignature)) { ResolvedType rtx = world.resolve(UnresolvedType.forSignature(requiredTypeSignature), true); boolean exists = !rtx.isMissing(); if (!exists) { world.getLint().missingAspectForReweaving.signal(new String[] { rtx.getName(), className }, classType.getSourceLocation(), null); } else { if (world.isOverWeaving()) {
350,855
Bug 350855 overweaving misbehaving when subclassing WeavingURLClassLoader
Raised by the Spring Insight team, they observed that in a system where they are using a special classloader (subclassing weaving url classloader) they see it fail to weave an aspect if overweaving is on.
resolved fixed
2302e94
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-06-30T15:34:56Z
2011-06-30T16:06:40Z
weaver/src/org/aspectj/weaver/bcel/BcelWeaver.java
} else { if (!xcutSet.containsAspect(rtx)) { world.showMessage(IMessage.ERROR, WeaverMessages.format( WeaverMessages.REWEAVABLE_ASPECT_NOT_REGISTERED, rtx.getName(), className), null, null); } else if (!world.getMessageHandler().isIgnoring(IMessage.INFO)) { world.showMessage(IMessage.INFO, WeaverMessages.format(WeaverMessages.VERIFIED_REWEAVABLE_TYPE, rtx.getName(), rtx.getSourceLocation().getSourceFile()), null, null); } } alreadyConfirmedReweavableState.add(requiredTypeSignature); } } } if (!world.isOverWeaving()) { byte[] bytes = wsi.getUnwovenClassFileData(classType.getJavaClass().getBytes()); WeaverVersionInfo wvi = classType.getWeaverVersionAttribute(); JavaClass newJavaClass = Utility.makeJavaClass(classType.getJavaClass().getFileName(), bytes); classType.setJavaClass(newJavaClass, true); classType.getResolvedTypeX().ensureConsistent(); }
350,855
Bug 350855 overweaving misbehaving when subclassing WeavingURLClassLoader
Raised by the Spring Insight team, they observed that in a system where they are using a special classloader (subclassing weaving url classloader) they see it fail to weave an aspect if overweaving is on.
resolved fixed
2302e94
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-06-30T15:34:56Z
2011-06-30T16:06:40Z
weaver/src/org/aspectj/weaver/bcel/BcelWeaver.java
} } private void weaveAndNotify(UnwovenClassFile classFile, BcelObjectType classType, IWeaveRequestor requestor) throws IOException { trace.enter("weaveAndNotify", this, new Object[] { classFile, classType, requestor }); ContextToken tok = CompilationAndWeavingContext.enteringPhase(CompilationAndWeavingContext.WEAVING_TYPE, classType .getResolvedTypeX().getName()); LazyClassGen clazz = weaveWithoutDump(classFile, classType); classType.finishedWith(); if (clazz != null) { UnwovenClassFile[] newClasses = getClassFilesFor(clazz); if (newClasses[0].getClassName().equals(classFile.getClassName())) { newClasses[0].setClassNameAsChars(classFile.getClassNameAsChars()); } for (int i = 0; i < newClasses.length; i++) { requestor.acceptResult(newClasses[i]); } } else { requestor.acceptResult(classFile); } classType.weavingCompleted(); CompilationAndWeavingContext.leavingPhase(tok); trace.exit("weaveAndNotify"); } /**
350,855
Bug 350855 overweaving misbehaving when subclassing WeavingURLClassLoader
Raised by the Spring Insight team, they observed that in a system where they are using a special classloader (subclassing weaving url classloader) they see it fail to weave an aspect if overweaving is on.
resolved fixed
2302e94
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-06-30T15:34:56Z
2011-06-30T16:06:40Z
weaver/src/org/aspectj/weaver/bcel/BcelWeaver.java
* helper method - will return NULL if the underlying delegate is an EclipseSourceType and not a BcelObjectType */ public BcelObjectType getClassType(String forClass) { return BcelWorld.getBcelObjectType(world.resolve(forClass)); } public void addParentTypeMungers(String typeName) { weaveParentTypeMungers(world.resolve(typeName)); } public void addNormalTypeMungers(String typeName) { weaveNormalTypeMungers(world.resolve(typeName)); } public UnwovenClassFile[] getClassFilesFor(LazyClassGen clazz) { List<UnwovenClassFile.ChildClass> childClasses = clazz.getChildClasses(world); UnwovenClassFile[] ret = new UnwovenClassFile[1 + childClasses.size()]; ret[0] = new UnwovenClassFile(clazz.getFileName(), clazz.getClassName(), clazz.getJavaClassBytesIncludingReweavable(world)); int index = 1; for (Iterator<UnwovenClassFile.ChildClass> iter = childClasses.iterator(); iter.hasNext();) { UnwovenClassFile.ChildClass element = iter.next(); UnwovenClassFile childClass = new UnwovenClassFile(clazz.getFileName() + "$" + element.name, element.bytes); ret[index++] = childClass; } return ret; } /** * Weaves new parents and annotations onto a type ("declare parents" and "declare @type") * * Algorithm: 1. First pass, do parents then do annotations. During this pass record: - any parent mungers that don't match but * have a non-wild annotation type pattern - any annotation mungers that don't match 2. Multiple subsequent passes which go over * the munger lists constructed in the first pass, repeatedly applying them until nothing changes. FIXME asc confirm that * algorithm is optimal ??
350,855
Bug 350855 overweaving misbehaving when subclassing WeavingURLClassLoader
Raised by the Spring Insight team, they observed that in a system where they are using a special classloader (subclassing weaving url classloader) they see it fail to weave an aspect if overweaving is on.
resolved fixed
2302e94
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-06-30T15:34:56Z
2011-06-30T16:06:40Z
weaver/src/org/aspectj/weaver/bcel/BcelWeaver.java
*/ public void weaveParentTypeMungers(ResolvedType onType) { if (onType.isRawType()) { onType = onType.getGenericType(); } onType.clearInterTypeMungers(); List<DeclareParents> decpToRepeat = new ArrayList<DeclareParents>(); boolean aParentChangeOccurred = false; boolean anAnnotationChangeOccurred = false; for (DeclareParents decp : declareParentsList) { boolean typeChanged = applyDeclareParents(decp, onType); if (typeChanged) { aParentChangeOccurred = true; } else { decpToRepeat.add(decp); } } for (DeclareAnnotation decA : xcutSet.getDeclareAnnotationOnTypes()) { boolean typeChanged = applyDeclareAtType(decA, onType, true); if (typeChanged) { anAnnotationChangeOccurred = true; } } while ((aParentChangeOccurred || anAnnotationChangeOccurred) && !decpToRepeat.isEmpty()) { anAnnotationChangeOccurred = aParentChangeOccurred = false; List<DeclareParents> decpToRepeatNextTime = new ArrayList<DeclareParents>(); for (Iterator<DeclareParents> iter = decpToRepeat.iterator(); iter.hasNext();) { DeclareParents decp = iter.next();
350,855
Bug 350855 overweaving misbehaving when subclassing WeavingURLClassLoader
Raised by the Spring Insight team, they observed that in a system where they are using a special classloader (subclassing weaving url classloader) they see it fail to weave an aspect if overweaving is on.
resolved fixed
2302e94
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-06-30T15:34:56Z
2011-06-30T16:06:40Z
weaver/src/org/aspectj/weaver/bcel/BcelWeaver.java
boolean typeChanged = applyDeclareParents(decp, onType); if (typeChanged) { aParentChangeOccurred = true; } else { decpToRepeatNextTime.add(decp); } } for (DeclareAnnotation decA : xcutSet.getDeclareAnnotationOnTypes()) { boolean typeChanged = applyDeclareAtType(decA, onType, false); if (typeChanged) { anAnnotationChangeOccurred = true; } } decpToRepeat = decpToRepeatNextTime; } } /** * Apply a declare @type - return true if we change the type */ private boolean applyDeclareAtType(DeclareAnnotation decA, ResolvedType onType, boolean reportProblems) { boolean didSomething = false; if (decA.matches(onType)) { AnnotationAJ theAnnotation = decA.getAnnotation(); if (theAnnotation == null) { return false; } if (onType.hasAnnotation(theAnnotation.getType())) {
350,855
Bug 350855 overweaving misbehaving when subclassing WeavingURLClassLoader
Raised by the Spring Insight team, they observed that in a system where they are using a special classloader (subclassing weaving url classloader) they see it fail to weave an aspect if overweaving is on.
resolved fixed
2302e94
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-06-30T15:34:56Z
2011-06-30T16:06:40Z
weaver/src/org/aspectj/weaver/bcel/BcelWeaver.java
return false; } AnnotationAJ annoX = decA.getAnnotation(); boolean problemReported = verifyTargetIsOK(decA, onType, annoX, reportProblems); if (!problemReported) { AsmRelationshipProvider.addDeclareAnnotationRelationship(world.getModelAsAsmManager(), decA.getSourceLocation(), onType.getSourceLocation(), false); if (!getWorld().getMessageHandler().isIgnoring(IMessage.WEAVEINFO)) { getWorld().getMessageHandler().handleMessage( WeaveMessage.constructWeavingMessage( WeaveMessage.WEAVEMESSAGE_ANNOTATES, new String[] { onType.toString(), Utility.beautifyLocation(onType.getSourceLocation()), decA.getAnnotationString(), "type", decA.getAspect().toString(), Utility.beautifyLocation(decA.getSourceLocation()) })); } didSomething = true; ResolvedTypeMunger newAnnotationTM = new AnnotationOnTypeMunger(annoX); newAnnotationTM.setSourceLocation(decA.getSourceLocation()); onType.addInterTypeMunger(new BcelTypeMunger(newAnnotationTM, decA.getAspect().resolve(world)), false); decA.copyAnnotationTo(onType); }
350,855
Bug 350855 overweaving misbehaving when subclassing WeavingURLClassLoader
Raised by the Spring Insight team, they observed that in a system where they are using a special classloader (subclassing weaving url classloader) they see it fail to weave an aspect if overweaving is on.
resolved fixed
2302e94
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-06-30T15:34:56Z
2011-06-30T16:06:40Z
weaver/src/org/aspectj/weaver/bcel/BcelWeaver.java
} return didSomething; } /** * Checks for an @target() on the annotation and if found ensures it allows the annotation to be attached to the target type * that matched. */ private boolean verifyTargetIsOK(DeclareAnnotation decA, ResolvedType onType, AnnotationAJ annoX, boolean outputProblems) { boolean problemReported = false; if (annoX.specifiesTarget()) { if ((onType.isAnnotation() && !annoX.allowedOnAnnotationType()) || (!annoX.allowedOnRegularType())) { if (outputProblems) { if (decA.isExactPattern()) { world.getMessageHandler().handleMessage( MessageUtil.error( WeaverMessages.format(WeaverMessages.INCORRECT_TARGET_FOR_DECLARE_ANNOTATION, onType.getName(), annoX.getTypeName(), annoX.getValidTargets()), decA.getSourceLocation())); } else { if (world.getLint().invalidTargetForAnnotation.isEnabled()) { world.getLint().invalidTargetForAnnotation.signal(new String[] { onType.getName(), annoX.getTypeName(), annoX.getValidTargets() }, decA.getSourceLocation(), new ISourceLocation[] { onType.getSourceLocation() }); } } } problemReported = true; } } return problemReported;
350,855
Bug 350855 overweaving misbehaving when subclassing WeavingURLClassLoader
Raised by the Spring Insight team, they observed that in a system where they are using a special classloader (subclassing weaving url classloader) they see it fail to weave an aspect if overweaving is on.
resolved fixed
2302e94
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-06-30T15:34:56Z
2011-06-30T16:06:40Z
weaver/src/org/aspectj/weaver/bcel/BcelWeaver.java
} /** * Apply a single declare parents - return true if we change the type */ private boolean applyDeclareParents(DeclareParents p, ResolvedType onType) { boolean didSomething = false; List<ResolvedType> newParents = p.findMatchingNewParents(onType, true); if (!newParents.isEmpty()) { didSomething = true; BcelWorld.getBcelObjectType(onType); for (ResolvedType newParent : newParents) { onType.addParent(newParent); NewParentTypeMunger newParentMunger = new NewParentTypeMunger(newParent, p.getDeclaringType()); if (p.isMixin()) { newParentMunger.setIsMixin(true); } newParentMunger.setSourceLocation(p.getSourceLocation()); onType.addInterTypeMunger(new BcelTypeMunger(newParentMunger, xcutSet.findAspectDeclaringParents(p)), false); } } return didSomething; }
350,855
Bug 350855 overweaving misbehaving when subclassing WeavingURLClassLoader
Raised by the Spring Insight team, they observed that in a system where they are using a special classloader (subclassing weaving url classloader) they see it fail to weave an aspect if overweaving is on.
resolved fixed
2302e94
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-06-30T15:34:56Z
2011-06-30T16:06:40Z
weaver/src/org/aspectj/weaver/bcel/BcelWeaver.java
public void weaveNormalTypeMungers(ResolvedType onType) { ContextToken tok = CompilationAndWeavingContext.enteringPhase(CompilationAndWeavingContext.PROCESSING_TYPE_MUNGERS, onType.getName()); if (onType.isRawType() || onType.isParameterizedType()) { onType = onType.getGenericType(); } for (ConcreteTypeMunger m : typeMungerList) { if (!m.isLateMunger() && m.matches(onType)) { onType.addInterTypeMunger(m, false); } } CompilationAndWeavingContext.leavingPhase(tok); } public LazyClassGen weaveWithoutDump(UnwovenClassFile classFile, BcelObjectType classType) throws IOException { return weave(classFile, classType, false); } LazyClassGen weave(UnwovenClassFile classFile, BcelObjectType classType) throws IOException { LazyClassGen ret = weave(classFile, classType, true); return ret; } private LazyClassGen weave(UnwovenClassFile classFile, BcelObjectType classType, boolean dump) throws IOException { try { if (classType.isSynthetic()) { if (dump) { dumpUnchanged(classFile); } return null; }
350,855
Bug 350855 overweaving misbehaving when subclassing WeavingURLClassLoader
Raised by the Spring Insight team, they observed that in a system where they are using a special classloader (subclassing weaving url classloader) they see it fail to weave an aspect if overweaving is on.
resolved fixed
2302e94
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-06-30T15:34:56Z
2011-06-30T16:06:40Z
weaver/src/org/aspectj/weaver/bcel/BcelWeaver.java
ReferenceType resolvedClassType = classType.getResolvedTypeX(); if (world.isXmlConfigured() && world.getXmlConfiguration().excludesType(resolvedClassType)) { if (!world.getMessageHandler().isIgnoring(IMessage.INFO)) { world.getMessageHandler().handleMessage( MessageUtil.info("Type '" + resolvedClassType.getName() + "' not woven due to exclusion via XML weaver exclude section")); } if (dump) { dumpUnchanged(classFile); } return null; } List<ShadowMunger> shadowMungers = fastMatch(shadowMungerList, resolvedClassType); List<ConcreteTypeMunger> typeMungers = classType.getResolvedTypeX().getInterTypeMungers(); resolvedClassType.checkInterTypeMungers(); boolean mightNeedToWeave = shadowMungers.size() > 0 || typeMungers.size() > 0 || classType.isAspect() || world.getDeclareAnnotationOnMethods().size() > 0 || world.getDeclareAnnotationOnFields().size() > 0; boolean mightNeedBridgeMethods = world.isInJava5Mode() && !classType.isInterface() && resolvedClassType.getInterTypeMungersIncludingSupers().size() > 0; LazyClassGen clazz = null; if (mightNeedToWeave || mightNeedBridgeMethods) { clazz = classType.getLazyClassGen(); try { boolean isChanged = false; if (mightNeedToWeave) {
350,855
Bug 350855 overweaving misbehaving when subclassing WeavingURLClassLoader
Raised by the Spring Insight team, they observed that in a system where they are using a special classloader (subclassing weaving url classloader) they see it fail to weave an aspect if overweaving is on.
resolved fixed
2302e94
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-06-30T15:34:56Z
2011-06-30T16:06:40Z
weaver/src/org/aspectj/weaver/bcel/BcelWeaver.java
isChanged = BcelClassWeaver.weave(world, clazz, shadowMungers, typeMungers, lateTypeMungerList, inReweavableMode); } checkDeclareTypeErrorOrWarning(world, classType); if (mightNeedBridgeMethods) { isChanged = BcelClassWeaver.calculateAnyRequiredBridgeMethods(world, clazz) || isChanged; } if (isChanged) { if (dump) { dump(classFile, clazz); } return clazz; } } catch (RuntimeException re) { String classDebugInfo = null; try { classDebugInfo = clazz.toLongString(); } catch (Throwable e) { new RuntimeException("Crashed whilst crashing with this exception: " + e, e).printStackTrace(); classDebugInfo = clazz.getClassName(); } String messageText = "trouble in: \n" + classDebugInfo; getWorld().getMessageHandler().handleMessage(new Message(messageText, IMessage.ABORT, re, null)); } catch (Error re) { String classDebugInfo = null; try { classDebugInfo = clazz.toLongString(); } catch (Exception e) {
350,855
Bug 350855 overweaving misbehaving when subclassing WeavingURLClassLoader
Raised by the Spring Insight team, they observed that in a system where they are using a special classloader (subclassing weaving url classloader) they see it fail to weave an aspect if overweaving is on.
resolved fixed
2302e94
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-06-30T15:34:56Z
2011-06-30T16:06:40Z
weaver/src/org/aspectj/weaver/bcel/BcelWeaver.java
classDebugInfo = clazz.getClassName(); } String messageText = "trouble in: \n" + classDebugInfo; getWorld().getMessageHandler().handleMessage(new Message(messageText, IMessage.ABORT, re, null)); } } else { checkDeclareTypeErrorOrWarning(world, classType); } AsmManager model = world.getModelAsAsmManager(); if (world.isMinimalModel() && model != null && !classType.isAspect()) { AspectJElementHierarchy hierarchy = (AspectJElementHierarchy) model.getHierarchy(); String pkgname = classType.getResolvedTypeX().getPackageName(); String tname = classType.getResolvedTypeX().getSimpleBaseName(); IProgramElement typeElement = hierarchy.findElementForType(pkgname, tname); if (typeElement != null && hasInnerType(typeElement)) { candidatesForRemoval.add(typeElement); } if (typeElement != null && !hasInnerType(typeElement)) { IProgramElement parent = typeElement.getParent(); if (parent != null) { parent.removeChild(typeElement); if (parent.getKind().isSourceFile()) {
350,855
Bug 350855 overweaving misbehaving when subclassing WeavingURLClassLoader
Raised by the Spring Insight team, they observed that in a system where they are using a special classloader (subclassing weaving url classloader) they see it fail to weave an aspect if overweaving is on.
resolved fixed
2302e94
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-06-30T15:34:56Z
2011-06-30T16:06:40Z
weaver/src/org/aspectj/weaver/bcel/BcelWeaver.java
removeSourceFileIfNoMoreTypeDeclarationsInside(hierarchy, typeElement, parent); } else { hierarchy.forget(null, typeElement); walkUpRemovingEmptyTypesAndPossiblyEmptySourceFile(hierarchy, tname, parent); } } } } if (dump) { dumpUnchanged(classFile); return clazz; } else { if (clazz != null && !clazz.getChildClasses(world).isEmpty()) { return clazz; } return null; } } finally {
350,855
Bug 350855 overweaving misbehaving when subclassing WeavingURLClassLoader
Raised by the Spring Insight team, they observed that in a system where they are using a special classloader (subclassing weaving url classloader) they see it fail to weave an aspect if overweaving is on.
resolved fixed
2302e94
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-06-30T15:34:56Z
2011-06-30T16:06:40Z
weaver/src/org/aspectj/weaver/bcel/BcelWeaver.java
world.demote(); } } private void walkUpRemovingEmptyTypesAndPossiblyEmptySourceFile(AspectJElementHierarchy hierarchy, String tname, IProgramElement typeThatHasChildRemoved) { while (typeThatHasChildRemoved != null && !(typeThatHasChildRemoved.getKind().isType() || typeThatHasChildRemoved.getKind().isSourceFile())) { typeThatHasChildRemoved = typeThatHasChildRemoved.getParent(); } if (candidatesForRemoval.contains(typeThatHasChildRemoved) && !hasInnerType(typeThatHasChildRemoved)) { IProgramElement parent = typeThatHasChildRemoved.getParent(); if (parent != null) { parent.removeChild(typeThatHasChildRemoved); candidatesForRemoval.remove(typeThatHasChildRemoved); if (parent.getKind().isSourceFile()) { removeSourceFileIfNoMoreTypeDeclarationsInside(hierarchy, typeThatHasChildRemoved, parent); } else { walkUpRemovingEmptyTypesAndPossiblyEmptySourceFile(hierarchy, tname, parent);
350,855
Bug 350855 overweaving misbehaving when subclassing WeavingURLClassLoader
Raised by the Spring Insight team, they observed that in a system where they are using a special classloader (subclassing weaving url classloader) they see it fail to weave an aspect if overweaving is on.
resolved fixed
2302e94
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-06-30T15:34:56Z
2011-06-30T16:06:40Z
weaver/src/org/aspectj/weaver/bcel/BcelWeaver.java
} } } } private void removeSourceFileIfNoMoreTypeDeclarationsInside(AspectJElementHierarchy hierarchy, IProgramElement typeElement, IProgramElement sourceFileNode) { IProgramElement compilationUnit = sourceFileNode; boolean anyOtherTypeDeclarations = false; for (IProgramElement child : compilationUnit.getChildren()) { IProgramElement.Kind k = child.getKind(); if (k.isType()) { anyOtherTypeDeclarations = true; break; } } if (!anyOtherTypeDeclarations) { IProgramElement cuParent = compilationUnit.getParent(); if (cuParent != null) { compilationUnit.setParent(null); cuParent.removeChild(compilationUnit); } hierarchy.forget(sourceFileNode, typeElement); } else { hierarchy.forget(null, typeElement); } }
350,855
Bug 350855 overweaving misbehaving when subclassing WeavingURLClassLoader
Raised by the Spring Insight team, they observed that in a system where they are using a special classloader (subclassing weaving url classloader) they see it fail to weave an aspect if overweaving is on.
resolved fixed
2302e94
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-06-30T15:34:56Z
2011-06-30T16:06:40Z
weaver/src/org/aspectj/weaver/bcel/BcelWeaver.java
private boolean hasInnerType(IProgramElement typeNode) { for (IProgramElement child : typeNode.getChildren()) { IProgramElement.Kind kind = child.getKind(); if (kind.isType()) { return true; } if (kind.isType() || kind == IProgramElement.Kind.METHOD || kind == IProgramElement.Kind.CONSTRUCTOR) { boolean b = hasInnerType(child); if (b) { return b; } } } return false; } private void checkDeclareTypeErrorOrWarning(BcelWorld world2, BcelObjectType classType) { List<DeclareTypeErrorOrWarning> dteows = world.getDeclareTypeEows(); for (DeclareTypeErrorOrWarning dteow : dteows) { if (dteow.getTypePattern().matchesStatically(classType.getResolvedTypeX())) { if (dteow.isError()) { world.getMessageHandler().handleMessage( MessageUtil.error(dteow.getMessage(), classType.getResolvedTypeX().getSourceLocation())); } else { world.getMessageHandler().handleMessage( MessageUtil.warn(dteow.getMessage(), classType.getResolvedTypeX().getSourceLocation())); }
350,855
Bug 350855 overweaving misbehaving when subclassing WeavingURLClassLoader
Raised by the Spring Insight team, they observed that in a system where they are using a special classloader (subclassing weaving url classloader) they see it fail to weave an aspect if overweaving is on.
resolved fixed
2302e94
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-06-30T15:34:56Z
2011-06-30T16:06:40Z
weaver/src/org/aspectj/weaver/bcel/BcelWeaver.java
} } } private void dumpUnchanged(UnwovenClassFile classFile) throws IOException { if (zipOutputStream != null) { writeZipEntry(getEntryName(classFile.getJavaClass().getClassName()), classFile.getBytes()); } else { classFile.writeUnchangedBytes(); } } private String getEntryName(String className) { return className.replace('.', '/') + ".class"; } private void dump(UnwovenClassFile classFile, LazyClassGen clazz) throws IOException { if (zipOutputStream != null) { String mainClassName = classFile.getJavaClass().getClassName(); writeZipEntry(getEntryName(mainClassName), clazz.getJavaClass(world).getBytes()); List<UnwovenClassFile.ChildClass> childClasses = clazz.getChildClasses(world); if (!childClasses.isEmpty()) { for (Iterator<UnwovenClassFile.ChildClass> i = childClasses.iterator(); i.hasNext();) { UnwovenClassFile.ChildClass c = i.next(); writeZipEntry(getEntryName(mainClassName + "$" + c.name), c.bytes); } } } else { classFile.writeWovenBytes(clazz.getJavaClass(world).getBytes(), clazz.getChildClasses(world)); } } private void writeZipEntry(String name, byte[] bytes) throws IOException {
350,855
Bug 350855 overweaving misbehaving when subclassing WeavingURLClassLoader
Raised by the Spring Insight team, they observed that in a system where they are using a special classloader (subclassing weaving url classloader) they see it fail to weave an aspect if overweaving is on.
resolved fixed
2302e94
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-06-30T15:34:56Z
2011-06-30T16:06:40Z
weaver/src/org/aspectj/weaver/bcel/BcelWeaver.java
ZipEntry newEntry = new ZipEntry(name); zipOutputStream.putNextEntry(newEntry); zipOutputStream.write(bytes); zipOutputStream.closeEntry(); } /** * Perform a fast match of the specified list of shadowmungers against the specified type. A subset of those that might match is * returned. * * @param list list of all shadow mungers that might match * @param type the target type * @return a list of shadow mungers that might match with those that cannot (according to fast match rules) removed */ private List<ShadowMunger> fastMatch(List<ShadowMunger> list, ResolvedType type) { if (list == null) { return Collections.emptyList(); } boolean isOverweaving = world.isOverWeaving(); WeaverStateInfo typeWeaverState = (isOverweaving ? type.getWeaverState() : null); FastMatchInfo info = new FastMatchInfo(type, null, world); List<ShadowMunger> result = new ArrayList<ShadowMunger>(); if (world.areInfoMessagesEnabled() && world.isTimingEnabled()) { for (ShadowMunger munger : list) { if (typeWeaverState != null) { ResolvedType declaringAspect = munger.getDeclaringType(); if (typeWeaverState.isAspectAlreadyApplied(declaringAspect)) {
350,855
Bug 350855 overweaving misbehaving when subclassing WeavingURLClassLoader
Raised by the Spring Insight team, they observed that in a system where they are using a special classloader (subclassing weaving url classloader) they see it fail to weave an aspect if overweaving is on.
resolved fixed
2302e94
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-06-30T15:34:56Z
2011-06-30T16:06:40Z
weaver/src/org/aspectj/weaver/bcel/BcelWeaver.java
continue; } } Pointcut pointcut = munger.getPointcut(); long starttime = System.nanoTime(); FuzzyBoolean fb = pointcut.fastMatch(info); long endtime = System.nanoTime(); world.recordFastMatch(pointcut, endtime - starttime); if (fb.maybeTrue()) { result.add(munger); } } } else { for (ShadowMunger munger : list) { if (typeWeaverState != null) { ResolvedType declaringAspect = munger.getConcreteAspect(); if (typeWeaverState.isAspectAlreadyApplied(declaringAspect)) { continue; } } Pointcut pointcut = munger.getPointcut(); FuzzyBoolean fb = pointcut.fastMatch(info); if (fb.maybeTrue()) { result.add(munger); } } } return result; } public void setReweavableMode(boolean xNotReweavable) {
350,855
Bug 350855 overweaving misbehaving when subclassing WeavingURLClassLoader
Raised by the Spring Insight team, they observed that in a system where they are using a special classloader (subclassing weaving url classloader) they see it fail to weave an aspect if overweaving is on.
resolved fixed
2302e94
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-06-30T15:34:56Z
2011-06-30T16:06:40Z
weaver/src/org/aspectj/weaver/bcel/BcelWeaver.java
inReweavableMode = !xNotReweavable; WeaverStateInfo.setReweavableModeDefaults(!xNotReweavable, false, true); } public boolean isReweavable() { return inReweavableMode; } public World getWorld() { return world; } public void tidyUp() { if (trace.isTraceEnabled()) { trace.enter("tidyUp", this); } shadowMungerList = null; typeMungerList = null; lateTypeMungerList = null; declareParentsList = null; if (trace.isTraceEnabled()) { trace.exit("tidyUp"); } } public void write(CompressingDataOutputStream dos) throws IOException { xcutSet.write(dos); } public void setShadowMungers(List shadowMungers) { shadowMungerList = shadowMungers; } }
352,389
Bug 352389 overweaving can attribute duplicate attributes, one of which will not deserialize correctly
When overweaving it is possible that a class will get a second WeaverState attribute. This second one will not be valid (it hasn't been correctly configured). This isn't normally a problem because the next thing that happens is that the class is defined to the VM. But if *another* weave step occurs, the malformed attribute will cause that weave to fail with this kind of message: bad WeaverState.Kind: -115 The solution is to avoid adding the duplicate when overweaving.
resolved fixed
8553b30
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-07-18T20:44:33Z
2011-07-18T20:13:20Z
weaver/src/org/aspectj/weaver/bcel/LazyClassGen.java
/* ******************************************************************* * Copyright (c) 2002-2010 Contributors * All rights reserved. * This program and the accompanying materials are made available * under the terms of the Eclipse Public License v1.0 * which accompanies this distribution and is available at * http:www.eclipse.org/legal/epl-v10.html * * Contributors: * PARC initial implementation * Andy Clement 6Jul05 generics - signature attribute * Abraham Nevado * ******************************************************************/ package org.aspectj.weaver.bcel;
352,389
Bug 352389 overweaving can attribute duplicate attributes, one of which will not deserialize correctly
When overweaving it is possible that a class will get a second WeaverState attribute. This second one will not be valid (it hasn't been correctly configured). This isn't normally a problem because the next thing that happens is that the class is defined to the VM. But if *another* weave step occurs, the malformed attribute will cause that weave to fail with this kind of message: bad WeaverState.Kind: -115 The solution is to avoid adding the duplicate when overweaving.
resolved fixed
8553b30
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-07-18T20:44:33Z
2011-07-18T20:13:20Z
weaver/src/org/aspectj/weaver/bcel/LazyClassGen.java
import java.io.ByteArrayOutputStream; import java.io.File; import java.io.IOException; import java.io.PrintStream; import java.lang.reflect.Modifier; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Set; import java.util.SortedMap; import java.util.TreeMap; import java.util.Vector; import org.aspectj.apache.bcel.Constants; import org.aspectj.apache.bcel.classfile.Attribute; import org.aspectj.apache.bcel.classfile.ConstantPool; import org.aspectj.apache.bcel.classfile.Field; import org.aspectj.apache.bcel.classfile.JavaClass; import org.aspectj.apache.bcel.classfile.Method; import org.aspectj.apache.bcel.classfile.Signature; import org.aspectj.apache.bcel.classfile.Synthetic; import org.aspectj.apache.bcel.classfile.annotation.AnnotationGen; import org.aspectj.apache.bcel.generic.BasicType; import org.aspectj.apache.bcel.generic.ClassGen; import org.aspectj.apache.bcel.generic.FieldGen; import org.aspectj.apache.bcel.generic.InstructionConstants; import org.aspectj.apache.bcel.generic.InstructionFactory;
352,389
Bug 352389 overweaving can attribute duplicate attributes, one of which will not deserialize correctly
When overweaving it is possible that a class will get a second WeaverState attribute. This second one will not be valid (it hasn't been correctly configured). This isn't normally a problem because the next thing that happens is that the class is defined to the VM. But if *another* weave step occurs, the malformed attribute will cause that weave to fail with this kind of message: bad WeaverState.Kind: -115 The solution is to avoid adding the duplicate when overweaving.
resolved fixed
8553b30
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-07-18T20:44:33Z
2011-07-18T20:13:20Z
weaver/src/org/aspectj/weaver/bcel/LazyClassGen.java
import org.aspectj.apache.bcel.generic.InstructionHandle; import org.aspectj.apache.bcel.generic.InstructionList; import org.aspectj.apache.bcel.generic.ObjectType; import org.aspectj.apache.bcel.generic.Type; import org.aspectj.bridge.IMessage; import org.aspectj.bridge.ISourceLocation; import org.aspectj.bridge.SourceLocation; import org.aspectj.weaver.AjAttribute; import org.aspectj.weaver.AjAttribute.WeaverVersionInfo; import org.aspectj.weaver.BCException; import org.aspectj.weaver.Member; import org.aspectj.weaver.NameMangler; import org.aspectj.weaver.ResolvedMember; import org.aspectj.weaver.ResolvedType; import org.aspectj.weaver.Shadow; import org.aspectj.weaver.SignatureUtils; import org.aspectj.weaver.TypeVariable; import org.aspectj.weaver.UnresolvedType; import org.aspectj.weaver.UnresolvedType.TypeKind; import org.aspectj.weaver.WeaverMessages; import org.aspectj.weaver.WeaverStateInfo; import org.aspectj.weaver.World; import org.aspectj.weaver.bcel.asm.AsmDetector; import org.aspectj.weaver.bcel.asm.StackMapAdder; /** * Lazy lazy lazy. We don't unpack the underlying class unless necessary. Things like new methods and annotations accumulate in here * until they must be written out, don't add them to the underlying MethodGen! Things are slightly different if this represents an * Aspect. */ public final class LazyClassGen {
352,389
Bug 352389 overweaving can attribute duplicate attributes, one of which will not deserialize correctly
When overweaving it is possible that a class will get a second WeaverState attribute. This second one will not be valid (it hasn't been correctly configured). This isn't normally a problem because the next thing that happens is that the class is defined to the VM. But if *another* weave step occurs, the malformed attribute will cause that weave to fail with this kind of message: bad WeaverState.Kind: -115 The solution is to avoid adding the duplicate when overweaving.
resolved fixed
8553b30
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-07-18T20:44:33Z
2011-07-18T20:13:20Z
weaver/src/org/aspectj/weaver/bcel/LazyClassGen.java
private static final int ACC_SYNTHETIC = 0x1000; private static final String[] NO_STRINGS = new String[0]; int highestLineNumber = 0; private final SortedMap<String, InlinedSourceFileInfo> inlinedFiles = new TreeMap<String, InlinedSourceFileInfo>(); private boolean regenerateGenericSignatureAttribute = false; private BcelObjectType myType; private ClassGen myGen; private final ConstantPool cp; private final World world; private final String packageName = null; private final List<BcelField> fields = new ArrayList<BcelField>(); private final List<LazyMethodGen> methodGens = new ArrayList<LazyMethodGen>(); private final List<LazyClassGen> classGens = new ArrayList<LazyClassGen>(); private final List<AnnotationGen> annotations = new ArrayList<AnnotationGen>(); private int childCounter = 0; private final InstructionFactory fact; private boolean isSerializable = false; private boolean hasSerialVersionUIDField = false; private boolean serialVersionUIDRequiresInitialization = false; private long calculatedSerialVersionUID; private boolean hasClinit = false; private ResolvedType[] extraSuperInterfaces = null; private ResolvedType superclass = null; static class InlinedSourceFileInfo {
352,389
Bug 352389 overweaving can attribute duplicate attributes, one of which will not deserialize correctly
When overweaving it is possible that a class will get a second WeaverState attribute. This second one will not be valid (it hasn't been correctly configured). This isn't normally a problem because the next thing that happens is that the class is defined to the VM. But if *another* weave step occurs, the malformed attribute will cause that weave to fail with this kind of message: bad WeaverState.Kind: -115 The solution is to avoid adding the duplicate when overweaving.
resolved fixed
8553b30
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-07-18T20:44:33Z
2011-07-18T20:13:20Z
weaver/src/org/aspectj/weaver/bcel/LazyClassGen.java
int highestLineNumber; int offset; InlinedSourceFileInfo(int highestLineNumber) { this.highestLineNumber = highestLineNumber; } } void addInlinedSourceFileInfo(String fullpath, int highestLineNumber) { Object o = inlinedFiles.get(fullpath); if (o != null) { InlinedSourceFileInfo info = (InlinedSourceFileInfo) o; if (info.highestLineNumber < highestLineNumber) { info.highestLineNumber = highestLineNumber; } } else { inlinedFiles.put(fullpath, new InlinedSourceFileInfo(highestLineNumber)); } } void calculateSourceDebugExtensionOffsets() { int i = roundUpToHundreds(highestLineNumber); for (InlinedSourceFileInfo element : inlinedFiles.values()) { element.offset = i; i = roundUpToHundreds(i + element.highestLineNumber); } } private static int roundUpToHundreds(int i) { return ((i / 100) + 1) * 100; } int getSourceDebugExtensionOffset(String fullpath) {
352,389
Bug 352389 overweaving can attribute duplicate attributes, one of which will not deserialize correctly
When overweaving it is possible that a class will get a second WeaverState attribute. This second one will not be valid (it hasn't been correctly configured). This isn't normally a problem because the next thing that happens is that the class is defined to the VM. But if *another* weave step occurs, the malformed attribute will cause that weave to fail with this kind of message: bad WeaverState.Kind: -115 The solution is to avoid adding the duplicate when overweaving.
resolved fixed
8553b30
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-07-18T20:44:33Z
2011-07-18T20:13:20Z
weaver/src/org/aspectj/weaver/bcel/LazyClassGen.java
return inlinedFiles.get(fullpath).offset; }
352,389
Bug 352389 overweaving can attribute duplicate attributes, one of which will not deserialize correctly
When overweaving it is possible that a class will get a second WeaverState attribute. This second one will not be valid (it hasn't been correctly configured). This isn't normally a problem because the next thing that happens is that the class is defined to the VM. But if *another* weave step occurs, the malformed attribute will cause that weave to fail with this kind of message: bad WeaverState.Kind: -115 The solution is to avoid adding the duplicate when overweaving.
resolved fixed
8553b30
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-07-18T20:44:33Z
2011-07-18T20:13:20Z
weaver/src/org/aspectj/weaver/bcel/LazyClassGen.java
public static void disassemble(String path, String name, PrintStream out) throws IOException { if (null == out) { return; } BcelWorld world = new BcelWorld(path); UnresolvedType ut = UnresolvedType.forName(name); ut.setNeedsModifiableDelegate(true); LazyClassGen clazz = new LazyClassGen(BcelWorld.getBcelObjectType(world.resolve(ut))); clazz.print(out); out.println(); } public String getNewGeneratedNameTag() { return new Integer(childCounter++).toString(); } public LazyClassGen(String class_name, String super_class_name, String file_name, int access_flags, String[] interfaces, World world) { myGen = new ClassGen(class_name, super_class_name, file_name, access_flags, interfaces); cp = myGen.getConstantPool();
352,389
Bug 352389 overweaving can attribute duplicate attributes, one of which will not deserialize correctly
When overweaving it is possible that a class will get a second WeaverState attribute. This second one will not be valid (it hasn't been correctly configured). This isn't normally a problem because the next thing that happens is that the class is defined to the VM. But if *another* weave step occurs, the malformed attribute will cause that weave to fail with this kind of message: bad WeaverState.Kind: -115 The solution is to avoid adding the duplicate when overweaving.
resolved fixed
8553b30
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-07-18T20:44:33Z
2011-07-18T20:13:20Z
weaver/src/org/aspectj/weaver/bcel/LazyClassGen.java
fact = new InstructionFactory(myGen, cp); regenerateGenericSignatureAttribute = true; this.world = world; } public LazyClassGen(BcelObjectType myType) { myGen = new ClassGen(myType.getJavaClass()); cp = myGen.getConstantPool(); fact = new InstructionFactory(myGen, cp); this.myType = myType; world = myType.getResolvedTypeX().getWorld(); if (implementsSerializable(getType())) { isSerializable = true; hasSerialVersionUIDField = hasSerialVersionUIDField(getType()); ResolvedMember[] methods = getType().getDeclaredMethods(); for (int i = 0; i < methods.length; i++) { ResolvedMember method = methods[i]; if (method.getName().equals("<clinit>")) { if (method.getKind() != Member.STATIC_INITIALIZATION) { throw new RuntimeException("qui?");
352,389
Bug 352389 overweaving can attribute duplicate attributes, one of which will not deserialize correctly
When overweaving it is possible that a class will get a second WeaverState attribute. This second one will not be valid (it hasn't been correctly configured). This isn't normally a problem because the next thing that happens is that the class is defined to the VM. But if *another* weave step occurs, the malformed attribute will cause that weave to fail with this kind of message: bad WeaverState.Kind: -115 The solution is to avoid adding the duplicate when overweaving.
resolved fixed
8553b30
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-07-18T20:44:33Z
2011-07-18T20:13:20Z
weaver/src/org/aspectj/weaver/bcel/LazyClassGen.java
} hasClinit = true; } } if (!getType().isInterface() && !hasSerialVersionUIDField && world.isAddSerialVerUID()) { calculatedSerialVersionUID = myGen.getSUID(); FieldGen fg = new FieldGen(Constants.ACC_PRIVATE | Constants.ACC_FINAL | Constants.ACC_STATIC, BasicType.LONG, "serialVersionUID", getConstantPool()); addField(fg); hasSerialVersionUIDField = true; serialVersionUIDRequiresInitialization = true; if (world.getLint().calculatingSerialVersionUID.isEnabled()) { world.getLint().calculatingSerialVersionUID.signal( new String[] { getClassName(), Long.toString(calculatedSerialVersionUID) + "L" }, null, null); } } } ResolvedMember[] methods = myType.getDeclaredMethods(); for (int i = 0; i < methods.length; i++) { addMethodGen(new LazyMethodGen((BcelMethod) methods[i], this)); } ResolvedMember[] fields = myType.getDeclaredFields(); for (int i = 0; i < fields.length; i++) { this.fields.add((BcelField) fields[i]);
352,389
Bug 352389 overweaving can attribute duplicate attributes, one of which will not deserialize correctly
When overweaving it is possible that a class will get a second WeaverState attribute. This second one will not be valid (it hasn't been correctly configured). This isn't normally a problem because the next thing that happens is that the class is defined to the VM. But if *another* weave step occurs, the malformed attribute will cause that weave to fail with this kind of message: bad WeaverState.Kind: -115 The solution is to avoid adding the duplicate when overweaving.
resolved fixed
8553b30
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-07-18T20:44:33Z
2011-07-18T20:13:20Z
weaver/src/org/aspectj/weaver/bcel/LazyClassGen.java
} } public static boolean hasSerialVersionUIDField(ResolvedType type) { ResolvedMember[] fields = type.getDeclaredFields(); for (int i = 0; i < fields.length; i++) { ResolvedMember field = fields[i]; if (field.getName().equals("serialVersionUID") && Modifier.isStatic(field.getModifiers()) && field.getType().equals(ResolvedType.LONG)) { return true; } } return false; } public String getInternalClassName() { return getConstantPool().getConstantString_CONSTANTClass(myGen.getClassNameIndex()); } public String getInternalFileName() { String str = getInternalClassName(); int index = str.lastIndexOf('/'); if (index == -1) { return getFileName(); } else { return str.substring(0, index + 1) + getFileName();
352,389
Bug 352389 overweaving can attribute duplicate attributes, one of which will not deserialize correctly
When overweaving it is possible that a class will get a second WeaverState attribute. This second one will not be valid (it hasn't been correctly configured). This isn't normally a problem because the next thing that happens is that the class is defined to the VM. But if *another* weave step occurs, the malformed attribute will cause that weave to fail with this kind of message: bad WeaverState.Kind: -115 The solution is to avoid adding the duplicate when overweaving.
resolved fixed
8553b30
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-07-18T20:44:33Z
2011-07-18T20:13:20Z
weaver/src/org/aspectj/weaver/bcel/LazyClassGen.java
} } /** * Returns the packagename - if its the default package we return an empty string */ public String getPackageName() { if (packageName != null) { return packageName; } String str = getInternalClassName(); int index = str.indexOf("<"); if (index != -1) { str = str.substring(0, index); } index = str.lastIndexOf("/"); if (index == -1) { return ""; } return str.substring(0, index).replace('/', '.'); } public void addMethodGen(LazyMethodGen gen) { methodGens.add(gen); if (highestLineNumber < gen.highestLineNumber) { highestLineNumber = gen.highestLineNumber; } } public boolean removeMethodGen(LazyMethodGen gen) { return methodGens.remove(gen); }
352,389
Bug 352389 overweaving can attribute duplicate attributes, one of which will not deserialize correctly
When overweaving it is possible that a class will get a second WeaverState attribute. This second one will not be valid (it hasn't been correctly configured). This isn't normally a problem because the next thing that happens is that the class is defined to the VM. But if *another* weave step occurs, the malformed attribute will cause that weave to fail with this kind of message: bad WeaverState.Kind: -115 The solution is to avoid adding the duplicate when overweaving.
resolved fixed
8553b30
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-07-18T20:44:33Z
2011-07-18T20:13:20Z
weaver/src/org/aspectj/weaver/bcel/LazyClassGen.java
public void addMethodGen(LazyMethodGen gen, ISourceLocation sourceLocation) { addMethodGen(gen); if (!gen.getMethod().isPrivate()) { warnOnAddedMethod(gen.getMethod(), sourceLocation); } } public void errorOnAddedField(FieldGen field, ISourceLocation sourceLocation) { if (isSerializable && !hasSerialVersionUIDField) { getWorld().getLint().serialVersionUIDBroken.signal( new String[] { myType.getResolvedTypeX().getName(), field.getName() }, sourceLocation, null); } } public void warnOnAddedInterface(String name, ISourceLocation sourceLocation) { warnOnModifiedSerialVersionUID(sourceLocation, "added interface " + name); } public void warnOnAddedMethod(Method method, ISourceLocation sourceLocation) { warnOnModifiedSerialVersionUID(sourceLocation, "added non-private method " + method.getName()); } public void warnOnAddedStaticInitializer(Shadow shadow, ISourceLocation sourceLocation) { if (!hasClinit) { warnOnModifiedSerialVersionUID(sourceLocation, "added static initializer"); } } public void warnOnModifiedSerialVersionUID(ISourceLocation sourceLocation, String reason) { if (isSerializable && !hasSerialVersionUIDField) { getWorld().getLint().needsSerialVersionUIDField.signal(new String[] { myType.getResolvedTypeX().getName().toString(), reason }, sourceLocation, null); } } public World getWorld() {
352,389
Bug 352389 overweaving can attribute duplicate attributes, one of which will not deserialize correctly
When overweaving it is possible that a class will get a second WeaverState attribute. This second one will not be valid (it hasn't been correctly configured). This isn't normally a problem because the next thing that happens is that the class is defined to the VM. But if *another* weave step occurs, the malformed attribute will cause that weave to fail with this kind of message: bad WeaverState.Kind: -115 The solution is to avoid adding the duplicate when overweaving.
resolved fixed
8553b30
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-07-18T20:44:33Z
2011-07-18T20:13:20Z
weaver/src/org/aspectj/weaver/bcel/LazyClassGen.java
return world; } public List<LazyMethodGen> getMethodGens() { return methodGens; } public List<BcelField> getFieldGens() { return fields; } private void writeBack(BcelWorld world) { if (getConstantPool().getSize() > Short.MAX_VALUE) { reportClassTooBigProblem(); return; } if (annotations.size() > 0) { for (AnnotationGen element : annotations) { myGen.addAnnotation(element); } } if (!myGen.hasAttribute("org.aspectj.weaver.WeaverVersion")) { myGen.addAttribute(Utility.bcelAttribute(new AjAttribute.WeaverVersionInfo(), getConstantPool()));
352,389
Bug 352389 overweaving can attribute duplicate attributes, one of which will not deserialize correctly
When overweaving it is possible that a class will get a second WeaverState attribute. This second one will not be valid (it hasn't been correctly configured). This isn't normally a problem because the next thing that happens is that the class is defined to the VM. But if *another* weave step occurs, the malformed attribute will cause that weave to fail with this kind of message: bad WeaverState.Kind: -115 The solution is to avoid adding the duplicate when overweaving.
resolved fixed
8553b30
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-07-18T20:44:33Z
2011-07-18T20:13:20Z
weaver/src/org/aspectj/weaver/bcel/LazyClassGen.java
} if (myType != null && myType.getWeaverState() != null) { myGen.addAttribute(Utility.bcelAttribute(new AjAttribute.WeaverState(myType.getWeaverState()), getConstantPool())); } addAjcInitializers(); boolean sourceDebugExtensionSupportSwitchedOn = false; if (sourceDebugExtensionSupportSwitchedOn) { calculateSourceDebugExtensionOffsets(); } int len = methodGens.size(); myGen.setMethods(Method.NoMethods); for (LazyMethodGen gen : methodGens) { if (isEmptyClinit(gen)) { continue; } myGen.addMethod(gen.getMethod()); } len = fields.size(); myGen.setFields(Field.NoFields); for (int i = 0; i < len; i++) {
352,389
Bug 352389 overweaving can attribute duplicate attributes, one of which will not deserialize correctly
When overweaving it is possible that a class will get a second WeaverState attribute. This second one will not be valid (it hasn't been correctly configured). This isn't normally a problem because the next thing that happens is that the class is defined to the VM. But if *another* weave step occurs, the malformed attribute will cause that weave to fail with this kind of message: bad WeaverState.Kind: -115 The solution is to avoid adding the duplicate when overweaving.
resolved fixed
8553b30
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-07-18T20:44:33Z
2011-07-18T20:13:20Z
weaver/src/org/aspectj/weaver/bcel/LazyClassGen.java
BcelField gen = fields.get(i); myGen.addField(gen.getField(cp)); } if (sourceDebugExtensionSupportSwitchedOn) { if (inlinedFiles.size() != 0) { if (hasSourceDebugExtensionAttribute(myGen)) { world.showMessage(IMessage.WARNING, WeaverMessages.format(WeaverMessages.OVERWRITE_JSR45, getFileName()), null, null); } } } fixupGenericSignatureAttribute(); } /** * When working with Java generics, a signature attribute is attached to the type which indicates how it was declared. This * routine ensures the signature attribute for the class we are about to write out is correct. Basically its responsibilities * are: * <ol> * <li> * Checking whether the attribute needs changing (ie. did weaving change the type hierarchy) - if it did, remove the old * attribute * <li> * Check if we need an attribute at all, are we generic? are our supertypes parameterized/generic? * <li> * Build the new attribute which includes all typevariable, supertype and superinterface information * </ol> */ private void fixupGenericSignatureAttribute() { if (getWorld() != null && !getWorld().isInJava5Mode()) {
352,389
Bug 352389 overweaving can attribute duplicate attributes, one of which will not deserialize correctly
When overweaving it is possible that a class will get a second WeaverState attribute. This second one will not be valid (it hasn't been correctly configured). This isn't normally a problem because the next thing that happens is that the class is defined to the VM. But if *another* weave step occurs, the malformed attribute will cause that weave to fail with this kind of message: bad WeaverState.Kind: -115 The solution is to avoid adding the duplicate when overweaving.
resolved fixed
8553b30
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-07-18T20:44:33Z
2011-07-18T20:13:20Z
weaver/src/org/aspectj/weaver/bcel/LazyClassGen.java
return; } if (!regenerateGenericSignatureAttribute) { return; } Signature sigAttr = null; if (myType != null) { sigAttr = (Signature) myGen.getAttribute("Signature"); } boolean needAttribute = false; if (sigAttr != null) { needAttribute = true; } if (!needAttribute) { if (myType != null) { ResolvedType[] interfaceRTXs = myType.getDeclaredInterfaces();
352,389
Bug 352389 overweaving can attribute duplicate attributes, one of which will not deserialize correctly
When overweaving it is possible that a class will get a second WeaverState attribute. This second one will not be valid (it hasn't been correctly configured). This isn't normally a problem because the next thing that happens is that the class is defined to the VM. But if *another* weave step occurs, the malformed attribute will cause that weave to fail with this kind of message: bad WeaverState.Kind: -115 The solution is to avoid adding the duplicate when overweaving.
resolved fixed
8553b30
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-07-18T20:44:33Z
2011-07-18T20:13:20Z
weaver/src/org/aspectj/weaver/bcel/LazyClassGen.java
for (int i = 0; i < interfaceRTXs.length; i++) { ResolvedType typeX = interfaceRTXs[i]; if (typeX.isGenericType() || typeX.isParameterizedType()) { needAttribute = true; } } if (extraSuperInterfaces != null) { for (int i = 0; i < extraSuperInterfaces.length; i++) { ResolvedType interfaceType = extraSuperInterfaces[i]; if (interfaceType.isGenericType() || interfaceType.isParameterizedType()) { needAttribute = true; } } } } if (myType == null) { ResolvedType superclassRTX = superclass; if (superclassRTX != null) { if (superclassRTX.isGenericType() || superclassRTX.isParameterizedType()) { needAttribute = true; } } } else { ResolvedType superclassRTX = getSuperClass(); if (superclassRTX.isGenericType() || superclassRTX.isParameterizedType()) { needAttribute = true; } } }
352,389
Bug 352389 overweaving can attribute duplicate attributes, one of which will not deserialize correctly
When overweaving it is possible that a class will get a second WeaverState attribute. This second one will not be valid (it hasn't been correctly configured). This isn't normally a problem because the next thing that happens is that the class is defined to the VM. But if *another* weave step occurs, the malformed attribute will cause that weave to fail with this kind of message: bad WeaverState.Kind: -115 The solution is to avoid adding the duplicate when overweaving.
resolved fixed
8553b30
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-07-18T20:44:33Z
2011-07-18T20:13:20Z
weaver/src/org/aspectj/weaver/bcel/LazyClassGen.java
if (needAttribute) { StringBuffer signature = new StringBuffer(); if (myType != null) { TypeVariable[] tVars = myType.getTypeVariables(); if (tVars.length > 0) { signature.append("<"); for (int i = 0; i < tVars.length; i++) { TypeVariable variable = tVars[i]; signature.append(variable.getSignatureForAttribute()); } signature.append(">"); } } String supersig = getSuperClass().getSignatureForAttribute(); signature.append(supersig); if (myType != null) { ResolvedType[] interfaceRTXs = myType.getDeclaredInterfaces(); for (int i = 0; i < interfaceRTXs.length; i++) { String s = interfaceRTXs[i].getSignatureForAttribute(); signature.append(s); } if (extraSuperInterfaces != null) { for (int i = 0; i < extraSuperInterfaces.length; i++) { String s = extraSuperInterfaces[i].getSignatureForAttribute(); signature.append(s); } } }
352,389
Bug 352389 overweaving can attribute duplicate attributes, one of which will not deserialize correctly
When overweaving it is possible that a class will get a second WeaverState attribute. This second one will not be valid (it hasn't been correctly configured). This isn't normally a problem because the next thing that happens is that the class is defined to the VM. But if *another* weave step occurs, the malformed attribute will cause that weave to fail with this kind of message: bad WeaverState.Kind: -115 The solution is to avoid adding the duplicate when overweaving.
resolved fixed
8553b30
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-07-18T20:44:33Z
2011-07-18T20:13:20Z
weaver/src/org/aspectj/weaver/bcel/LazyClassGen.java
if (sigAttr != null) { myGen.removeAttribute(sigAttr); } myGen.addAttribute(createSignatureAttribute(signature.toString())); } } /** * Helper method to create a signature attribute based on a string signature: e.g. "Ljava/lang/Object;LI<Ljava/lang/Double;>;" */ private Signature createSignatureAttribute(String signature) { int nameIndex = cp.addUtf8("Signature"); int sigIndex = cp.addUtf8(signature); return new Signature(nameIndex, 2, sigIndex, cp); } /** * */ private void reportClassTooBigProblem() { myGen = new ClassGen(myGen.getClassName(), myGen.getSuperclassName(), myGen.getFileName(), myGen.getModifiers(), myGen.getInterfaceNames()); getWorld().showMessage(IMessage.ERROR, WeaverMessages.format(WeaverMessages.CLASS_TOO_BIG, this.getClassName()),
352,389
Bug 352389 overweaving can attribute duplicate attributes, one of which will not deserialize correctly
When overweaving it is possible that a class will get a second WeaverState attribute. This second one will not be valid (it hasn't been correctly configured). This isn't normally a problem because the next thing that happens is that the class is defined to the VM. But if *another* weave step occurs, the malformed attribute will cause that weave to fail with this kind of message: bad WeaverState.Kind: -115 The solution is to avoid adding the duplicate when overweaving.
resolved fixed
8553b30
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-07-18T20:44:33Z
2011-07-18T20:13:20Z
weaver/src/org/aspectj/weaver/bcel/LazyClassGen.java
new SourceLocation(new File(myGen.getFileName()), 0), null); } private static boolean hasSourceDebugExtensionAttribute(ClassGen gen) { return gen.hasAttribute("SourceDebugExtension"); } public JavaClass getJavaClass(BcelWorld world) { writeBack(world); return myGen.getJavaClass(); } public byte[] getJavaClassBytesIncludingReweavable(BcelWorld world) { writeBack(world); byte[] wovenClassFileData = myGen.getJavaClass().getBytes(); if (myGen.getMajor() >= Constants.MAJOR_1_6 && world.shouldGenerateStackMaps() && AsmDetector.isAsmAround) { wovenClassFileData = StackMapAdder.addStackMaps(world, wovenClassFileData); } WeaverStateInfo wsi = myType.getWeaverState(); if (wsi != null && wsi.isReweavable()) { return wsi.replaceKeyWithDiff(wovenClassFileData); } else { return wovenClassFileData; } } public void addGeneratedInner(LazyClassGen newClass) { classGens.add(newClass); } public void addInterface(ResolvedType newInterface, ISourceLocation sourceLocation) { regenerateGenericSignatureAttribute = true;
352,389
Bug 352389 overweaving can attribute duplicate attributes, one of which will not deserialize correctly
When overweaving it is possible that a class will get a second WeaverState attribute. This second one will not be valid (it hasn't been correctly configured). This isn't normally a problem because the next thing that happens is that the class is defined to the VM. But if *another* weave step occurs, the malformed attribute will cause that weave to fail with this kind of message: bad WeaverState.Kind: -115 The solution is to avoid adding the duplicate when overweaving.
resolved fixed
8553b30
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-07-18T20:44:33Z
2011-07-18T20:13:20Z
weaver/src/org/aspectj/weaver/bcel/LazyClassGen.java
if (extraSuperInterfaces == null) { extraSuperInterfaces = new ResolvedType[1]; extraSuperInterfaces[0] = newInterface; } else { ResolvedType[] x = new ResolvedType[extraSuperInterfaces.length + 1]; System.arraycopy(extraSuperInterfaces, 0, x, 1, extraSuperInterfaces.length); x[0] = newInterface; extraSuperInterfaces = x; } myGen.addInterface(newInterface.getRawName()); if (!newInterface.equals(UnresolvedType.SERIALIZABLE)) { warnOnAddedInterface(newInterface.getName(), sourceLocation); } } public void setSuperClass(ResolvedType newSuperclass) { regenerateGenericSignatureAttribute = true; superclass = newSuperclass; if (newSuperclass.getGenericType() != null) { newSuperclass = newSuperclass.getGenericType(); } myGen.setSuperclassName(newSuperclass.getName()); } public ResolvedType getSuperClass() { if (superclass != null) { return superclass;
352,389
Bug 352389 overweaving can attribute duplicate attributes, one of which will not deserialize correctly
When overweaving it is possible that a class will get a second WeaverState attribute. This second one will not be valid (it hasn't been correctly configured). This isn't normally a problem because the next thing that happens is that the class is defined to the VM. But if *another* weave step occurs, the malformed attribute will cause that weave to fail with this kind of message: bad WeaverState.Kind: -115 The solution is to avoid adding the duplicate when overweaving.
resolved fixed
8553b30
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-07-18T20:44:33Z
2011-07-18T20:13:20Z
weaver/src/org/aspectj/weaver/bcel/LazyClassGen.java
} return myType.getSuperclass(); } public String[] getInterfaceNames() { return myGen.getInterfaceNames(); } private List<LazyClassGen> getClassGens() { List<LazyClassGen> ret = new ArrayList<LazyClassGen>(); ret.add(this); ret.addAll(classGens); return ret; } public List<UnwovenClassFile.ChildClass> getChildClasses(BcelWorld world) { if (classGens.isEmpty()) { return Collections.emptyList(); } List<UnwovenClassFile.ChildClass> ret = new ArrayList<UnwovenClassFile.ChildClass>(); for (LazyClassGen clazz : classGens) { byte[] bytes = clazz.getJavaClass(world).getBytes(); String name = clazz.getName(); int index = name.lastIndexOf('$'); name = name.substring(index + 1); ret.add(new UnwovenClassFile.ChildClass(name, bytes)); } return ret; } @Override public String toString() {
352,389
Bug 352389 overweaving can attribute duplicate attributes, one of which will not deserialize correctly
When overweaving it is possible that a class will get a second WeaverState attribute. This second one will not be valid (it hasn't been correctly configured). This isn't normally a problem because the next thing that happens is that the class is defined to the VM. But if *another* weave step occurs, the malformed attribute will cause that weave to fail with this kind of message: bad WeaverState.Kind: -115 The solution is to avoid adding the duplicate when overweaving.
resolved fixed
8553b30
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-07-18T20:44:33Z
2011-07-18T20:13:20Z
weaver/src/org/aspectj/weaver/bcel/LazyClassGen.java
return toShortString(); } public String toShortString() { String s = org.aspectj.apache.bcel.classfile.Utility.accessToString(myGen.getModifiers(), true); if (s != "") { s += " "; } s += org.aspectj.apache.bcel.classfile.Utility.classOrInterface(myGen.getModifiers()); s += " "; s += myGen.getClassName(); return s; } public String toLongString() { ByteArrayOutputStream s = new ByteArrayOutputStream(); print(new PrintStream(s)); return new String(s.toByteArray()); } public void print() { print(System.out); } public void print(PrintStream out) { List<LazyClassGen> classGens = getClassGens(); for (Iterator<LazyClassGen> iter = classGens.iterator(); iter.hasNext();) { LazyClassGen element = iter.next(); element.printOne(out); if (iter.hasNext()) { out.println(); } } }
352,389
Bug 352389 overweaving can attribute duplicate attributes, one of which will not deserialize correctly
When overweaving it is possible that a class will get a second WeaverState attribute. This second one will not be valid (it hasn't been correctly configured). This isn't normally a problem because the next thing that happens is that the class is defined to the VM. But if *another* weave step occurs, the malformed attribute will cause that weave to fail with this kind of message: bad WeaverState.Kind: -115 The solution is to avoid adding the duplicate when overweaving.
resolved fixed
8553b30
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-07-18T20:44:33Z
2011-07-18T20:13:20Z
weaver/src/org/aspectj/weaver/bcel/LazyClassGen.java
private void printOne(PrintStream out) { out.print(toShortString()); out.print(" extends "); out.print(org.aspectj.apache.bcel.classfile.Utility.compactClassName(myGen.getSuperclassName(), false)); int size = myGen.getInterfaces().length; if (size > 0) { out.print(" implements "); for (int i = 0; i < size; i++) { out.print(myGen.getInterfaceNames()[i]); if (i < size - 1) { out.print(", "); } } } out.print(":"); out.println(); if (myType != null) { myType.printWackyStuff(out); } Field[] fields = myGen.getFields(); for (int i = 0, len = fields.length; i < len; i++) { out.print(" "); out.println(fields[i]); } List<LazyMethodGen> methodGens = getMethodGens(); for (Iterator<LazyMethodGen> iter = methodGens.iterator(); iter.hasNext();) { LazyMethodGen gen = iter.next(); if (isEmptyClinit(gen)) {
352,389
Bug 352389 overweaving can attribute duplicate attributes, one of which will not deserialize correctly
When overweaving it is possible that a class will get a second WeaverState attribute. This second one will not be valid (it hasn't been correctly configured). This isn't normally a problem because the next thing that happens is that the class is defined to the VM. But if *another* weave step occurs, the malformed attribute will cause that weave to fail with this kind of message: bad WeaverState.Kind: -115 The solution is to avoid adding the duplicate when overweaving.
resolved fixed
8553b30
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-07-18T20:44:33Z
2011-07-18T20:13:20Z
weaver/src/org/aspectj/weaver/bcel/LazyClassGen.java
continue; } gen.print(out, (myType != null ? myType.getWeaverVersionAttribute() : WeaverVersionInfo.UNKNOWN)); if (iter.hasNext()) { out.println(); } } out.println("end " + toShortString()); } private boolean isEmptyClinit(LazyMethodGen gen) { if (!gen.getName().equals("<clinit>")) { return false; } InstructionHandle start = gen.getBody().getStart(); while (start != null) { if (Range.isRangeHandle(start) || (start.getInstruction().opcode == Constants.RETURN)) { start = start.getNext(); } else { return false; } } return true; } public ConstantPool getConstantPool() { return cp; } public String getName() { return myGen.getClassName();
352,389
Bug 352389 overweaving can attribute duplicate attributes, one of which will not deserialize correctly
When overweaving it is possible that a class will get a second WeaverState attribute. This second one will not be valid (it hasn't been correctly configured). This isn't normally a problem because the next thing that happens is that the class is defined to the VM. But if *another* weave step occurs, the malformed attribute will cause that weave to fail with this kind of message: bad WeaverState.Kind: -115 The solution is to avoid adding the duplicate when overweaving.
resolved fixed
8553b30
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-07-18T20:44:33Z
2011-07-18T20:13:20Z
weaver/src/org/aspectj/weaver/bcel/LazyClassGen.java
} public boolean isWoven() { return myType.getWeaverState() != null; } public boolean isReweavable() { if (myType.getWeaverState() == null) { return true; } return myType.getWeaverState().isReweavable(); } public Set<String> getAspectsAffectingType() { if (myType.getWeaverState() == null) { return null; } return myType.getWeaverState().getAspectsAffectingType(); } public WeaverStateInfo getOrCreateWeaverStateInfo(boolean inReweavableMode) { WeaverStateInfo ret = myType.getWeaverState(); if (ret != null) { return ret; } ret = new WeaverStateInfo(inReweavableMode); myType.setWeaverState(ret); return ret; } public InstructionFactory getFactory() { return fact; } public LazyMethodGen getStaticInitializer() { for (LazyMethodGen gen : methodGens) {
352,389
Bug 352389 overweaving can attribute duplicate attributes, one of which will not deserialize correctly
When overweaving it is possible that a class will get a second WeaverState attribute. This second one will not be valid (it hasn't been correctly configured). This isn't normally a problem because the next thing that happens is that the class is defined to the VM. But if *another* weave step occurs, the malformed attribute will cause that weave to fail with this kind of message: bad WeaverState.Kind: -115 The solution is to avoid adding the duplicate when overweaving.
resolved fixed
8553b30
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-07-18T20:44:33Z
2011-07-18T20:13:20Z
weaver/src/org/aspectj/weaver/bcel/LazyClassGen.java
if (gen.getName().equals("<clinit>")) { return gen; } } LazyMethodGen clinit = new LazyMethodGen(Modifier.STATIC, Type.VOID, "<clinit>", new Type[0], NO_STRINGS, this); clinit.getBody().insert(InstructionConstants.RETURN); methodGens.add(clinit); return clinit; } /** * Retrieve the ajc$preClinit method - this method captures any initialization AspectJ wants to ensure happens in a class. It is * called from the static initializer. Maintaining this separation enables overweaving to ignore join points added due to * earlier weaves. If the ajc$preClinit method cannot be found, it is created and a call to it is placed in the real static * initializer (the call is placed at the start of the static initializer). * * @return the LazyMethodGen representing the ajc$ clinit */ public LazyMethodGen getAjcPreClinit() { if (this.isInterface()) { throw new IllegalStateException(); } for (LazyMethodGen methodGen : methodGens) { if (methodGen.getName().equals(NameMangler.AJC_PRE_CLINIT_NAME)) { return methodGen; } } LazyMethodGen ajcPreClinit = new LazyMethodGen(Modifier.PRIVATE | Modifier.STATIC, Type.VOID, NameMangler.AJC_PRE_CLINIT_NAME, Type.NO_ARGS, NO_STRINGS, this); ajcPreClinit.getBody().insert(InstructionConstants.RETURN);
352,389
Bug 352389 overweaving can attribute duplicate attributes, one of which will not deserialize correctly
When overweaving it is possible that a class will get a second WeaverState attribute. This second one will not be valid (it hasn't been correctly configured). This isn't normally a problem because the next thing that happens is that the class is defined to the VM. But if *another* weave step occurs, the malformed attribute will cause that weave to fail with this kind of message: bad WeaverState.Kind: -115 The solution is to avoid adding the duplicate when overweaving.
resolved fixed
8553b30
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-07-18T20:44:33Z
2011-07-18T20:13:20Z
weaver/src/org/aspectj/weaver/bcel/LazyClassGen.java
methodGens.add(ajcPreClinit); getStaticInitializer().getBody().insert(Utility.createInvoke(fact, ajcPreClinit)); return ajcPreClinit; } /** * factory method for building multiple extended clinit methods. Constructs a new clinit method that invokes the previous one * and then returns it. The index is used as a name suffix. * * @param previousPreClinit * @param i */ public LazyMethodGen createExtendedAjcPreClinit(LazyMethodGen previousPreClinit, int i) { LazyMethodGen ajcPreClinit = new LazyMethodGen(Modifier.PRIVATE | Modifier.STATIC, Type.VOID, NameMangler.AJC_PRE_CLINIT_NAME + i, Type.NO_ARGS, NO_STRINGS, this); ajcPreClinit.getBody().insert(InstructionConstants.RETURN); methodGens.add(ajcPreClinit); previousPreClinit.getBody().insert(Utility.createInvoke(fact, ajcPreClinit)); return ajcPreClinit; } private Map<BcelShadow, Field> tjpFields = new HashMap<BcelShadow, Field>(); Map<CacheKey, Field> annotationCachingFieldCache = new HashMap<CacheKey, Field>(); private int tjpFieldsCounter = -1; private int annoFieldsCounter = 0; public static final ObjectType proceedingTjpType = new ObjectType("org.aspectj.lang.ProceedingJoinPoint"); public static final ObjectType tjpType = new ObjectType("org.aspectj.lang.JoinPoint"); public static final ObjectType staticTjpType = new ObjectType("org.aspectj.lang.JoinPoint$StaticPart"); public static final ObjectType typeForAnnotation = new ObjectType("java.lang.annotation.Annotation"); public static final ObjectType enclosingStaticTjpType = new ObjectType("org.aspectj.lang.JoinPoint$EnclosingStaticPart");
352,389
Bug 352389 overweaving can attribute duplicate attributes, one of which will not deserialize correctly
When overweaving it is possible that a class will get a second WeaverState attribute. This second one will not be valid (it hasn't been correctly configured). This isn't normally a problem because the next thing that happens is that the class is defined to the VM. But if *another* weave step occurs, the malformed attribute will cause that weave to fail with this kind of message: bad WeaverState.Kind: -115 The solution is to avoid adding the duplicate when overweaving.
resolved fixed
8553b30
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-07-18T20:44:33Z
2011-07-18T20:13:20Z
weaver/src/org/aspectj/weaver/bcel/LazyClassGen.java
private static final ObjectType sigType = new ObjectType("org.aspectj.lang.Signature"); private static final ObjectType factoryType = new ObjectType("org.aspectj.runtime.reflect.Factory"); private static final ObjectType classType = new ObjectType("java.lang.Class"); public Field getTjpField(BcelShadow shadow, final boolean isEnclosingJp) { Field tjpField = tjpFields.get(shadow); if (tjpField != null) { return tjpField; } int modifiers = Modifier.STATIC | Modifier.FINAL; LazyMethodGen encMethod = shadow.getEnclosingMethod(); boolean shadowIsInAroundAdvice = false; if (encMethod != null && encMethod.getName().startsWith(NameMangler.PREFIX + "around")) { shadowIsInAroundAdvice = true; } if (getType().isInterface() || shadowIsInAroundAdvice) { modifiers |= Modifier.PUBLIC; } else { modifiers |= Modifier.PRIVATE; } ObjectType jpType = null;
352,389
Bug 352389 overweaving can attribute duplicate attributes, one of which will not deserialize correctly
When overweaving it is possible that a class will get a second WeaverState attribute. This second one will not be valid (it hasn't been correctly configured). This isn't normally a problem because the next thing that happens is that the class is defined to the VM. But if *another* weave step occurs, the malformed attribute will cause that weave to fail with this kind of message: bad WeaverState.Kind: -115 The solution is to avoid adding the duplicate when overweaving.
resolved fixed
8553b30
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-07-18T20:44:33Z
2011-07-18T20:13:20Z
weaver/src/org/aspectj/weaver/bcel/LazyClassGen.java
if (world.isTargettingAspectJRuntime12()) { jpType = staticTjpType; } else { jpType = isEnclosingJp ? enclosingStaticTjpType : staticTjpType; } if (tjpFieldsCounter == -1) { if (!world.isOverWeaving()) { tjpFieldsCounter = 0; } else { List<BcelField> existingFields = getFieldGens(); if (existingFields == null) { tjpFieldsCounter = 0; } else { BcelField lastField = null; for (BcelField field : existingFields) { if (field.getName().startsWith("ajc$tjp_")) { lastField = field; } } if (lastField == null) { tjpFieldsCounter = 0; } else { tjpFieldsCounter = Integer.parseInt(lastField.getName().substring(8)) + 1; } } } }
352,389
Bug 352389 overweaving can attribute duplicate attributes, one of which will not deserialize correctly
When overweaving it is possible that a class will get a second WeaverState attribute. This second one will not be valid (it hasn't been correctly configured). This isn't normally a problem because the next thing that happens is that the class is defined to the VM. But if *another* weave step occurs, the malformed attribute will cause that weave to fail with this kind of message: bad WeaverState.Kind: -115 The solution is to avoid adding the duplicate when overweaving.
resolved fixed
8553b30
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-07-18T20:44:33Z
2011-07-18T20:13:20Z
weaver/src/org/aspectj/weaver/bcel/LazyClassGen.java
FieldGen fGen = new FieldGen(modifiers, jpType, "ajc$tjp_" + tjpFieldsCounter++, getConstantPool()); addField(fGen); tjpField = fGen.getField(); tjpFields.put(shadow, tjpField); return tjpField; } /** * Create a field in the type containing the shadow where the annotation retrieved during binding can be stored - for later fast * access. * * @param shadow the shadow at which the @annotation result is being cached * @return a field */ public Field getAnnotationCachingField(BcelShadow shadow, ResolvedType toType) { CacheKey cacheKey = new CacheKey(shadow, toType); Field field = annotationCachingFieldCache.get(cacheKey); if (field == null) { StringBuilder sb = new StringBuilder(); sb.append(NameMangler.ANNOTATION_CACHE_FIELD_NAME); sb.append(annoFieldsCounter++); FieldGen annotationCacheField = new FieldGen(Modifier.PRIVATE | Modifier.STATIC, typeForAnnotation, sb.toString(), cp); addField(annotationCacheField); field = annotationCacheField.getField(); annotationCachingFieldCache.put(cacheKey, field); } return field; } static class CacheKey {
352,389
Bug 352389 overweaving can attribute duplicate attributes, one of which will not deserialize correctly
When overweaving it is possible that a class will get a second WeaverState attribute. This second one will not be valid (it hasn't been correctly configured). This isn't normally a problem because the next thing that happens is that the class is defined to the VM. But if *another* weave step occurs, the malformed attribute will cause that weave to fail with this kind of message: bad WeaverState.Kind: -115 The solution is to avoid adding the duplicate when overweaving.
resolved fixed
8553b30
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-07-18T20:44:33Z
2011-07-18T20:13:20Z
weaver/src/org/aspectj/weaver/bcel/LazyClassGen.java
private BcelShadow shadow; private ResolvedType annotationType; CacheKey(BcelShadow shadow, ResolvedType annotationType) {
352,389
Bug 352389 overweaving can attribute duplicate attributes, one of which will not deserialize correctly
When overweaving it is possible that a class will get a second WeaverState attribute. This second one will not be valid (it hasn't been correctly configured). This isn't normally a problem because the next thing that happens is that the class is defined to the VM. But if *another* weave step occurs, the malformed attribute will cause that weave to fail with this kind of message: bad WeaverState.Kind: -115 The solution is to avoid adding the duplicate when overweaving.
resolved fixed
8553b30
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-07-18T20:44:33Z
2011-07-18T20:13:20Z
weaver/src/org/aspectj/weaver/bcel/LazyClassGen.java
this.shadow = shadow; this.annotationType = annotationType; } @Override public int hashCode() { return shadow.hashCode() * 37 + annotationType.hashCode(); } @Override public boolean equals(Object other) { if (!(other instanceof CacheKey)) { return false; } CacheKey oCacheKey = (CacheKey) other; return shadow.equals(oCacheKey.shadow) && annotationType.equals(oCacheKey.annotationType); } }
352,389
Bug 352389 overweaving can attribute duplicate attributes, one of which will not deserialize correctly
When overweaving it is possible that a class will get a second WeaverState attribute. This second one will not be valid (it hasn't been correctly configured). This isn't normally a problem because the next thing that happens is that the class is defined to the VM. But if *another* weave step occurs, the malformed attribute will cause that weave to fail with this kind of message: bad WeaverState.Kind: -115 The solution is to avoid adding the duplicate when overweaving.
resolved fixed
8553b30
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-07-18T20:44:33Z
2011-07-18T20:13:20Z
weaver/src/org/aspectj/weaver/bcel/LazyClassGen.java
private void addAjcInitializers() { if (tjpFields.size() == 0 && !serialVersionUIDRequiresInitialization) { return; } InstructionList[] il = null; if (tjpFields.size() > 0) { il = initializeAllTjps(); } if (serialVersionUIDRequiresInitialization) { InstructionList[] ilSVUID = new InstructionList[1]; ilSVUID[0] = new InstructionList(); ilSVUID[0].append(InstructionFactory.PUSH(getConstantPool(), calculatedSerialVersionUID)); ilSVUID[0].append(getFactory().createFieldAccess(getClassName(), "serialVersionUID", BasicType.LONG, Constants.PUTSTATIC)); if (il == null) { il = ilSVUID; } else { InstructionList[] newIl = new InstructionList[il.length + ilSVUID.length]; System.arraycopy(il, 0, newIl, 0, il.length); System.arraycopy(ilSVUID, 0, newIl, il.length, ilSVUID.length); il = newIl; } } LazyMethodGen prevMethod; LazyMethodGen nextMethod = null;
352,389
Bug 352389 overweaving can attribute duplicate attributes, one of which will not deserialize correctly
When overweaving it is possible that a class will get a second WeaverState attribute. This second one will not be valid (it hasn't been correctly configured). This isn't normally a problem because the next thing that happens is that the class is defined to the VM. But if *another* weave step occurs, the malformed attribute will cause that weave to fail with this kind of message: bad WeaverState.Kind: -115 The solution is to avoid adding the duplicate when overweaving.
resolved fixed
8553b30
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-07-18T20:44:33Z
2011-07-18T20:13:20Z
weaver/src/org/aspectj/weaver/bcel/LazyClassGen.java
if (this.isInterface()) { prevMethod = getStaticInitializer(); } else { prevMethod = getAjcPreClinit(); } for (int counter = 1; counter <= il.length; counter++) { if (il.length > counter) { nextMethod = createExtendedAjcPreClinit(prevMethod, counter); } prevMethod.getBody().insert(il[counter - 1]); prevMethod = nextMethod; } } private InstructionList initInstructionList() { InstructionList list = new InstructionList(); InstructionFactory fact = getFactory(); list.append(fact.createNew(factoryType)); list.append(InstructionFactory.createDup(1)); list.append(InstructionFactory.PUSH(getConstantPool(), getFileName())); list.append(fact.PUSHCLASS(cp, myGen.getClassName())); list.append(fact.createInvoke(factoryType.getClassName(), "<init>", Type.VOID, new Type[] { Type.STRING, classType }, Constants.INVOKESPECIAL)); list.append(InstructionFactory.createStore(factoryType, 0)); return list;
352,389
Bug 352389 overweaving can attribute duplicate attributes, one of which will not deserialize correctly
When overweaving it is possible that a class will get a second WeaverState attribute. This second one will not be valid (it hasn't been correctly configured). This isn't normally a problem because the next thing that happens is that the class is defined to the VM. But if *another* weave step occurs, the malformed attribute will cause that weave to fail with this kind of message: bad WeaverState.Kind: -115 The solution is to avoid adding the duplicate when overweaving.
resolved fixed
8553b30
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-07-18T20:44:33Z
2011-07-18T20:13:20Z
weaver/src/org/aspectj/weaver/bcel/LazyClassGen.java
} private InstructionList[] initializeAllTjps() { Vector<InstructionList> lists = new Vector<InstructionList>(); InstructionList list = initInstructionList(); lists.add(list); List<Map.Entry<BcelShadow, Field>> entries = new ArrayList<Map.Entry<BcelShadow, Field>>(tjpFields.entrySet()); Collections.sort(entries, new Comparator<Map.Entry<BcelShadow, Field>>() { public int compare(Map.Entry<BcelShadow, Field> a, Map.Entry<BcelShadow, Field> b) { return (a.getValue()).getName().compareTo((b.getValue()).getName()); } }); long estimatedSize = 0; for (Iterator<Map.Entry<BcelShadow, Field>> i = entries.iterator(); i.hasNext();) { Map.Entry<BcelShadow, Field> entry = i.next(); if (estimatedSize > Constants.MAX_CODE_SIZE) { estimatedSize = 0; list = initInstructionList(); lists.add(list); } estimatedSize += entry.getValue().getSignature().getBytes().length; initializeTjp(fact, list, entry.getValue(), entry.getKey()); } InstructionList listArrayModel[] = new InstructionList[1]; return lists.toArray(listArrayModel); } private void initializeTjp(InstructionFactory fact, InstructionList list, Field field, BcelShadow shadow) { boolean fastSJP = false; boolean isFastSJPAvailable = shadow.getWorld().isTargettingRuntime1_6_10() && !enclosingStaticTjpType.equals(field.getType());
352,389
Bug 352389 overweaving can attribute duplicate attributes, one of which will not deserialize correctly
When overweaving it is possible that a class will get a second WeaverState attribute. This second one will not be valid (it hasn't been correctly configured). This isn't normally a problem because the next thing that happens is that the class is defined to the VM. But if *another* weave step occurs, the malformed attribute will cause that weave to fail with this kind of message: bad WeaverState.Kind: -115 The solution is to avoid adding the duplicate when overweaving.
resolved fixed
8553b30
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-07-18T20:44:33Z
2011-07-18T20:13:20Z
weaver/src/org/aspectj/weaver/bcel/LazyClassGen.java
Member sig = shadow.getSignature(); list.append(InstructionFactory.createLoad(factoryType, 0)); list.append(InstructionFactory.PUSH(getConstantPool(), shadow.getKind().getName())); if (world.isTargettingAspectJRuntime12() || !isFastSJPAvailable || !sig.getKind().equals(Member.METHOD)) { list.append(InstructionFactory.createLoad(factoryType, 0)); } String signatureMakerName = SignatureUtils.getSignatureMakerName(sig); ObjectType signatureType = new ObjectType(SignatureUtils.getSignatureType(sig)); UnresolvedType[] exceptionTypes = null; if (world.isTargettingAspectJRuntime12()) { list.append(InstructionFactory.PUSH(cp, SignatureUtils.getSignatureString(sig, shadow.getWorld()))); list.append(fact.createInvoke(factoryType.getClassName(), signatureMakerName, signatureType, Type.STRINGARRAY1, Constants.INVOKEVIRTUAL)); } else if (sig.getKind().equals(Member.METHOD)) { BcelWorld w = shadow.getWorld(); list.append(InstructionFactory.PUSH(cp, makeString(sig.getModifiers(w)))); list.append(InstructionFactory.PUSH(cp, sig.getName())); list.append(InstructionFactory.PUSH(cp, makeString(sig.getDeclaringType()))); list.append(InstructionFactory.PUSH(cp, makeString(sig.getParameterTypes()))); list.append(InstructionFactory.PUSH(cp, makeString(sig.getParameterNames(w)))); exceptionTypes = sig.getExceptions(w); if (isFastSJPAvailable && exceptionTypes.length == 0) { fastSJP = true; } else {
352,389
Bug 352389 overweaving can attribute duplicate attributes, one of which will not deserialize correctly
When overweaving it is possible that a class will get a second WeaverState attribute. This second one will not be valid (it hasn't been correctly configured). This isn't normally a problem because the next thing that happens is that the class is defined to the VM. But if *another* weave step occurs, the malformed attribute will cause that weave to fail with this kind of message: bad WeaverState.Kind: -115 The solution is to avoid adding the duplicate when overweaving.
resolved fixed
8553b30
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-07-18T20:44:33Z
2011-07-18T20:13:20Z
weaver/src/org/aspectj/weaver/bcel/LazyClassGen.java
list.append(InstructionFactory.PUSH(cp, makeString(exceptionTypes))); } list.append(InstructionFactory.PUSH(cp, makeString(sig.getReturnType()))); if (isFastSJPAvailable) { fastSJP = true; } else { list.append(fact.createInvoke(factoryType.getClassName(), signatureMakerName, signatureType, Type.STRINGARRAY7, Constants.INVOKEVIRTUAL)); } } else if (sig.getKind().equals(Member.MONITORENTER)) { list.append(InstructionFactory.PUSH(cp, makeString(sig.getDeclaringType()))); list.append(fact.createInvoke(factoryType.getClassName(), signatureMakerName, signatureType, Type.STRINGARRAY1, Constants.INVOKEVIRTUAL)); } else if (sig.getKind().equals(Member.MONITOREXIT)) { list.append(InstructionFactory.PUSH(cp, makeString(sig.getDeclaringType()))); list.append(fact.createInvoke(factoryType.getClassName(), signatureMakerName, signatureType, Type.STRINGARRAY1, Constants.INVOKEVIRTUAL)); } else if (sig.getKind().equals(Member.HANDLER)) { BcelWorld w = shadow.getWorld(); list.append(InstructionFactory.PUSH(cp, makeString(sig.getDeclaringType()))); list.append(InstructionFactory.PUSH(cp, makeString(sig.getParameterTypes()))); list.append(InstructionFactory.PUSH(cp, makeString(sig.getParameterNames(w)))); list.append(fact.createInvoke(factoryType.getClassName(), signatureMakerName, signatureType, Type.STRINGARRAY3, Constants.INVOKEVIRTUAL)); } else if (sig.getKind().equals(Member.CONSTRUCTOR)) { BcelWorld w = shadow.getWorld(); if (w.isJoinpointArrayConstructionEnabled() && sig.getDeclaringType().isArray()) { list.append(InstructionFactory.PUSH(cp, makeString(Modifier.PUBLIC)));
352,389
Bug 352389 overweaving can attribute duplicate attributes, one of which will not deserialize correctly
When overweaving it is possible that a class will get a second WeaverState attribute. This second one will not be valid (it hasn't been correctly configured). This isn't normally a problem because the next thing that happens is that the class is defined to the VM. But if *another* weave step occurs, the malformed attribute will cause that weave to fail with this kind of message: bad WeaverState.Kind: -115 The solution is to avoid adding the duplicate when overweaving.
resolved fixed
8553b30
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-07-18T20:44:33Z
2011-07-18T20:13:20Z
weaver/src/org/aspectj/weaver/bcel/LazyClassGen.java
list.append(InstructionFactory.PUSH(cp, makeString(sig.getDeclaringType()))); list.append(InstructionFactory.PUSH(cp, makeString(sig.getParameterTypes()))); list.append(InstructionFactory.PUSH(cp, "")); list.append(InstructionFactory.PUSH(cp, "")); list.append(fact.createInvoke(factoryType.getClassName(), signatureMakerName, signatureType, Type.STRINGARRAY5, Constants.INVOKEVIRTUAL)); } else { list.append(InstructionFactory.PUSH(cp, makeString(sig.getModifiers(w)))); list.append(InstructionFactory.PUSH(cp, makeString(sig.getDeclaringType()))); list.append(InstructionFactory.PUSH(cp, makeString(sig.getParameterTypes()))); list.append(InstructionFactory.PUSH(cp, makeString(sig.getParameterNames(w)))); list.append(InstructionFactory.PUSH(cp, makeString(sig.getExceptions(w)))); list.append(fact.createInvoke(factoryType.getClassName(), signatureMakerName, signatureType, Type.STRINGARRAY5, Constants.INVOKEVIRTUAL)); } } else if (sig.getKind().equals(Member.FIELD)) { BcelWorld w = shadow.getWorld(); list.append(InstructionFactory.PUSH(cp, makeString(sig.getModifiers(w)))); list.append(InstructionFactory.PUSH(cp, sig.getName())); UnresolvedType dType = sig.getDeclaringType(); if (dType.getTypekind() == TypeKind.PARAMETERIZED || dType.getTypekind() == TypeKind.GENERIC) { dType = sig.getDeclaringType().resolve(world).getGenericType(); } list.append(InstructionFactory.PUSH(cp, makeString(dType))); list.append(InstructionFactory.PUSH(cp, makeString(sig.getReturnType()))); list.append(fact.createInvoke(factoryType.getClassName(), signatureMakerName, signatureType, Type.STRINGARRAY4, Constants.INVOKEVIRTUAL)); } else if (sig.getKind().equals(Member.ADVICE)) { BcelWorld w = shadow.getWorld();
352,389
Bug 352389 overweaving can attribute duplicate attributes, one of which will not deserialize correctly
When overweaving it is possible that a class will get a second WeaverState attribute. This second one will not be valid (it hasn't been correctly configured). This isn't normally a problem because the next thing that happens is that the class is defined to the VM. But if *another* weave step occurs, the malformed attribute will cause that weave to fail with this kind of message: bad WeaverState.Kind: -115 The solution is to avoid adding the duplicate when overweaving.
resolved fixed
8553b30
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-07-18T20:44:33Z
2011-07-18T20:13:20Z
weaver/src/org/aspectj/weaver/bcel/LazyClassGen.java
list.append(InstructionFactory.PUSH(cp, makeString(sig.getModifiers(w)))); list.append(InstructionFactory.PUSH(cp, sig.getName())); list.append(InstructionFactory.PUSH(cp, makeString(sig.getDeclaringType()))); list.append(InstructionFactory.PUSH(cp, makeString(sig.getParameterTypes()))); list.append(InstructionFactory.PUSH(cp, makeString(sig.getParameterNames(w)))); list.append(InstructionFactory.PUSH(cp, makeString(sig.getExceptions(w)))); list.append(InstructionFactory.PUSH(cp, makeString((sig.getReturnType())))); list.append(fact.createInvoke(factoryType.getClassName(), signatureMakerName, signatureType, new Type[] { Type.STRING, Type.STRING, Type.STRING, Type.STRING, Type.STRING, Type.STRING, Type.STRING }, Constants.INVOKEVIRTUAL)); } else if (sig.getKind().equals(Member.STATIC_INITIALIZATION)) { BcelWorld w = shadow.getWorld(); list.append(InstructionFactory.PUSH(cp, makeString(sig.getModifiers(w)))); list.append(InstructionFactory.PUSH(cp, makeString(sig.getDeclaringType()))); list.append(fact.createInvoke(factoryType.getClassName(), signatureMakerName, signatureType, Type.STRINGARRAY2, Constants.INVOKEVIRTUAL)); } else { list.append(InstructionFactory.PUSH(cp, SignatureUtils.getSignatureString(sig, shadow.getWorld()))); list.append(fact.createInvoke(factoryType.getClassName(), signatureMakerName, signatureType, Type.STRINGARRAY1, Constants.INVOKEVIRTUAL)); } list.append(Utility.createConstant(fact, shadow.getSourceLine())); final String factoryMethod; if (world.isTargettingAspectJRuntime12()) { list.append(fact.createInvoke(factoryType.getClassName(), "makeSJP", staticTjpType, new Type[] { Type.STRING, sigType, Type.INT }, Constants.INVOKEVIRTUAL)); list.append(fact.createFieldAccess(getClassName(), field.getName(), staticTjpType, Constants.PUTSTATIC)); } else {
352,389
Bug 352389 overweaving can attribute duplicate attributes, one of which will not deserialize correctly
When overweaving it is possible that a class will get a second WeaverState attribute. This second one will not be valid (it hasn't been correctly configured). This isn't normally a problem because the next thing that happens is that the class is defined to the VM. But if *another* weave step occurs, the malformed attribute will cause that weave to fail with this kind of message: bad WeaverState.Kind: -115 The solution is to avoid adding the duplicate when overweaving.
resolved fixed
8553b30
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-07-18T20:44:33Z
2011-07-18T20:13:20Z
weaver/src/org/aspectj/weaver/bcel/LazyClassGen.java
if (staticTjpType.equals(field.getType())) { factoryMethod = "makeSJP"; } else if (enclosingStaticTjpType.equals(field.getType())) { factoryMethod = "makeESJP"; } else { throw new Error("should not happen"); } if (fastSJP) { if (exceptionTypes != null && exceptionTypes.length != 0) { list.append(fact.createInvoke(factoryType.getClassName(), factoryMethod, field.getType(), ARRAY_8STRING_INT, Constants.INVOKEVIRTUAL)); } else { list.append(fact.createInvoke(factoryType.getClassName(), factoryMethod, field.getType(), ARRAY_7STRING_INT, Constants.INVOKEVIRTUAL)); } } else { list.append(fact.createInvoke(factoryType.getClassName(), factoryMethod, field.getType(), new Type[] { Type.STRING, sigType, Type.INT }, Constants.INVOKEVIRTUAL)); } list.append(fact.createFieldAccess(getClassName(), field.getName(), field.getType(), Constants.PUTSTATIC)); } } private static final Type[] ARRAY_7STRING_INT = new Type[] { Type.STRING, Type.STRING, Type.STRING, Type.STRING, Type.STRING, Type.STRING, Type.STRING, Type.INT }; private static final Type[] ARRAY_8STRING_INT = new Type[] { Type.STRING, Type.STRING, Type.STRING, Type.STRING, Type.STRING, Type.STRING, Type.STRING, Type.STRING, Type.INT }; protected String makeString(int i) { return Integer.toString(i, 16); }
352,389
Bug 352389 overweaving can attribute duplicate attributes, one of which will not deserialize correctly
When overweaving it is possible that a class will get a second WeaverState attribute. This second one will not be valid (it hasn't been correctly configured). This isn't normally a problem because the next thing that happens is that the class is defined to the VM. But if *another* weave step occurs, the malformed attribute will cause that weave to fail with this kind of message: bad WeaverState.Kind: -115 The solution is to avoid adding the duplicate when overweaving.
resolved fixed
8553b30
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-07-18T20:44:33Z
2011-07-18T20:13:20Z
weaver/src/org/aspectj/weaver/bcel/LazyClassGen.java
protected String makeString(UnresolvedType t) { if (t.isArray()) { return t.getSignature().replace('/', '.'); } else { if (t.isParameterizedType()) { return t.getRawType().getName(); } else { return t.getName(); } } } protected String makeString(UnresolvedType[] types) { if (types == null) { return ""; } StringBuilder buf = new StringBuilder(); for (int i = 0, len = types.length; i < len; i++) { if (i > 0) { buf.append(':'); } buf.append(makeString(types[i])); } return buf.toString(); } protected String makeString(String[] names) { if (names == null) { return "";
352,389
Bug 352389 overweaving can attribute duplicate attributes, one of which will not deserialize correctly
When overweaving it is possible that a class will get a second WeaverState attribute. This second one will not be valid (it hasn't been correctly configured). This isn't normally a problem because the next thing that happens is that the class is defined to the VM. But if *another* weave step occurs, the malformed attribute will cause that weave to fail with this kind of message: bad WeaverState.Kind: -115 The solution is to avoid adding the duplicate when overweaving.
resolved fixed
8553b30
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-07-18T20:44:33Z
2011-07-18T20:13:20Z
weaver/src/org/aspectj/weaver/bcel/LazyClassGen.java
} StringBuilder buf = new StringBuilder(); for (int i = 0, len = names.length; i < len; i++) { if (i > 0) { buf.append(':'); } buf.append(names[i]); } return buf.toString(); } public ResolvedType getType() { if (myType == null) { return null; } return myType.getResolvedTypeX(); } public BcelObjectType getBcelObjectType() { return myType; } public String getFileName() { return myGen.getFileName(); } private void addField(FieldGen field) { makeSyntheticAndTransientIfNeeded(field); BcelField bcelField = null; if (getBcelObjectType() != null) { bcelField = new BcelField(getBcelObjectType(), field.getField()); } else { bcelField = new BcelField(getName(), field.getField(), world);
352,389
Bug 352389 overweaving can attribute duplicate attributes, one of which will not deserialize correctly
When overweaving it is possible that a class will get a second WeaverState attribute. This second one will not be valid (it hasn't been correctly configured). This isn't normally a problem because the next thing that happens is that the class is defined to the VM. But if *another* weave step occurs, the malformed attribute will cause that weave to fail with this kind of message: bad WeaverState.Kind: -115 The solution is to avoid adding the duplicate when overweaving.
resolved fixed
8553b30
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-07-18T20:44:33Z
2011-07-18T20:13:20Z
weaver/src/org/aspectj/weaver/bcel/LazyClassGen.java
} fields.add(bcelField); } private void makeSyntheticAndTransientIfNeeded(FieldGen field) { if (field.getName().startsWith(NameMangler.PREFIX) && !field.getName().startsWith("ajc$interField$") && !field.getName().startsWith("ajc$instance$")) { if (!field.isStatic()) { field.setModifiers(field.getModifiers() | Constants.ACC_TRANSIENT); } if (getWorld().isInJava5Mode()) { field.setModifiers(field.getModifiers() | ACC_SYNTHETIC); } if (!hasSyntheticAttribute(field.getAttributes())) { ConstantPool cpg = myGen.getConstantPool(); int index = cpg.addUtf8("Synthetic"); Attribute synthetic = new Synthetic(index, 0, new byte[0], cpg); field.addAttribute(synthetic); }
352,389
Bug 352389 overweaving can attribute duplicate attributes, one of which will not deserialize correctly
When overweaving it is possible that a class will get a second WeaverState attribute. This second one will not be valid (it hasn't been correctly configured). This isn't normally a problem because the next thing that happens is that the class is defined to the VM. But if *another* weave step occurs, the malformed attribute will cause that weave to fail with this kind of message: bad WeaverState.Kind: -115 The solution is to avoid adding the duplicate when overweaving.
resolved fixed
8553b30
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-07-18T20:44:33Z
2011-07-18T20:13:20Z
weaver/src/org/aspectj/weaver/bcel/LazyClassGen.java
} } private boolean hasSyntheticAttribute(List<Attribute> attributes) { for (int i = 0; i < attributes.size(); i++) { if ((attributes.get(i)).getName().equals("Synthetic")) { return true; } } return false; } public void addField(FieldGen field, ISourceLocation sourceLocation) { addField(field); if (!(field.isPrivate() && (field.isStatic() || field.isTransient()))) { errorOnAddedField(field, sourceLocation); } } public String getClassName() { return myGen.getClassName(); } public boolean isInterface() { return myGen.isInterface(); } public boolean isAbstract() { return myGen.isAbstract(); } public LazyMethodGen getLazyMethodGen(Member m) { return getLazyMethodGen(m.getName(), m.getSignature(), false); } public LazyMethodGen getLazyMethodGen(String name, String signature) { return getLazyMethodGen(name, signature, false);
352,389
Bug 352389 overweaving can attribute duplicate attributes, one of which will not deserialize correctly
When overweaving it is possible that a class will get a second WeaverState attribute. This second one will not be valid (it hasn't been correctly configured). This isn't normally a problem because the next thing that happens is that the class is defined to the VM. But if *another* weave step occurs, the malformed attribute will cause that weave to fail with this kind of message: bad WeaverState.Kind: -115 The solution is to avoid adding the duplicate when overweaving.
resolved fixed
8553b30
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-07-18T20:44:33Z
2011-07-18T20:13:20Z
weaver/src/org/aspectj/weaver/bcel/LazyClassGen.java
} public LazyMethodGen getLazyMethodGen(String name, String signature, boolean allowMissing) { for (LazyMethodGen gen : methodGens) { if (gen.getName().equals(name) && gen.getSignature().equals(signature)) { return gen; } } if (!allowMissing) { throw new BCException("Class " + this.getName() + " does not have a method " + name + " with signature " + signature); } return null; } public void forcePublic() { myGen.setModifiers(Utility.makePublic(myGen.getModifiers())); } public boolean hasAnnotation(UnresolvedType t) { AnnotationGen agens[] = myGen.getAnnotations(); if (agens == null) { return false; } for (int i = 0; i < agens.length; i++) { AnnotationGen gen = agens[i]; if (t.equals(UnresolvedType.forSignature(gen.getTypeSignature()))) { return true; } } return false; }
352,389
Bug 352389 overweaving can attribute duplicate attributes, one of which will not deserialize correctly
When overweaving it is possible that a class will get a second WeaverState attribute. This second one will not be valid (it hasn't been correctly configured). This isn't normally a problem because the next thing that happens is that the class is defined to the VM. But if *another* weave step occurs, the malformed attribute will cause that weave to fail with this kind of message: bad WeaverState.Kind: -115 The solution is to avoid adding the duplicate when overweaving.
resolved fixed
8553b30
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-07-18T20:44:33Z
2011-07-18T20:13:20Z
weaver/src/org/aspectj/weaver/bcel/LazyClassGen.java
public void addAnnotation(AnnotationGen a) { if (!hasAnnotation(UnresolvedType.forSignature(a.getTypeSignature()))) { annotations.add(new AnnotationGen(a, getConstantPool(), true)); } } private boolean implementsSerializable(ResolvedType aType) { if (aType.getSignature().equals(UnresolvedType.SERIALIZABLE.getSignature())) { return true; } ResolvedType[] interfaces = aType.getDeclaredInterfaces(); for (int i = 0; i < interfaces.length; i++) { if (interfaces[i].isMissing()) { continue; } if (implementsSerializable(interfaces[i])) { return true; } } ResolvedType superType = aType.getSuperclass(); if (superType != null && !superType.isMissing()) { return implementsSerializable(superType);
352,389
Bug 352389 overweaving can attribute duplicate attributes, one of which will not deserialize correctly
When overweaving it is possible that a class will get a second WeaverState attribute. This second one will not be valid (it hasn't been correctly configured). This isn't normally a problem because the next thing that happens is that the class is defined to the VM. But if *another* weave step occurs, the malformed attribute will cause that weave to fail with this kind of message: bad WeaverState.Kind: -115 The solution is to avoid adding the duplicate when overweaving.
resolved fixed
8553b30
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-07-18T20:44:33Z
2011-07-18T20:13:20Z
weaver/src/org/aspectj/weaver/bcel/LazyClassGen.java
} return false; } public boolean isAtLeastJava5() { return (myGen.getMajor() >= Constants.MAJOR_1_5); } /** * Return the next available field name with the specified 'prefix', e.g. for prefix 'class$' where class$0, class$1 exist then * return class$2 */ public String allocateField(String prefix) { int highestAllocated = -1; List<BcelField> fs = getFieldGens(); for (BcelField field : fs) { if (field.getName().startsWith(prefix)) { try { int num = Integer.parseInt(field.getName().substring(prefix.length())); if (num > highestAllocated) { highestAllocated = num; } } catch (NumberFormatException nfe) { } } } return prefix + Integer.toString(highestAllocated + 1); } }
353,100
Bug 353100 Need to demote "warning ignoring duplicate definition" from warning to debug
Build Identifier: 1.6.11 This kind of problem can occur for complex class loader hierarchies, and since it is not really a problem, we should make it debug level message so as not to write log messages un-necessarily. Reproducible: Always Steps to Reproduce: 1. Create an application that has some weaved class loaders hierarchy - recommend some URLClassLoader derived ones 2. Add the same(!) JAR with only an aop.xml file to more than one loader along the hierarchy 3. Make the loader the default context thread loader and start running some code.
resolved fixed
c6fb752
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-07-26T15:52:40Z
2011-07-26T11:33:20Z
loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.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: * Alexandre Vasseur initial implementation * David Knibb weaving context enhancments *******************************************************************************/ package org.aspectj.weaver.loadtime; import java.io.File; import java.io.IOException; import java.io.InputStream; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.net.MalformedURLException; import java.net.URL; import java.security.ProtectionDomain; import java.util.ArrayList; import java.util.Enumeration; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.List;
353,100
Bug 353100 Need to demote "warning ignoring duplicate definition" from warning to debug
Build Identifier: 1.6.11 This kind of problem can occur for complex class loader hierarchies, and since it is not really a problem, we should make it debug level message so as not to write log messages un-necessarily. Reproducible: Always Steps to Reproduce: 1. Create an application that has some weaved class loaders hierarchy - recommend some URLClassLoader derived ones 2. Add the same(!) JAR with only an aop.xml file to more than one loader along the hierarchy 3. Make the loader the default context thread loader and start running some code.
resolved fixed
c6fb752
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-07-26T15:52:40Z
2011-07-26T11:33:20Z
loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java
import java.util.Properties; import java.util.Set; import java.util.StringTokenizer; import org.aspectj.bridge.AbortException; import org.aspectj.bridge.Constants; import org.aspectj.util.LangUtil; import org.aspectj.weaver.Lint; import org.aspectj.weaver.Lint.Kind; import org.aspectj.weaver.ResolvedType; import org.aspectj.weaver.UnresolvedType; import org.aspectj.weaver.World; import org.aspectj.weaver.bcel.BcelWeakClassLoaderReference; import org.aspectj.weaver.bcel.BcelWeaver; import org.aspectj.weaver.bcel.BcelWorld; import org.aspectj.weaver.bcel.Utility; import org.aspectj.weaver.loadtime.definition.Definition; import org.aspectj.weaver.loadtime.definition.DocumentParser; import org.aspectj.weaver.ltw.LTWWorld; import org.aspectj.weaver.patterns.PatternParser; import org.aspectj.weaver.patterns.TypePattern; import org.aspectj.weaver.tools.GeneratedClassHandler; import org.aspectj.weaver.tools.Trace; import org.aspectj.weaver.tools.TraceFactory; import org.aspectj.weaver.tools.WeavingAdaptor; /** * @author Alexandre Vasseur * @author Andy Clement * @author Abraham Nevado */ public class ClassLoaderWeavingAdaptor extends WeavingAdaptor {
353,100
Bug 353100 Need to demote "warning ignoring duplicate definition" from warning to debug
Build Identifier: 1.6.11 This kind of problem can occur for complex class loader hierarchies, and since it is not really a problem, we should make it debug level message so as not to write log messages un-necessarily. Reproducible: Always Steps to Reproduce: 1. Create an application that has some weaved class loaders hierarchy - recommend some URLClassLoader derived ones 2. Add the same(!) JAR with only an aop.xml file to more than one loader along the hierarchy 3. Make the loader the default context thread loader and start running some code.
resolved fixed
c6fb752
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-07-26T15:52:40Z
2011-07-26T11:33:20Z
loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java
private final static String AOP_XML = Constants.AOP_USER_XML + ";" + Constants.AOP_AJC_XML + ";" + Constants.AOP_OSGI_XML; private boolean initialized; private List m_dumpTypePattern = new ArrayList(); private boolean m_dumpBefore = false; private boolean dumpDirPerClassloader = false; private boolean hasExcludes = false; private List<TypePattern> excludeTypePattern = new ArrayList<TypePattern>(); private List<String> excludeStartsWith = new ArrayList<String>(); private List<String> excludeStarDotDotStar = new ArrayList<String>(); private List<String> excludeExactName = new ArrayList<String>(); private List<String> excludeEndsWith = new ArrayList<String>(); private List<String[]> excludeSpecial = new ArrayList<String[]>(); private boolean hasIncludes = false; private List<TypePattern> includeTypePattern = new ArrayList<TypePattern>(); private List<String> m_includeStartsWith = new ArrayList<String>(); private List<String> includeExactName = new ArrayList<String>(); private boolean includeStar = false; private List<TypePattern> m_aspectExcludeTypePattern = new ArrayList<TypePattern>(); private List<String> m_aspectExcludeStartsWith = new ArrayList<String>(); private List<TypePattern> m_aspectIncludeTypePattern = new ArrayList<TypePattern>();
353,100
Bug 353100 Need to demote "warning ignoring duplicate definition" from warning to debug
Build Identifier: 1.6.11 This kind of problem can occur for complex class loader hierarchies, and since it is not really a problem, we should make it debug level message so as not to write log messages un-necessarily. Reproducible: Always Steps to Reproduce: 1. Create an application that has some weaved class loaders hierarchy - recommend some URLClassLoader derived ones 2. Add the same(!) JAR with only an aop.xml file to more than one loader along the hierarchy 3. Make the loader the default context thread loader and start running some code.
resolved fixed
c6fb752
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-07-26T15:52:40Z
2011-07-26T11:33:20Z
loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java
private List<String> m_aspectIncludeStartsWith = new ArrayList<String>(); private StringBuffer namespace; private IWeavingContext weavingContext; private List concreteAspects = new ArrayList(); private static Trace trace = TraceFactory.getTraceFactory().getTrace(ClassLoaderWeavingAdaptor.class); public ClassLoaderWeavingAdaptor() { super(); if (trace.isTraceEnabled()) { trace.enter("<init>", this); } if (trace.isTraceEnabled()) { trace.exit("<init>"); } } /** * We don't need a reference to the class loader and using it during construction can cause problems with recursion. It also * makes sense to supply the weaving context during initialization to. * * @deprecated */ public ClassLoaderWeavingAdaptor(final ClassLoader deprecatedLoader, final IWeavingContext deprecatedContext) { super(); if (trace.isTraceEnabled()) { trace.enter("<init>", this, new Object[] { deprecatedLoader, deprecatedContext }); } if (trace.isTraceEnabled()) { trace.exit("<init>"); } } class SimpleGeneratedClassHandler implements GeneratedClassHandler {
353,100
Bug 353100 Need to demote "warning ignoring duplicate definition" from warning to debug
Build Identifier: 1.6.11 This kind of problem can occur for complex class loader hierarchies, and since it is not really a problem, we should make it debug level message so as not to write log messages un-necessarily. Reproducible: Always Steps to Reproduce: 1. Create an application that has some weaved class loaders hierarchy - recommend some URLClassLoader derived ones 2. Add the same(!) JAR with only an aop.xml file to more than one loader along the hierarchy 3. Make the loader the default context thread loader and start running some code.
resolved fixed
c6fb752
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-07-26T15:52:40Z
2011-07-26T11:33:20Z
loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java
private BcelWeakClassLoaderReference loaderRef; SimpleGeneratedClassHandler(ClassLoader loader) { loaderRef = new BcelWeakClassLoaderReference(loader); } /** * Callback when we need to define a Closure in the JVM * */ public void acceptClass(String name, byte[] bytes) { try { if (shouldDump(name.replace('/', '.'), false)) { dump(name, bytes, false); } } catch (Throwable throwable) { throwable.printStackTrace(); } if (activeProtectionDomain != null) { defineClass(loaderRef.getClassLoader(), name, bytes, activeProtectionDomain); } else { defineClass(loaderRef.getClassLoader(), name, bytes); } } } public void initialize(final ClassLoader classLoader, IWeavingContext context) { if (initialized) { return;
353,100
Bug 353100 Need to demote "warning ignoring duplicate definition" from warning to debug
Build Identifier: 1.6.11 This kind of problem can occur for complex class loader hierarchies, and since it is not really a problem, we should make it debug level message so as not to write log messages un-necessarily. Reproducible: Always Steps to Reproduce: 1. Create an application that has some weaved class loaders hierarchy - recommend some URLClassLoader derived ones 2. Add the same(!) JAR with only an aop.xml file to more than one loader along the hierarchy 3. Make the loader the default context thread loader and start running some code.
resolved fixed
c6fb752
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-07-26T15:52:40Z
2011-07-26T11:33:20Z
loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java
} boolean success = true; this.weavingContext = context; if (weavingContext == null) { weavingContext = new DefaultWeavingContext(classLoader); } createMessageHandler(); this.generatedClassHandler = new SimpleGeneratedClassHandler(classLoader); List definitions = weavingContext.getDefinitions(classLoader, this); if (definitions.isEmpty()) { disable(); if (trace.isTraceEnabled()) { trace.exit("initialize", definitions); } return; } bcelWorld = new LTWWorld(classLoader, weavingContext, getMessageHandler(), null); weaver = new BcelWeaver(bcelWorld); success = registerDefinitions(weaver, classLoader, definitions); if (success) { weaver.prepareForWeave(); enable(); success = weaveAndDefineConceteAspects(); } if (success) { enable(); } else {
353,100
Bug 353100 Need to demote "warning ignoring duplicate definition" from warning to debug
Build Identifier: 1.6.11 This kind of problem can occur for complex class loader hierarchies, and since it is not really a problem, we should make it debug level message so as not to write log messages un-necessarily. Reproducible: Always Steps to Reproduce: 1. Create an application that has some weaved class loaders hierarchy - recommend some URLClassLoader derived ones 2. Add the same(!) JAR with only an aop.xml file to more than one loader along the hierarchy 3. Make the loader the default context thread loader and start running some code.
resolved fixed
c6fb752
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-07-26T15:52:40Z
2011-07-26T11:33:20Z
loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java
disable(); bcelWorld = null; weaver = null; } initialized = true; if (trace.isTraceEnabled()) { trace.exit("initialize", isEnabled()); } } /** * Load and cache the aop.xml/properties according to the classloader visibility rules * * @param weaver * @param loader */ List<Definition> parseDefinitions(final ClassLoader loader) { if (trace.isTraceEnabled()) { trace.enter("parseDefinitions", this); } List<Definition> definitions = new ArrayList<Definition>(); try { info("register classloader " + getClassLoaderName(loader)); if (loader.equals(ClassLoader.getSystemClassLoader())) { String file = System.getProperty("aj5.def", null); if (file != null) { info("using (-Daj5.def) " + file); definitions.add(DocumentParser.parse((new File(file)).toURL())); }
353,100
Bug 353100 Need to demote "warning ignoring duplicate definition" from warning to debug
Build Identifier: 1.6.11 This kind of problem can occur for complex class loader hierarchies, and since it is not really a problem, we should make it debug level message so as not to write log messages un-necessarily. Reproducible: Always Steps to Reproduce: 1. Create an application that has some weaved class loaders hierarchy - recommend some URLClassLoader derived ones 2. Add the same(!) JAR with only an aop.xml file to more than one loader along the hierarchy 3. Make the loader the default context thread loader and start running some code.
resolved fixed
c6fb752
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-07-26T15:52:40Z
2011-07-26T11:33:20Z
loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java
} String resourcePath = System.getProperty("org.aspectj.weaver.loadtime.configuration", AOP_XML); if (trace.isTraceEnabled()) { trace.event("parseDefinitions", this, resourcePath); } StringTokenizer st = new StringTokenizer(resourcePath, ";"); while (st.hasMoreTokens()) { String nextDefinition = st.nextToken(); if (nextDefinition.startsWith("file:")) { try { String fpath = new URL(nextDefinition).getFile(); File configFile = new File(fpath); if (!configFile.exists()) { warn("configuration does not exist: " + nextDefinition); } else { definitions.add(DocumentParser.parse(configFile.toURL())); } } catch (MalformedURLException mue) { error("malformed definition url: " + nextDefinition); } } else { Enumeration<URL> xmls = weavingContext.getResources(nextDefinition); Set<URL> seenBefore = new HashSet<URL>(); while (xmls.hasMoreElements()) { URL xml = xmls.nextElement(); if (trace.isTraceEnabled()) { trace.event("parseDefinitions", this, xml); } if (!seenBefore.contains(xml)) {
353,100
Bug 353100 Need to demote "warning ignoring duplicate definition" from warning to debug
Build Identifier: 1.6.11 This kind of problem can occur for complex class loader hierarchies, and since it is not really a problem, we should make it debug level message so as not to write log messages un-necessarily. Reproducible: Always Steps to Reproduce: 1. Create an application that has some weaved class loaders hierarchy - recommend some URLClassLoader derived ones 2. Add the same(!) JAR with only an aop.xml file to more than one loader along the hierarchy 3. Make the loader the default context thread loader and start running some code.
resolved fixed
c6fb752
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-07-26T15:52:40Z
2011-07-26T11:33:20Z
loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java
info("using configuration " + weavingContext.getFile(xml)); definitions.add(DocumentParser.parse(xml)); seenBefore.add(xml); } else { warn("ignoring duplicate definition: " + xml); } } } } if (definitions.isEmpty()) { info("no configuration found. Disabling weaver for class loader " + getClassLoaderName(loader)); } } catch (Exception e) { definitions.clear(); warn("parse definitions failed", e); } if (trace.isTraceEnabled()) { trace.exit("parseDefinitions", definitions); } return definitions; } private boolean registerDefinitions(final BcelWeaver weaver, final ClassLoader loader, List<Definition> definitions) { if (trace.isTraceEnabled()) { trace.enter("registerDefinitions", this, definitions); } boolean success = true; try { registerOptions(weaver, loader, definitions); registerAspectExclude(weaver, loader, definitions); registerAspectInclude(weaver, loader, definitions);
353,100
Bug 353100 Need to demote "warning ignoring duplicate definition" from warning to debug
Build Identifier: 1.6.11 This kind of problem can occur for complex class loader hierarchies, and since it is not really a problem, we should make it debug level message so as not to write log messages un-necessarily. Reproducible: Always Steps to Reproduce: 1. Create an application that has some weaved class loaders hierarchy - recommend some URLClassLoader derived ones 2. Add the same(!) JAR with only an aop.xml file to more than one loader along the hierarchy 3. Make the loader the default context thread loader and start running some code.
resolved fixed
c6fb752
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-07-26T15:52:40Z
2011-07-26T11:33:20Z
loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java
success = registerAspects(weaver, loader, definitions); registerIncludeExclude(weaver, loader, definitions); registerDump(weaver, loader, definitions); } catch (Exception ex) { trace.error("register definition failed", ex); success = false; warn("register definition failed", (ex instanceof AbortException) ? null : ex); } if (trace.isTraceEnabled()) { trace.exit("registerDefinitions", success); } return success; } private String getClassLoaderName(ClassLoader loader) { return weavingContext.getClassLoaderName(); } /** * Configure the weaver according to the option directives TODO av - don't know if it is that good to reuse, since we only allow * a small subset of options in LTW * * @param weaver * @param loader * @param definitions */ private void registerOptions(final BcelWeaver weaver, final ClassLoader loader, final List definitions) { StringBuffer allOptions = new StringBuffer(); for (Iterator iterator = definitions.iterator(); iterator.hasNext();) { Definition definition = (Definition) iterator.next(); allOptions.append(definition.getWeaverOptions()).append(' '); }
353,100
Bug 353100 Need to demote "warning ignoring duplicate definition" from warning to debug
Build Identifier: 1.6.11 This kind of problem can occur for complex class loader hierarchies, and since it is not really a problem, we should make it debug level message so as not to write log messages un-necessarily. Reproducible: Always Steps to Reproduce: 1. Create an application that has some weaved class loaders hierarchy - recommend some URLClassLoader derived ones 2. Add the same(!) JAR with only an aop.xml file to more than one loader along the hierarchy 3. Make the loader the default context thread loader and start running some code.
resolved fixed
c6fb752
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-07-26T15:52:40Z
2011-07-26T11:33:20Z
loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java
Options.WeaverOption weaverOption = Options.parse(allOptions.toString(), loader, getMessageHandler()); World world = weaver.getWorld(); setMessageHandler(weaverOption.messageHandler); world.setXlazyTjp(weaverOption.lazyTjp); world.setXHasMemberSupportEnabled(weaverOption.hasMember); world.setTiming(weaverOption.timers, true); world.setOptionalJoinpoints(weaverOption.optionalJoinpoints); world.setPinpointMode(weaverOption.pinpoint); weaver.setReweavableMode(weaverOption.notReWeavable); world.performExtraConfiguration(weaverOption.xSet); world.setXnoInline(weaverOption.noInline); world.setBehaveInJava5Way(LangUtil.is15VMOrGreater()); world.setAddSerialVerUID(weaverOption.addSerialVersionUID); bcelWorld.getLint().loadDefaultProperties(); bcelWorld.getLint().adviceDidNotMatch.setKind(null); if (weaverOption.lintFile != null) { InputStream resource = null; try { resource = loader.getResourceAsStream(weaverOption.lintFile); Exception failure = null; if (resource != null) { try { Properties properties = new Properties(); properties.load(resource);
353,100
Bug 353100 Need to demote "warning ignoring duplicate definition" from warning to debug
Build Identifier: 1.6.11 This kind of problem can occur for complex class loader hierarchies, and since it is not really a problem, we should make it debug level message so as not to write log messages un-necessarily. Reproducible: Always Steps to Reproduce: 1. Create an application that has some weaved class loaders hierarchy - recommend some URLClassLoader derived ones 2. Add the same(!) JAR with only an aop.xml file to more than one loader along the hierarchy 3. Make the loader the default context thread loader and start running some code.
resolved fixed
c6fb752
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-07-26T15:52:40Z
2011-07-26T11:33:20Z
loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java
world.getLint().setFromProperties(properties); } catch (IOException e) { failure = e; } } if (failure != null || resource == null) { warn("Cannot access resource for -Xlintfile:" + weaverOption.lintFile, failure); } } finally { try { resource.close(); } catch (Throwable t) { } } } if (weaverOption.lint != null) { if (weaverOption.lint.equals("default")) { bcelWorld.getLint().loadDefaultProperties(); } else { bcelWorld.getLint().setAll(weaverOption.lint); if (weaverOption.lint.equals("ignore")) { bcelWorld.setAllLintIgnored(); } }
353,100
Bug 353100 Need to demote "warning ignoring duplicate definition" from warning to debug
Build Identifier: 1.6.11 This kind of problem can occur for complex class loader hierarchies, and since it is not really a problem, we should make it debug level message so as not to write log messages un-necessarily. Reproducible: Always Steps to Reproduce: 1. Create an application that has some weaved class loaders hierarchy - recommend some URLClassLoader derived ones 2. Add the same(!) JAR with only an aop.xml file to more than one loader along the hierarchy 3. Make the loader the default context thread loader and start running some code.
resolved fixed
c6fb752
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-07-26T15:52:40Z
2011-07-26T11:33:20Z
loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java
} } private void registerAspectExclude(final BcelWeaver weaver, final ClassLoader loader, final List<Definition> definitions) { String fastMatchInfo = null; for (Definition definition : definitions) { for (String exclude : definition.getAspectExcludePatterns()) { TypePattern excludePattern = new PatternParser(exclude).parseTypePattern(); m_aspectExcludeTypePattern.add(excludePattern); fastMatchInfo = looksLikeStartsWith(exclude); if (fastMatchInfo != null) { m_aspectExcludeStartsWith.add(fastMatchInfo); } } } } private void registerAspectInclude(final BcelWeaver weaver, final ClassLoader loader, final List<Definition> definitions) { String fastMatchInfo = null; for (Definition definition : definitions) { for (String include : definition.getAspectIncludePatterns()) { TypePattern includePattern = new PatternParser(include).parseTypePattern(); m_aspectIncludeTypePattern.add(includePattern); fastMatchInfo = looksLikeStartsWith(include); if (fastMatchInfo != null) { m_aspectIncludeStartsWith.add(fastMatchInfo); } } } } protected void lint(String name, String[] infos) {
353,100
Bug 353100 Need to demote "warning ignoring duplicate definition" from warning to debug
Build Identifier: 1.6.11 This kind of problem can occur for complex class loader hierarchies, and since it is not really a problem, we should make it debug level message so as not to write log messages un-necessarily. Reproducible: Always Steps to Reproduce: 1. Create an application that has some weaved class loaders hierarchy - recommend some URLClassLoader derived ones 2. Add the same(!) JAR with only an aop.xml file to more than one loader along the hierarchy 3. Make the loader the default context thread loader and start running some code.
resolved fixed
c6fb752
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-07-26T15:52:40Z
2011-07-26T11:33:20Z
loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java
Lint lint = bcelWorld.getLint(); Kind kind = lint.getLintKind(name); kind.signal(infos, null, null); } @Override public String getContextId() { return weavingContext.getId(); } /** * Register the aspect, following include / exclude rules * * @param weaver * @param loader * @param definitions */ private boolean registerAspects(final BcelWeaver weaver, final ClassLoader loader, final List<Definition> definitions) { if (trace.isTraceEnabled()) { trace.enter("registerAspects", this, new Object[] { weaver, loader, definitions }); } boolean success = true; for (Definition definition : definitions) { for (String aspectClassName : definition.getAspectClassNames()) { if (acceptAspect(aspectClassName)) { info("register aspect " + aspectClassName);
353,100
Bug 353100 Need to demote "warning ignoring duplicate definition" from warning to debug
Build Identifier: 1.6.11 This kind of problem can occur for complex class loader hierarchies, and since it is not really a problem, we should make it debug level message so as not to write log messages un-necessarily. Reproducible: Always Steps to Reproduce: 1. Create an application that has some weaved class loaders hierarchy - recommend some URLClassLoader derived ones 2. Add the same(!) JAR with only an aop.xml file to more than one loader along the hierarchy 3. Make the loader the default context thread loader and start running some code.
resolved fixed
c6fb752
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-07-26T15:52:40Z
2011-07-26T11:33:20Z
loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java
String requiredType = definition.getAspectRequires(aspectClassName); if (requiredType != null) { ((BcelWorld) weaver.getWorld()).addAspectRequires(aspectClassName, requiredType); } String definedScope = definition.getScopeForAspect(aspectClassName); if (definedScope != null) { ((BcelWorld) weaver.getWorld()).addScopedAspect(aspectClassName, definedScope); } weaver.addLibraryAspect(aspectClassName); if (namespace == null) { namespace = new StringBuffer(aspectClassName); } else { namespace = namespace.append(";").append(aspectClassName); } } else { lint("aspectExcludedByConfiguration", new String[] { aspectClassName, getClassLoaderName(loader) }); } } } for (Definition definition : definitions) { for (Definition.ConcreteAspect concreteAspect : definition.getConcreteAspects()) { if (acceptAspect(concreteAspect.name)) { info("define aspect " + concreteAspect.name); ConcreteAspectCodeGen gen = new ConcreteAspectCodeGen(concreteAspect, weaver.getWorld());
353,100
Bug 353100 Need to demote "warning ignoring duplicate definition" from warning to debug
Build Identifier: 1.6.11 This kind of problem can occur for complex class loader hierarchies, and since it is not really a problem, we should make it debug level message so as not to write log messages un-necessarily. Reproducible: Always Steps to Reproduce: 1. Create an application that has some weaved class loaders hierarchy - recommend some URLClassLoader derived ones 2. Add the same(!) JAR with only an aop.xml file to more than one loader along the hierarchy 3. Make the loader the default context thread loader and start running some code.
resolved fixed
c6fb752
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-07-26T15:52:40Z
2011-07-26T11:33:20Z
loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java
if (!gen.validate()) { error("Concrete-aspect '" + concreteAspect.name + "' could not be registered"); success = false; break; } ((BcelWorld) weaver.getWorld()).addSourceObjectType(Utility.makeJavaClass(concreteAspect.name, gen.getBytes()), true); concreteAspects.add(gen); weaver.addLibraryAspect(concreteAspect.name); if (namespace == null) { namespace = new StringBuffer(concreteAspect.name); } else { namespace = namespace.append(";" + concreteAspect.name); } } } } if (!success) { warn("failure(s) registering aspects. Disabling weaver for class loader " + getClassLoaderName(loader)); } else if (namespace == null) { success = false; info("no aspects registered. Disabling weaver for class loader " + getClassLoaderName(loader)); } if (trace.isTraceEnabled()) { trace.exit("registerAspects", success); }
353,100
Bug 353100 Need to demote "warning ignoring duplicate definition" from warning to debug
Build Identifier: 1.6.11 This kind of problem can occur for complex class loader hierarchies, and since it is not really a problem, we should make it debug level message so as not to write log messages un-necessarily. Reproducible: Always Steps to Reproduce: 1. Create an application that has some weaved class loaders hierarchy - recommend some URLClassLoader derived ones 2. Add the same(!) JAR with only an aop.xml file to more than one loader along the hierarchy 3. Make the loader the default context thread loader and start running some code.
resolved fixed
c6fb752
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-07-26T15:52:40Z
2011-07-26T11:33:20Z
loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java
return success; } private boolean weaveAndDefineConceteAspects() { if (trace.isTraceEnabled()) { trace.enter("weaveAndDefineConceteAspects", this, concreteAspects); } boolean success = true; for (Iterator iterator = concreteAspects.iterator(); iterator.hasNext();) { ConcreteAspectCodeGen gen = (ConcreteAspectCodeGen) iterator.next(); String name = gen.getClassName(); byte[] bytes = gen.getBytes(); try { byte[] newBytes = weaveClass(name, bytes, true); this.generatedClassHandler.acceptClass(name, newBytes); } catch (IOException ex) { trace.error("weaveAndDefineConceteAspects", ex); error("exception weaving aspect '" + name + "'", ex); } } if (trace.isTraceEnabled()) { trace.exit("weaveAndDefineConceteAspects", success); } return success; } /** * Register the include / exclude filters. We duplicate simple patterns in startWith filters that will allow faster matching * without ResolvedType * * @param weaver * @param loader
353,100
Bug 353100 Need to demote "warning ignoring duplicate definition" from warning to debug
Build Identifier: 1.6.11 This kind of problem can occur for complex class loader hierarchies, and since it is not really a problem, we should make it debug level message so as not to write log messages un-necessarily. Reproducible: Always Steps to Reproduce: 1. Create an application that has some weaved class loaders hierarchy - recommend some URLClassLoader derived ones 2. Add the same(!) JAR with only an aop.xml file to more than one loader along the hierarchy 3. Make the loader the default context thread loader and start running some code.
resolved fixed
c6fb752
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-07-26T15:52:40Z
2011-07-26T11:33:20Z
loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java
* @param definitions */ private void registerIncludeExclude(final BcelWeaver weaver, final ClassLoader loader, final List definitions) { String fastMatchInfo = null; for (Iterator iterator = definitions.iterator(); iterator.hasNext();) { Definition definition = (Definition) iterator.next(); for (Iterator iterator1 = definition.getIncludePatterns().iterator(); iterator1.hasNext();) { hasIncludes = true; String include = (String) iterator1.next(); fastMatchInfo = looksLikeStartsWith(include); if (fastMatchInfo != null) { m_includeStartsWith.add(fastMatchInfo); } else if (include.equals("*")) { includeStar = true; } else if ((fastMatchInfo = looksLikeExactName(include)) != null) { includeExactName.add(fastMatchInfo); } else { TypePattern includePattern = new PatternParser(include).parseTypePattern(); includeTypePattern.add(includePattern); } } for (Iterator iterator1 = definition.getExcludePatterns().iterator(); iterator1.hasNext();) { hasExcludes = true; String exclude = (String) iterator1.next(); fastMatchInfo = looksLikeStartsWith(exclude); if (fastMatchInfo != null) { excludeStartsWith.add(fastMatchInfo); } else if ((fastMatchInfo = looksLikeStarDotDotStarExclude(exclude)) != null) { excludeStarDotDotStar.add(fastMatchInfo); } else if ((fastMatchInfo = looksLikeExactName(exclude)) != null) {
353,100
Bug 353100 Need to demote "warning ignoring duplicate definition" from warning to debug
Build Identifier: 1.6.11 This kind of problem can occur for complex class loader hierarchies, and since it is not really a problem, we should make it debug level message so as not to write log messages un-necessarily. Reproducible: Always Steps to Reproduce: 1. Create an application that has some weaved class loaders hierarchy - recommend some URLClassLoader derived ones 2. Add the same(!) JAR with only an aop.xml file to more than one loader along the hierarchy 3. Make the loader the default context thread loader and start running some code.
resolved fixed
c6fb752
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-07-26T15:52:40Z
2011-07-26T11:33:20Z
loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java
excludeExactName.add(exclude); } else if ((fastMatchInfo = looksLikeEndsWith(exclude)) != null) { excludeEndsWith.add(fastMatchInfo); } else if (exclude .equals("org.codehaus.groovy..* && !org.codehaus.groovy.grails.web.servlet.mvc.SimpleGrailsController*")) { excludeSpecial.add(new String[] { "org.codehaus.groovy.", "org.codehaus.groovy.grails.web.servlet.mvc.SimpleGrailsController" }); } else { TypePattern excludePattern = new PatternParser(exclude).parseTypePattern(); excludeTypePattern.add(excludePattern); } } } } /** * Checks if the pattern looks like "*..*XXXX*" and if so returns XXXX. This will enable fast name matching of CGLIB exclusion * */ private String looksLikeStarDotDotStarExclude(String typePattern) { if (!typePattern.startsWith("*..*")) { return null; } if (!typePattern.endsWith("*")) { return null; } String subPattern = typePattern.substring(4, typePattern.length() - 1);
353,100
Bug 353100 Need to demote "warning ignoring duplicate definition" from warning to debug
Build Identifier: 1.6.11 This kind of problem can occur for complex class loader hierarchies, and since it is not really a problem, we should make it debug level message so as not to write log messages un-necessarily. Reproducible: Always Steps to Reproduce: 1. Create an application that has some weaved class loaders hierarchy - recommend some URLClassLoader derived ones 2. Add the same(!) JAR with only an aop.xml file to more than one loader along the hierarchy 3. Make the loader the default context thread loader and start running some code.
resolved fixed
c6fb752
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-07-26T15:52:40Z
2011-07-26T11:33:20Z
loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java
if (hasStarDot(subPattern, 0)) { return null; } return subPattern.replace('$', '.'); } /** * Checks if the pattern looks like "com.foo.Bar" - an exact name */ private String looksLikeExactName(String typePattern) { if (hasSpaceAnnotationPlus(typePattern, 0) || typePattern.indexOf("*") != -1) { return null; } return typePattern.replace('$', '.'); } /** * Checks if the pattern looks like "*Exception" */ private String looksLikeEndsWith(String typePattern) { if (typePattern.charAt(0) != '*') { return null; } if (hasSpaceAnnotationPlus(typePattern, 1) || hasStarDot(typePattern, 1)) { return null; } return typePattern.substring(1).replace('$', '.'); } /** * Determine if something in the string is going to affect our ability to optimize. Checks for: ' ' '@' '+' */ private boolean hasSpaceAnnotationPlus(String string, int pos) {
353,100
Bug 353100 Need to demote "warning ignoring duplicate definition" from warning to debug
Build Identifier: 1.6.11 This kind of problem can occur for complex class loader hierarchies, and since it is not really a problem, we should make it debug level message so as not to write log messages un-necessarily. Reproducible: Always Steps to Reproduce: 1. Create an application that has some weaved class loaders hierarchy - recommend some URLClassLoader derived ones 2. Add the same(!) JAR with only an aop.xml file to more than one loader along the hierarchy 3. Make the loader the default context thread loader and start running some code.
resolved fixed
c6fb752
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-07-26T15:52:40Z
2011-07-26T11:33:20Z
loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java
for (int i = pos, max = string.length(); i < max; i++) { char ch = string.charAt(i); if (ch == ' ' || ch == '@' || ch == '+') { return true; } } return false; } /** * Determine if something in the string is going to affect our ability to optimize. Checks for: '*' '.' */ private boolean hasStarDot(String string, int pos) { for (int i = pos, max = string.length(); i < max; i++) { char ch = string.charAt(i); if (ch == '*' || ch == '.') { return true; } } return false; } /** * Checks if the type pattern looks like "com.foo..*" */ private String looksLikeStartsWith(String typePattern) { if (hasSpaceAnnotationPlus(typePattern, 0) || typePattern.charAt(typePattern.length() - 1) != '*') { return null; }
353,100
Bug 353100 Need to demote "warning ignoring duplicate definition" from warning to debug
Build Identifier: 1.6.11 This kind of problem can occur for complex class loader hierarchies, and since it is not really a problem, we should make it debug level message so as not to write log messages un-necessarily. Reproducible: Always Steps to Reproduce: 1. Create an application that has some weaved class loaders hierarchy - recommend some URLClassLoader derived ones 2. Add the same(!) JAR with only an aop.xml file to more than one loader along the hierarchy 3. Make the loader the default context thread loader and start running some code.
resolved fixed
c6fb752
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-07-26T15:52:40Z
2011-07-26T11:33:20Z
loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java
int length = typePattern.length(); if (typePattern.endsWith("..*") && length > 3) { if (typePattern.indexOf("..") == length - 3 && typePattern.indexOf('*') == length - 1) { return typePattern.substring(0, length - 2).replace('$', '.'); } } return null; } /** * Register the dump filter * * @param weaver * @param loader * @param definitions */ private void registerDump(final BcelWeaver weaver, final ClassLoader loader, final List definitions) { for (Iterator iterator = definitions.iterator(); iterator.hasNext();) { Definition definition = (Definition) iterator.next(); for (Iterator iterator1 = definition.getDumpPatterns().iterator(); iterator1.hasNext();) { String dump = (String) iterator1.next(); TypePattern pattern = new PatternParser(dump).parseTypePattern(); m_dumpTypePattern.add(pattern); } if (definition.shouldDumpBefore()) { m_dumpBefore = true; } if (definition.createDumpDirPerClassloader()) { dumpDirPerClassloader = true; }
353,100
Bug 353100 Need to demote "warning ignoring duplicate definition" from warning to debug
Build Identifier: 1.6.11 This kind of problem can occur for complex class loader hierarchies, and since it is not really a problem, we should make it debug level message so as not to write log messages un-necessarily. Reproducible: Always Steps to Reproduce: 1. Create an application that has some weaved class loaders hierarchy - recommend some URLClassLoader derived ones 2. Add the same(!) JAR with only an aop.xml file to more than one loader along the hierarchy 3. Make the loader the default context thread loader and start running some code.
resolved fixed
c6fb752
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-07-26T15:52:40Z
2011-07-26T11:33:20Z
loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java
} } /** * Determine whether a type should be accepted for weaving, by checking it against any includes/excludes. * * @param className the name of the type to possibly accept * @param bytes the bytecode for the type (in case we need to look inside, eg. annotations) * @return true if it should be accepted for weaving */ @Override protected boolean accept(String className, byte[] bytes) { if (!hasExcludes && !hasIncludes) { return true; } String fastClassName = className.replace('/', '.'); for (String excludeStartsWithString : excludeStartsWith) { if (fastClassName.startsWith(excludeStartsWithString)) { return false; } } if (!excludeStarDotDotStar.isEmpty()) { for (String namePiece : excludeStarDotDotStar) { int index = fastClassName.lastIndexOf('.'); if (fastClassName.indexOf(namePiece, index + 1) != -1) { return false; } } }
353,100
Bug 353100 Need to demote "warning ignoring duplicate definition" from warning to debug
Build Identifier: 1.6.11 This kind of problem can occur for complex class loader hierarchies, and since it is not really a problem, we should make it debug level message so as not to write log messages un-necessarily. Reproducible: Always Steps to Reproduce: 1. Create an application that has some weaved class loaders hierarchy - recommend some URLClassLoader derived ones 2. Add the same(!) JAR with only an aop.xml file to more than one loader along the hierarchy 3. Make the loader the default context thread loader and start running some code.
resolved fixed
c6fb752
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-07-26T15:52:40Z
2011-07-26T11:33:20Z
loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java
fastClassName = fastClassName.replace('$', '.'); if (!excludeEndsWith.isEmpty()) { for (String lastPiece : excludeEndsWith) { if (fastClassName.endsWith(lastPiece)) { return false; } } } if (!excludeExactName.isEmpty()) { for (String name : excludeExactName) { if (fastClassName.equals(name)) { return false; } } } if (!excludeSpecial.isEmpty()) { for (String[] entry : excludeSpecial) { String excludeThese = entry[0]; String exceptThese = entry[1]; if (fastClassName.startsWith(excludeThese) && !fastClassName.startsWith(exceptThese)) { return false; } } } /* * Bug 120363 If we have an exclude pattern that cannot be matched using "starts with" then we cannot fast accept */ boolean didSomeIncludeMatching = false; if (excludeTypePattern.isEmpty()) {
353,100
Bug 353100 Need to demote "warning ignoring duplicate definition" from warning to debug
Build Identifier: 1.6.11 This kind of problem can occur for complex class loader hierarchies, and since it is not really a problem, we should make it debug level message so as not to write log messages un-necessarily. Reproducible: Always Steps to Reproduce: 1. Create an application that has some weaved class loaders hierarchy - recommend some URLClassLoader derived ones 2. Add the same(!) JAR with only an aop.xml file to more than one loader along the hierarchy 3. Make the loader the default context thread loader and start running some code.
resolved fixed
c6fb752
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-07-26T15:52:40Z
2011-07-26T11:33:20Z
loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java
if (includeStar) { return true; } if (!includeExactName.isEmpty()) { didSomeIncludeMatching = true; for (String exactname : includeExactName) { if (fastClassName.equals(exactname)) { return true; } } } boolean fastAccept = false; for (int i = 0; i < m_includeStartsWith.size(); i++) { didSomeIncludeMatching = true; fastAccept = fastClassName.startsWith(m_includeStartsWith.get(i)); if (fastAccept) { return true; } } if (includeTypePattern.isEmpty()) { return !didSomeIncludeMatching; } } boolean accept; try { ensureDelegateInitialized(className, bytes); ResolvedType classInfo = delegateForCurrentClass.getResolvedTypeX(); for (TypePattern typePattern : excludeTypePattern) {
353,100
Bug 353100 Need to demote "warning ignoring duplicate definition" from warning to debug
Build Identifier: 1.6.11 This kind of problem can occur for complex class loader hierarchies, and since it is not really a problem, we should make it debug level message so as not to write log messages un-necessarily. Reproducible: Always Steps to Reproduce: 1. Create an application that has some weaved class loaders hierarchy - recommend some URLClassLoader derived ones 2. Add the same(!) JAR with only an aop.xml file to more than one loader along the hierarchy 3. Make the loader the default context thread loader and start running some code.
resolved fixed
c6fb752
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-07-26T15:52:40Z
2011-07-26T11:33:20Z
loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java
if (typePattern.matchesStatically(classInfo)) { return false; } } if (includeStar) { return true; } if (!includeExactName.isEmpty()) { didSomeIncludeMatching = true; for (String exactname : includeExactName) { if (fastClassName.equals(exactname)) { return true; } } } for (int i = 0; i < m_includeStartsWith.size(); i++) { didSomeIncludeMatching = true; boolean fastaccept = fastClassName.startsWith(m_includeStartsWith.get(i)); if (fastaccept) { return true; } } accept = !didSomeIncludeMatching; for (TypePattern typePattern : includeTypePattern) { accept = typePattern.matchesStatically(classInfo); if (accept) { break; }
353,100
Bug 353100 Need to demote "warning ignoring duplicate definition" from warning to debug
Build Identifier: 1.6.11 This kind of problem can occur for complex class loader hierarchies, and since it is not really a problem, we should make it debug level message so as not to write log messages un-necessarily. Reproducible: Always Steps to Reproduce: 1. Create an application that has some weaved class loaders hierarchy - recommend some URLClassLoader derived ones 2. Add the same(!) JAR with only an aop.xml file to more than one loader along the hierarchy 3. Make the loader the default context thread loader and start running some code.
resolved fixed
c6fb752
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-07-26T15:52:40Z
2011-07-26T11:33:20Z
loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java
} } finally { this.bcelWorld.demote(); } return accept; } private boolean acceptAspect(String aspectClassName) { if (m_aspectExcludeTypePattern.isEmpty() && m_aspectIncludeTypePattern.isEmpty()) { return true; } String fastClassName = aspectClassName.replace('/', '.').replace('.', '$'); for (int i = 0; i < m_aspectExcludeStartsWith.size(); i++) { if (fastClassName.startsWith(m_aspectExcludeStartsWith.get(i))) { return false; } } for (int i = 0; i < m_aspectIncludeStartsWith.size(); i++) { if (fastClassName.startsWith(m_aspectIncludeStartsWith.get(i))) { return true; } } ResolvedType classInfo = weaver.getWorld().resolve(UnresolvedType.forName(aspectClassName), true);
353,100
Bug 353100 Need to demote "warning ignoring duplicate definition" from warning to debug
Build Identifier: 1.6.11 This kind of problem can occur for complex class loader hierarchies, and since it is not really a problem, we should make it debug level message so as not to write log messages un-necessarily. Reproducible: Always Steps to Reproduce: 1. Create an application that has some weaved class loaders hierarchy - recommend some URLClassLoader derived ones 2. Add the same(!) JAR with only an aop.xml file to more than one loader along the hierarchy 3. Make the loader the default context thread loader and start running some code.
resolved fixed
c6fb752
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-07-26T15:52:40Z
2011-07-26T11:33:20Z
loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java
for (Iterator iterator = m_aspectExcludeTypePattern.iterator(); iterator.hasNext();) { TypePattern typePattern = (TypePattern) iterator.next(); if (typePattern.matchesStatically(classInfo)) { return false; } } boolean accept = true; for (Iterator iterator = m_aspectIncludeTypePattern.iterator(); iterator.hasNext();) { TypePattern typePattern = (TypePattern) iterator.next(); accept = typePattern.matchesStatically(classInfo); if (accept) { break; } } return accept; } @Override protected boolean shouldDump(String className, boolean before) { if (before && !m_dumpBefore) { return false; } if (m_dumpTypePattern.isEmpty()) { return false; }
353,100
Bug 353100 Need to demote "warning ignoring duplicate definition" from warning to debug
Build Identifier: 1.6.11 This kind of problem can occur for complex class loader hierarchies, and since it is not really a problem, we should make it debug level message so as not to write log messages un-necessarily. Reproducible: Always Steps to Reproduce: 1. Create an application that has some weaved class loaders hierarchy - recommend some URLClassLoader derived ones 2. Add the same(!) JAR with only an aop.xml file to more than one loader along the hierarchy 3. Make the loader the default context thread loader and start running some code.
resolved fixed
c6fb752
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-07-26T15:52:40Z
2011-07-26T11:33:20Z
loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java
ResolvedType classInfo = weaver.getWorld().resolve(UnresolvedType.forName(className), true); for (Iterator iterator = m_dumpTypePattern.iterator(); iterator.hasNext();) { TypePattern typePattern = (TypePattern) iterator.next(); if (typePattern.matchesStatically(classInfo)) { return true; } } return false; } @Override protected String getDumpDir() { if (dumpDirPerClassloader) { StringBuffer dir = new StringBuffer(); dir.append("_ajdump").append(File.separator).append(weavingContext.getId()); return dir.toString(); } else { return super.getDumpDir(); } } /* * shared classes methods */ /** * @return Returns the key. */ public String getNamespace() {
353,100
Bug 353100 Need to demote "warning ignoring duplicate definition" from warning to debug
Build Identifier: 1.6.11 This kind of problem can occur for complex class loader hierarchies, and since it is not really a problem, we should make it debug level message so as not to write log messages un-necessarily. Reproducible: Always Steps to Reproduce: 1. Create an application that has some weaved class loaders hierarchy - recommend some URLClassLoader derived ones 2. Add the same(!) JAR with only an aop.xml file to more than one loader along the hierarchy 3. Make the loader the default context thread loader and start running some code.
resolved fixed
c6fb752
AspectJ
https://github.com/eclipse/org.aspectj
eclipse/org.aspectj
java
null
null
null
2011-07-26T15:52:40Z
2011-07-26T11:33:20Z
loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java
if (namespace == null) { return ""; } else { return new String(namespace); } } /** * Check to see if any classes are stored in the generated classes cache. Then flush the cache if it is not empty * * @param className TODO * @return true if a class has been generated and is stored in the cache */ public boolean generatedClassesExistFor(String className) { if (className == null) { return !generatedClasses.isEmpty(); } else { return generatedClasses.containsKey(className); } } /** * Flush the generated classes cache */ public void flushGeneratedClasses() { generatedClasses = new HashMap(); } private Method defineClassMethod;