From 25530f360c4991b81f82befb3f41d85ce40543fb Mon Sep 17 00:00:00 2001 From: aclement Date: Thu, 10 Dec 2009 20:03:46 +0000 Subject: [PATCH] 296734: various optimizations for LTW and aop.xml include/exclude processing --- .../org/aspectj/weaver/bcel/BcelAdvice.java | 28 +++-- .../org/aspectj/weaver/bcel/BcelMethod.java | 9 +- .../aspectj/weaver/bcel/BcelObjectType.java | 17 ++- .../org/aspectj/weaver/bcel/BcelWeaver.java | 53 ++++----- .../org/aspectj/weaver/bcel/BcelWorld.java | 83 ++++++++++++-- .../aspectj/weaver/tools/WeavingAdaptor.java | 104 ++++++++++-------- 6 files changed, 200 insertions(+), 94 deletions(-) diff --git a/weaver/src/org/aspectj/weaver/bcel/BcelAdvice.java b/weaver/src/org/aspectj/weaver/bcel/BcelAdvice.java index d544fb9e5..4a64bd5c7 100644 --- a/weaver/src/org/aspectj/weaver/bcel/BcelAdvice.java +++ b/weaver/src/org/aspectj/weaver/bcel/BcelAdvice.java @@ -104,9 +104,13 @@ class BcelAdvice extends Advice { @Override public ShadowMunger concretize(ResolvedType fromType, World world, PerClause clause) { - suppressLintWarnings(world); + if (!world.areAllLintIgnored()) { + suppressLintWarnings(world); + } ShadowMunger ret = super.concretize(fromType, world, clause); - clearLintSuppressions(world, this.suppressedLintKinds); + if (!world.areAllLintIgnored()) { + clearLintSuppressions(world, this.suppressedLintKinds); + } IfFinder ifinder = new IfFinder(); ret.getPointcut().accept(ifinder, null); boolean hasGuardTest = ifinder.hasIf && getKind() != AdviceKind.Around; @@ -138,10 +142,14 @@ class BcelAdvice extends Advice { @Override public boolean match(Shadow shadow, World world) { - suppressLintWarnings(world); - boolean ret = super.match(shadow, world); - clearLintSuppressions(world, this.suppressedLintKinds); - return ret; + if (world.areAllLintIgnored()) { + return super.match(shadow, world); + } else { + suppressLintWarnings(world); + boolean ret = super.match(shadow, world); + clearLintSuppressions(world, this.suppressedLintKinds); + return ret; + } } @Override @@ -167,9 +175,13 @@ class BcelAdvice extends Advice { } World world = shadow.getIWorld(); - suppressLintWarnings(world); + if (!world.areAllLintIgnored()) { + suppressLintWarnings(world); + } runtimeTest = getPointcut().findResidue(shadow, exposedState); - clearLintSuppressions(world, this.suppressedLintKinds); + if (!world.areAllLintIgnored()) { + clearLintSuppressions(world, this.suppressedLintKinds); + } // these initializations won't be performed by findResidue, but need to be // so that the joinpoint is primed for weaving diff --git a/weaver/src/org/aspectj/weaver/bcel/BcelMethod.java b/weaver/src/org/aspectj/weaver/bcel/BcelMethod.java index 5f606ce7f..f7c463ddf 100644 --- a/weaver/src/org/aspectj/weaver/bcel/BcelMethod.java +++ b/weaver/src/org/aspectj/weaver/bcel/BcelMethod.java @@ -184,11 +184,12 @@ class BcelMethod extends ResolvedMemberImpl { private void unpackAjAttributes(World world) { associatedShadowMunger = null; - List as = Utility.readAjAttributes(getDeclaringType().getClassName(), method.getAttributes(), - getSourceContext(world), world, bcelObjectType.getWeaverVersionAttribute()); + ResolvedType resolvedDeclaringType = getDeclaringType().resolve(world); + List as = Utility.readAjAttributes(resolvedDeclaringType.getClassName(), method.getAttributes(), + resolvedDeclaringType.getSourceContext(), world, bcelObjectType.getWeaverVersionAttribute()); processAttributes(world, as); - as = AtAjAttributes.readAj5MethodAttributes(method, this, world.resolve(getDeclaringType()), preResolvedPointcut, - getSourceContext(world), world.getMessageHandler()); + as = AtAjAttributes.readAj5MethodAttributes(method, this, resolvedDeclaringType, preResolvedPointcut, resolvedDeclaringType + .getSourceContext(), world.getMessageHandler()); processAttributes(world, as); } diff --git a/weaver/src/org/aspectj/weaver/bcel/BcelObjectType.java b/weaver/src/org/aspectj/weaver/bcel/BcelObjectType.java index 60a1a5449..80811d291 100644 --- a/weaver/src/org/aspectj/weaver/bcel/BcelObjectType.java +++ b/weaver/src/org/aspectj/weaver/bcel/BcelObjectType.java @@ -68,6 +68,7 @@ import org.aspectj.weaver.patterns.PerClause; public class BcelObjectType extends AbstractReferenceTypeDelegate { public JavaClass javaClass; + private boolean artificial; // Was the BcelObject built from an artificial set of bytes? Or from the real ondisk stuff? private LazyClassGen lazyClassGen = null; // set lazily if it's an aspect private int modifiers; @@ -135,9 +136,10 @@ public class BcelObjectType extends AbstractReferenceTypeDelegate { * that's a bigger piece of work. XXX */ - BcelObjectType(ReferenceType resolvedTypeX, JavaClass javaClass, boolean exposedToWeaver) { + BcelObjectType(ReferenceType resolvedTypeX, JavaClass javaClass, boolean artificial, boolean exposedToWeaver) { super(resolvedTypeX, exposedToWeaver); this.javaClass = javaClass; + this.artificial = artificial; initializeFromJavaclass(); // ATAJ: set the delegate right now for @AJ pointcut, else it is done @@ -163,8 +165,9 @@ public class BcelObjectType extends AbstractReferenceTypeDelegate { } // repeat initialization - public void setJavaClass(JavaClass newclass) { + public void setJavaClass(JavaClass newclass, boolean artificial) { this.javaClass = newclass; + this.artificial = artificial; resetState(); initializeFromJavaclass(); } @@ -475,6 +478,10 @@ public class BcelObjectType extends AbstractReferenceTypeDelegate { return javaClass; } + public boolean isArtificial() { + return artificial; + } + public void resetState() { if (javaClass == null) { // we might store the classname and allow reloading? @@ -933,6 +940,8 @@ public class BcelObjectType extends AbstractReferenceTypeDelegate { fields[i].evictWeavingState(); } javaClass = null; + + this.artificial = true; // setSourceContext(SourceContextImpl.UNKNOWN_SOURCE_CONTEXT); // // bit naughty // interfaces=null; // force reinit - may get us the right @@ -959,4 +968,8 @@ public class BcelObjectType extends AbstractReferenceTypeDelegate { public boolean copySourceContext() { return false; } + + public void setExposedToWeaver(boolean b) { + exposedToWeaver = b; + } } diff --git a/weaver/src/org/aspectj/weaver/bcel/BcelWeaver.java b/weaver/src/org/aspectj/weaver/bcel/BcelWeaver.java index 993a2afba..d21a2157f 100644 --- a/weaver/src/org/aspectj/weaver/bcel/BcelWeaver.java +++ b/weaver/src/org/aspectj/weaver/bcel/BcelWeaver.java @@ -186,10 +186,10 @@ public class BcelWeaver { if (wsi != null && wsi.isReweavable()) { BcelObjectType classType = getClassType(type.getName()); JavaClass wovenJavaClass = classType.getJavaClass(); - JavaClass unwovenJavaClass = Utility.makeJavaClass(wovenJavaClass.getFileName(), wsi - .getUnwovenClassFileData(wovenJavaClass.getBytes())); + byte[] bytes = wsi.getUnwovenClassFileData(wovenJavaClass.getBytes()); + JavaClass unwovenJavaClass = Utility.makeJavaClass(wovenJavaClass.getFileName(), bytes); world.storeClass(unwovenJavaClass); - classType.setJavaClass(unwovenJavaClass); + classType.setJavaClass(unwovenJavaClass, true); // classType.setJavaClass(Utility.makeJavaClass(classType. // getJavaClass().getFileName(), // wsi.getUnwovenClassFileData(classType.getJavaClass().getBytes( @@ -263,11 +263,12 @@ public class BcelWeaver { } // FIXME ASC performance? of this alternative soln. + int size = (int) entry.getSize(); ClassParser parser = new ClassParser(new ByteArrayInputStream(FileUtil.readAsByteArray(inStream)), entry.getName()); JavaClass jc = parser.parse(); inStream.closeEntry(); - ResolvedType type = world.addSourceObjectType(jc).getResolvedTypeX(); + ResolvedType type = world.addSourceObjectType(jc, false).getResolvedTypeX(); type.setBinaryPath(inFile.getAbsolutePath()); if (type.isAspect()) { addedAspects.add(type); @@ -301,7 +302,7 @@ public class BcelWeaver { private void addIfAspect(byte[] bytes, String name, List toList, File dir) throws IOException { ClassParser parser = new ClassParser(new ByteArrayInputStream(bytes), name); JavaClass jc = parser.parse(); - ResolvedType type = world.addSourceObjectType(jc).getResolvedTypeX(); + ResolvedType type = world.addSourceObjectType(jc, false).getResolvedTypeX(); String typeName = type.getName().replace('.', File.separatorChar); int end = name.lastIndexOf(typeName + ".class"); String binaryPath = null; @@ -454,7 +455,7 @@ public class BcelWeaver { // classFile)) { // // throw new RuntimeException(classFile.getClassName()); // } - ReferenceType type = world.addSourceObjectType(classFile.getJavaClass()).getResolvedTypeX(); + ReferenceType type = world.addSourceObjectType(classFile.getJavaClass(), false).getResolvedTypeX(); if (fromInpath) { type.setBinaryPath(classFile.getFilename()); } @@ -1437,7 +1438,8 @@ public class BcelWeaver { ResolvedType superclassType = resolvedTypeToWeave.getSuperclass(); String superclassTypename = (superclassType == null ? null : superclassType.getName()); - if (superclassType != null && !superclassType.isTypeHierarchyComplete() && superclassType.isExposedToWeaver()) { // typesForWeaving.contains(superclassTypename)) // { + if (superclassType != null && !superclassType.isTypeHierarchyComplete() && superclassType.isExposedToWeaver()) { // typesForWeaving.contains(superclassTypename)) + // // { weaveParentsFor(typesForWeaving, superclassTypename, superclassType); } @@ -1514,8 +1516,9 @@ public class BcelWeaver { // ().getFileName(), wsi.getUnwovenClassFileData())); // new: reweavable default with clever diff if (!world.isOverWeaving()) { - classType.setJavaClass(Utility.makeJavaClass(classType.getJavaClass().getFileName(), wsi - .getUnwovenClassFileData(classType.getJavaClass().getBytes()))); + + byte[] bytes = wsi.getUnwovenClassFileData(classType.getJavaClass().getBytes()); + classType.setJavaClass(Utility.makeJavaClass(classType.getJavaClass().getFileName(), bytes), true); // } else { // System.out.println("overweaving " + className); } @@ -1788,34 +1791,34 @@ public class BcelWeaver { return null; } 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 shadowMungers = fastMatch(shadowMungerList, resolvedClassType); List typeMungers = classType.getResolvedTypeX().getInterTypeMungers(); - + resolvedClassType.checkInterTypeMungers(); - + // Decide if we need to do actual weaving for this class boolean mightNeedToWeave = shadowMungers.size() > 0 || typeMungers.size() > 0 || classType.isAspect() || world.getDeclareAnnotationOnMethods().size() > 0 || world.getDeclareAnnotationOnFields().size() > 0; - + // May need bridge methods if on 1.5 and something in our hierarchy is // affected by ITDs boolean mightNeedBridgeMethods = world.isInJava5Mode() && !classType.isInterface() && resolvedClassType.getInterTypeMungersIncludingSupers().size() > 0; - + LazyClassGen clazz = null; if (mightNeedToWeave || mightNeedBridgeMethods) { clazz = classType.getLazyClassGen(); @@ -1823,16 +1826,16 @@ public class BcelWeaver { // clazz.getWeaverState()); try { boolean isChanged = false; - + if (mightNeedToWeave) { isChanged = BcelClassWeaver.weave(world, clazz, shadowMungers, typeMungers, lateTypeMungerList, inReweavableMode); } - + if (mightNeedBridgeMethods) { isChanged = BcelClassWeaver.calculateAnyRequiredBridgeMethods(world, clazz) || isChanged; } - + if (isChanged) { if (dump) { dump(classFile, clazz); @@ -1867,15 +1870,15 @@ public class BcelWeaver { * world.getModelAsAsmManager(); if (asm != null) { IHierarchy model = asm.getHierarchy(); if (!classType.isAspect()) { * * String pkgname = classType.getResolvedTypeX().getPackageName(); String tname = - * classType.getResolvedTypeX().getSimpleBaseName(); IProgramElement typeElement = model.findElementForType(pkgname, tname); - * if (typeElement != null) { Set deleted = new HashSet(); + * classType.getResolvedTypeX().getSimpleBaseName(); IProgramElement typeElement = model.findElementForType(pkgname, + * tname); if (typeElement != null) { Set deleted = new HashSet(); * deleted.add(asm.getCanonicalFilePath(typeElement.getSourceLocation().getSourceFile())); * - * model.updateHandleMap(deleted); IProgramElement parent = typeElement.getParent(); // parent may have children: PACKAGE - * DECL, IMPORT-REFEFERENCE, TYPE_DECL if (parent != null) { typeElement.getParent().removeChild(typeElement); // - * System.out.println("Removing " + classType.getResolvedTypeX().getName() + "? " // + ); } } } } + * model.updateHandleMap(deleted); IProgramElement parent = typeElement.getParent(); // parent may have children: + * PACKAGE DECL, IMPORT-REFEFERENCE, TYPE_DECL if (parent != null) { typeElement.getParent().removeChild(typeElement); + * // System.out.println("Removing " + classType.getResolvedTypeX().getName() + "? " // + ); } } } } */ - if (dump) { + if (dump) { dumpUnchanged(classFile); return clazz; } else { diff --git a/weaver/src/org/aspectj/weaver/bcel/BcelWorld.java b/weaver/src/org/aspectj/weaver/bcel/BcelWorld.java index 175041229..756f33dcc 100644 --- a/weaver/src/org/aspectj/weaver/bcel/BcelWorld.java +++ b/weaver/src/org/aspectj/weaver/bcel/BcelWorld.java @@ -374,12 +374,12 @@ public class BcelWorld extends World implements Repository { if (jc == null) { return null; } else { - return buildBcelDelegate(ty, jc, false); + return buildBcelDelegate(ty, jc, false, false); } } - public BcelObjectType buildBcelDelegate(ReferenceType type, JavaClass jc, boolean exposedToWeaver) { - BcelObjectType ret = new BcelObjectType(type, jc, exposedToWeaver); + public BcelObjectType buildBcelDelegate(ReferenceType type, JavaClass jc, boolean artificial, boolean exposedToWeaver) { + BcelObjectType ret = new BcelObjectType(type, jc, artificial, exposedToWeaver); return ret; } @@ -420,11 +420,59 @@ public class BcelWorld extends World implements Repository { } } - public BcelObjectType addSourceObjectType(JavaClass jc) { + // public BcelObjectType addSourceObjectType(JavaClass jc) { + // return addSourceObjectType(jc.getClassName(), jc, -1); + // } + + public BcelObjectType addSourceObjectType(JavaClass jc, boolean artificial) { + return addSourceObjectType(jc.getClassName(), jc, artificial); + } + + public BcelObjectType addSourceObjectType(String classname, JavaClass jc, boolean artificial) { BcelObjectType ret = null; + if (!jc.getClassName().equals(classname)) { + throw new RuntimeException(jc.getClassName() + "!=" + classname); + } String signature = UnresolvedType.forName(jc.getClassName()).getSignature(); - Object fromTheMap = typeMap.get(signature); + ResolvedType fromTheMap = typeMap.get(signature); + + if (fromTheMap != null && !(fromTheMap instanceof ReferenceType)) { + // what on earth is it then? See pr 112243 + StringBuffer exceptionText = new StringBuffer(); + exceptionText.append("Found invalid (not a ReferenceType) entry in the type map. "); + exceptionText.append("Signature=[" + signature + "] Found=[" + fromTheMap + "] Class=[" + fromTheMap.getClass() + "]"); + throw new BCException(exceptionText.toString()); + } + + ReferenceType nameTypeX = (ReferenceType) fromTheMap; + + if (nameTypeX == null) { + if (jc.isGeneric() && isInJava5Mode()) { + nameTypeX = ReferenceType.fromTypeX(UnresolvedType.forRawTypeName(jc.getClassName()), this); + ret = buildBcelDelegate(nameTypeX, jc, artificial, true); + ReferenceType genericRefType = new ReferenceType(UnresolvedType.forGenericTypeSignature(signature, ret + .getDeclaredGenericSignature()), this); + nameTypeX.setDelegate(ret); + genericRefType.setDelegate(ret); + nameTypeX.setGenericType(genericRefType); + typeMap.put(signature, nameTypeX); + } else { + nameTypeX = new ReferenceType(signature, this); + ret = buildBcelDelegate(nameTypeX, jc, artificial, true); + typeMap.put(signature, nameTypeX); + } + } else { + ret = buildBcelDelegate(nameTypeX, jc, artificial, true); + } + return ret; + } + + public BcelObjectType addSourceObjectType(String classname, byte[] bytes, boolean artificial) { + BcelObjectType ret = null; + String signature = UnresolvedType.forName(classname).getSignature(); + + ResolvedType fromTheMap = typeMap.get(signature); if (fromTheMap != null && !(fromTheMap instanceof ReferenceType)) { // what on earth is it then? See pr 112243 @@ -437,9 +485,10 @@ public class BcelWorld extends World implements Repository { ReferenceType nameTypeX = (ReferenceType) fromTheMap; if (nameTypeX == null) { + JavaClass jc = Utility.makeJavaClass(classname, bytes); if (jc.isGeneric() && isInJava5Mode()) { nameTypeX = ReferenceType.fromTypeX(UnresolvedType.forRawTypeName(jc.getClassName()), this); - ret = buildBcelDelegate(nameTypeX, jc, true); + ret = buildBcelDelegate(nameTypeX, jc, artificial, true); ReferenceType genericRefType = new ReferenceType(UnresolvedType.forGenericTypeSignature(signature, ret .getDeclaredGenericSignature()), this); nameTypeX.setDelegate(ret); @@ -448,11 +497,25 @@ public class BcelWorld extends World implements Repository { typeMap.put(signature, nameTypeX); } else { nameTypeX = new ReferenceType(signature, this); - ret = buildBcelDelegate(nameTypeX, jc, true); + ret = buildBcelDelegate(nameTypeX, jc, artificial, true); typeMap.put(signature, nameTypeX); } } else { - ret = buildBcelDelegate(nameTypeX, jc, true); + Object o = nameTypeX.getDelegate(); + if (!(o instanceof BcelObjectType)) { + throw new IllegalStateException("For " + classname + " should be BcelObjectType, but is " + o.getClass()); + } + ret = (BcelObjectType) o; + // byte[] bs = ret.javaClass.getBytes(); + // if (bs.length != bytes.length) { + // throw new RuntimeException("Shit"); + // } + if (ret.isArtificial()) { + // System.out.println("Rebuilding " + nameTypeX.getName()); + ret = buildBcelDelegate(nameTypeX, Utility.makeJavaClass(classname, bytes), artificial, true); + } else { + ret.setExposedToWeaver(true); + } } return ret; } @@ -1028,4 +1091,8 @@ public class BcelWorld extends World implements Repository { } } + public TypeMap getTypeMap() { + return typeMap; + } + } diff --git a/weaver/src/org/aspectj/weaver/tools/WeavingAdaptor.java b/weaver/src/org/aspectj/weaver/tools/WeavingAdaptor.java index cb137d8d1..f9060140d 100644 --- a/weaver/src/org/aspectj/weaver/tools/WeavingAdaptor.java +++ b/weaver/src/org/aspectj/weaver/tools/WeavingAdaptor.java @@ -53,7 +53,6 @@ import org.aspectj.weaver.bcel.BcelObjectType; import org.aspectj.weaver.bcel.BcelWeaver; import org.aspectj.weaver.bcel.BcelWorld; import org.aspectj.weaver.bcel.UnwovenClassFile; -import org.aspectj.weaver.bcel.Utility; // OPTIMIZE add guards for all the debug/info/etc /** @@ -84,7 +83,7 @@ public class WeavingAdaptor implements IMessageContext { private boolean abortOnError = false; protected GeneratedClassHandler generatedClassHandler; protected Map generatedClasses = new HashMap(); /* String -> UnwovenClassFile */ - protected BcelObjectType delegateForCurrentClass; // lazily initialized, should be used to prevent parsing bytecode multiple + public BcelObjectType delegateForCurrentClass; // lazily initialized, should be used to prevent parsing bytecode multiple // times private boolean haveWarnedOnJavax = false; @@ -293,6 +292,8 @@ public class WeavingAdaptor implements IMessageContext { return bytes; } + boolean debugOn = !messageHandler.isIgnoring(Message.DEBUG); + try { delegateForCurrentClass = null; name = name.replace('/', '.'); @@ -303,21 +304,27 @@ public class WeavingAdaptor implements IMessageContext { // a valid aspectOf()/hasAspect() generated in them. However - if they are excluded // (via include/exclude in aop.xml) they really should only get aspectOf()/hasAspect() // and not be included in the full set of aspects being applied by 'this' weaver - debug("weaving '" + name + "'"); - bytes = getWovenBytes(name, bytes); - } else if (shouldWeaveAnnotationStyleAspect(name, bytes)) { - if (mustWeave) { - if (bcelWorld.getLint().mustWeaveXmlDefinedAspects.isEnabled()) { - bcelWorld.getLint().mustWeaveXmlDefinedAspects.signal(name, null); - } + if (debugOn) { + debug("weaving '" + name + "'"); } - // an @AspectJ aspect needs to be at least munged by the aspectOf munger - debug("weaving '" + name + "'"); - bytes = getAtAspectJAspectBytes(name, bytes); - } else { + bytes = getWovenBytes(name, bytes); + // temporarily out - searching for @Aspect annotated types is a slow thing to do - we should + // expect the user to name them if they want them woven - just like code style + // } else if (shouldWeaveAnnotationStyleAspect(name, bytes)) { + // if (mustWeave) { + // if (bcelWorld.getLint().mustWeaveXmlDefinedAspects.isEnabled()) { + // bcelWorld.getLint().mustWeaveXmlDefinedAspects.signal(name, null); + // } + // } + // // an @AspectJ aspect needs to be at least munged by the aspectOf munger + // if (debugOn) { + // debug("weaving '" + name + "'"); + // } + // bytes = getAtAspectJAspectBytes(name, bytes); + } else if (debugOn) { debug("not weaving '" + name + "'"); } - } else { + } else if (debugOn) { debug("cannot weave '" + name + "'"); } } finally { @@ -351,44 +358,46 @@ public class WeavingAdaptor implements IMessageContext { } private boolean shouldWeaveName(String name) { - if ((weavingSpecialTypes & INITIALIZED) == 0) { - weavingSpecialTypes |= INITIALIZED; - // initialize it - Properties p = weaver.getWorld().getExtraConfiguration(); - if (p != null) { - boolean b = p.getProperty(World.xsetWEAVE_JAVA_PACKAGES, "false").equalsIgnoreCase("true"); - if (b) { - weavingSpecialTypes |= WEAVE_JAVA_PACKAGE; - } - b = p.getProperty(World.xsetWEAVE_JAVAX_PACKAGES, "false").equalsIgnoreCase("true"); - if (b) { - weavingSpecialTypes |= WEAVE_JAVAX_PACKAGE; + if ("osj".indexOf(name.charAt(0)) != -1) { + if ((weavingSpecialTypes & INITIALIZED) == 0) { + weavingSpecialTypes |= INITIALIZED; + // initialize it + Properties p = weaver.getWorld().getExtraConfiguration(); + if (p != null) { + boolean b = p.getProperty(World.xsetWEAVE_JAVA_PACKAGES, "false").equalsIgnoreCase("true"); + if (b) { + weavingSpecialTypes |= WEAVE_JAVA_PACKAGE; + } + b = p.getProperty(World.xsetWEAVE_JAVAX_PACKAGES, "false").equalsIgnoreCase("true"); + if (b) { + weavingSpecialTypes |= WEAVE_JAVAX_PACKAGE; + } } } - } - if (name.startsWith("org.aspectj.")) { - return false; - } - if (name.startsWith("sun.reflect.")) {// JDK reflect - return false; - } - if (name.startsWith("javax.")) { - if ((weavingSpecialTypes & WEAVE_JAVAX_PACKAGE) != 0) { - return true; - } else { - if (!haveWarnedOnJavax) { - haveWarnedOnJavax = true; - warn("javax.* types are not being woven because the weaver option '-Xset:weaveJavaxPackages=true' has not been specified"); - } + if (name.startsWith("org.aspectj.")) { return false; } - } - if (name.startsWith("java.")) { - if ((weavingSpecialTypes & WEAVE_JAVA_PACKAGE) != 0) { - return true; - } else { + if (name.startsWith("sun.reflect.")) {// JDK reflect return false; } + if (name.startsWith("javax.")) { + if ((weavingSpecialTypes & WEAVE_JAVAX_PACKAGE) != 0) { + return true; + } else { + if (!haveWarnedOnJavax) { + haveWarnedOnJavax = true; + warn("javax.* types are not being woven because the weaver option '-Xset:weaveJavaxPackages=true' has not been specified"); + } + return false; + } + } + if (name.startsWith("java.")) { + if ((weavingSpecialTypes & WEAVE_JAVA_PACKAGE) != 0) { + return true; + } else { + return false; + } + } } // boolean should = !(name.startsWith("org.aspectj.") // || (name.startsWith("java.") && (weavingSpecialTypes & WEAVE_JAVA_PACKAGE) == 0) @@ -432,7 +441,8 @@ public class WeavingAdaptor implements IMessageContext { protected void ensureDelegateInitialized(String name, byte[] bytes) { if (delegateForCurrentClass == null) { - delegateForCurrentClass = ((BcelWorld) weaver.getWorld()).addSourceObjectType(Utility.makeJavaClass(name, bytes)); + BcelWorld world = (BcelWorld) weaver.getWorld(); + delegateForCurrentClass = world.addSourceObjectType(name, bytes, false); } } -- 2.39.5