summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjhugunin <jhugunin>2003-01-03 23:22:23 +0000
committerjhugunin <jhugunin>2003-01-03 23:22:23 +0000
commit0025a76674bd4e3384a4b5278f5a2049d08f83bc (patch)
tree41f1c22583b76cf08aeeefd896e082f54191065d
parent23a1b71057a3153ada5aeae61f59c35421b51c23 (diff)
downloadaspectj-0025a76674bd4e3384a4b5278f5a2049d08f83bc.tar.gz
aspectj-0025a76674bd4e3384a4b5278f5a2049d08f83bc.zip
incremental and application to binaries improved
-rw-r--r--weaver/src/org/aspectj/weaver/Lint.java3
-rw-r--r--weaver/src/org/aspectj/weaver/ResolvedTypeMunger.java9
-rw-r--r--weaver/src/org/aspectj/weaver/ResolvedTypeX.java11
-rw-r--r--weaver/src/org/aspectj/weaver/XlintDefault.properties4
-rw-r--r--weaver/src/org/aspectj/weaver/bcel/BcelObjectType.java26
-rw-r--r--weaver/src/org/aspectj/weaver/bcel/BcelWeaver.java13
-rw-r--r--weaver/src/org/aspectj/weaver/bcel/BcelWorld.java4
-rw-r--r--weaver/src/org/aspectj/weaver/bcel/UnwovenZipClassFile.java45
-rw-r--r--weaver/src/org/aspectj/weaver/patterns/DeclareParents.java11
9 files changed, 63 insertions, 63 deletions
diff --git a/weaver/src/org/aspectj/weaver/Lint.java b/weaver/src/org/aspectj/weaver/Lint.java
index 82135a1df..ce8850754 100644
--- a/weaver/src/org/aspectj/weaver/Lint.java
+++ b/weaver/src/org/aspectj/weaver/Lint.java
@@ -34,6 +34,9 @@ public class Lint {
public final Kind unresolvableMember =
new Kind("unresolvableMember", "can not resolve this member: {0}");
+ public final Kind typeNotExposedToWeaver =
+ new Kind("typeNotExposedToWeaver", "this affected type is not exposed to the weaver: {0}");
+
public Lint(World world) {
this.world = world;
diff --git a/weaver/src/org/aspectj/weaver/ResolvedTypeMunger.java b/weaver/src/org/aspectj/weaver/ResolvedTypeMunger.java
index 2b943ede1..9f537c9d0 100644
--- a/weaver/src/org/aspectj/weaver/ResolvedTypeMunger.java
+++ b/weaver/src/org/aspectj/weaver/ResolvedTypeMunger.java
@@ -46,7 +46,14 @@ public abstract class ResolvedTypeMunger {
public boolean matches(ResolvedTypeX matchType) {
ResolvedTypeX onType = matchType.getWorld().resolve(signature.getDeclaringType());
//System.err.println("matching: " + this + " to " + matchType + " onType = " + onType);
- if (matchType.equals(onType)) return true;
+ if (matchType.equals(onType)) {
+ if (!onType.isExposedToWeaver() &&
+ matchType.getWorld().getLint().typeNotExposedToWeaver.isEnabled())
+ {
+ matchType.getWorld().getLint().typeNotExposedToWeaver.signal(matchType.getName(), signature.getSourceLocation());
+ }
+ return true;
+ }
//System.err.println("NO MATCH DIRECT");
if (onType.isInterface()) {
diff --git a/weaver/src/org/aspectj/weaver/ResolvedTypeX.java b/weaver/src/org/aspectj/weaver/ResolvedTypeX.java
index e8a76d99a..1d4042ac9 100644
--- a/weaver/src/org/aspectj/weaver/ResolvedTypeX.java
+++ b/weaver/src/org/aspectj/weaver/ResolvedTypeX.java
@@ -25,6 +25,7 @@ import org.aspectj.weaver.patterns.PerClause;
public abstract class ResolvedTypeX extends TypeX {
protected World world;
+
ResolvedTypeX(String signature, World world) {
super(signature);
@@ -508,9 +509,12 @@ public abstract class ResolvedTypeX extends TypeX {
public static abstract class Name extends ResolvedTypeX {
protected ISourceContext sourceContext;
+ protected boolean exposedToWeaver;
+
- public Name(String signature, World world) {
+ public Name(String signature, World world, boolean exposedToWeaver) {
super(signature, world);
+ this.exposedToWeaver = exposedToWeaver;
}
public final boolean isClass() {
@@ -565,6 +569,10 @@ public abstract class ResolvedTypeX extends TypeX {
return sourceContext;
}
+ public boolean isExposedToWeaver() {
+ return exposedToWeaver;
+ }
+
}
static class Array extends ResolvedTypeX {
@@ -1097,4 +1105,5 @@ public abstract class ResolvedTypeX extends TypeX {
}
public ISourceLocation getSourceLocation() { return null; }
+ public boolean isExposedToWeaver() { return false; }
}
diff --git a/weaver/src/org/aspectj/weaver/XlintDefault.properties b/weaver/src/org/aspectj/weaver/XlintDefault.properties
index eb5944dfa..25e48c76e 100644
--- a/weaver/src/org/aspectj/weaver/XlintDefault.properties
+++ b/weaver/src/org/aspectj/weaver/XlintDefault.properties
@@ -1,4 +1,6 @@
invalidAbsoluteTypeName = warning
invalidWildcardTypeName = ignore
-unresolvableMember = warning \ No newline at end of file
+unresolvableMember = warning
+
+typeNotExposedToWeaver = warning \ No newline at end of file
diff --git a/weaver/src/org/aspectj/weaver/bcel/BcelObjectType.java b/weaver/src/org/aspectj/weaver/bcel/BcelObjectType.java
index e02410a7b..b67fc5238 100644
--- a/weaver/src/org/aspectj/weaver/bcel/BcelObjectType.java
+++ b/weaver/src/org/aspectj/weaver/bcel/BcelObjectType.java
@@ -58,8 +58,8 @@ public class BcelObjectType extends ResolvedTypeX.Name {
// IMPORTANT! THIS DOESN'T do real work on the java class, just stores it away.
- BcelObjectType(String signature, World world, JavaClass javaClass) {
- super(signature, world);
+ BcelObjectType(String signature, World world, JavaClass javaClass, boolean exposedToWeaver) {
+ super(signature, world, exposedToWeaver);
this.javaClass = javaClass;
sourceContext = new BcelSourceContext(this);
@@ -146,6 +146,7 @@ public class BcelObjectType extends ResolvedTypeX.Name {
List l = BcelAttributes.readAjAttributes(javaClass.getAttributes(), getSourceContext());
for (Iterator iter = l.iterator(); iter.hasNext();) {
AjAttribute a = (AjAttribute) iter.next();
+ //System.err.println("unpacking: " + this + " and " + a);
if (a instanceof AjAttribute.Aspect) {
perClause = ((AjAttribute.Aspect)a).reify(this);
} else if (a instanceof AjAttribute.PointcutDeclarationAttribute) {
@@ -181,13 +182,7 @@ public class BcelObjectType extends ResolvedTypeX.Name {
return javaClass;
}
- /**
- * Switch to a new JavaClass and clear all caches
- */
- void replaceJavaClass(JavaClass jc) {
- if (this.javaClass == jc) return;
-
- this.javaClass = jc;
+ void resetState() {
this.interfaces = null;
this.superClass = null;
this.fields = null;
@@ -199,7 +194,17 @@ public class BcelObjectType extends ResolvedTypeX.Name {
isObject = (javaClass.getSuperclassNameIndex() == 0);
unpackAspectAttributes();
- //XXX is clearing these caches sufficient
+ }
+
+
+ /**
+ * Switch to a new JavaClass and clear all caches
+ */
+ void replaceJavaClass(JavaClass jc) {
+ if (this.javaClass == jc) return;
+
+ this.javaClass = jc;
+ resetState();
}
public WeaverStateKind getWeaverState() {
@@ -227,6 +232,7 @@ public class BcelObjectType extends ResolvedTypeX.Name {
public LazyClassGen getLazyClassGen() {
LazyClassGen ret = lazyClassGen;
if (ret == null) {
+ //System.err.println("creating lazy class gen for: " + this);
ret = new LazyClassGen(this);
if (isAspect()) {
lazyClassGen = ret;
diff --git a/weaver/src/org/aspectj/weaver/bcel/BcelWeaver.java b/weaver/src/org/aspectj/weaver/bcel/BcelWeaver.java
index f22bec950..a73330479 100644
--- a/weaver/src/org/aspectj/weaver/bcel/BcelWeaver.java
+++ b/weaver/src/org/aspectj/weaver/bcel/BcelWeaver.java
@@ -224,6 +224,18 @@ public class BcelWeaver implements IWeaver {
"(world=" + needToReweaveWorld + ")", null, null);
+ //System.err.println("typeMungers: " + typeMungerList);
+
+ // clear all state from files we'll be reweaving
+ for (Iterator i = filesToWeave.iterator(); i.hasNext(); ) {
+ UnwovenClassFile classFile = (UnwovenClassFile)i.next();
+ String className = classFile.getClassName();
+ BcelObjectType classType = (BcelObjectType) world.resolve(className);
+ classType.resetState();
+ }
+
+
+
//XXX this isn't quite the right place for this...
for (Iterator i = filesToWeave.iterator(); i.hasNext(); ) {
UnwovenClassFile classFile = (UnwovenClassFile)i.next();
@@ -290,6 +302,7 @@ public class BcelWeaver implements IWeaver {
if (shadowMungers.size() > 0 || typeMungers.size() > 0 || classType.isAspect()) {
clazz = classType.getLazyClassGen();
+ //System.err.println("got lazy gen: " + clazz + ", " + clazz.getWeaverState());
try {
boolean isChanged = BcelClassWeaver.weave(world, clazz, shadowMungers, typeMungers);
if (isChanged) {
diff --git a/weaver/src/org/aspectj/weaver/bcel/BcelWorld.java b/weaver/src/org/aspectj/weaver/bcel/BcelWorld.java
index 97d8a09a4..1e4b603ec 100644
--- a/weaver/src/org/aspectj/weaver/bcel/BcelWorld.java
+++ b/weaver/src/org/aspectj/weaver/bcel/BcelWorld.java
@@ -170,7 +170,7 @@ public class BcelWorld extends World {
if (jc == null) {
return ResolvedTypeX.MISSING;
} else {
- return new BcelObjectType(ty.getSignature(), this, jc);
+ return new BcelObjectType(ty.getSignature(), this, jc, false);
}
}
@@ -195,7 +195,7 @@ public class BcelWorld extends World {
String signature = TypeX.forName(jc.getClassName()).getSignature();
BcelObjectType ret = (BcelObjectType)typeMap.get(signature);
if (ret == null) {
- ret = new BcelObjectType(signature, this, jc);
+ ret = new BcelObjectType(signature, this, jc, true);
typeMap.put(signature, ret);
} else {
ret.replaceJavaClass(jc);
diff --git a/weaver/src/org/aspectj/weaver/bcel/UnwovenZipClassFile.java b/weaver/src/org/aspectj/weaver/bcel/UnwovenZipClassFile.java
deleted file mode 100644
index 2c4c760a9..000000000
--- a/weaver/src/org/aspectj/weaver/bcel/UnwovenZipClassFile.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/* *******************************************************************
- * Copyright (c) 2002 Palo Alto Research Center, Incorporated (PARC).
- * All rights reserved.
- * This program and the accompanying materials are made available
- * under the terms of the Common Public License v1.0
- * which accompanies this distribution and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * Xerox/PARC initial implementation
- * ******************************************************************/
-
-
-package org.aspectj.weaver.bcel;
-
-import java.io.IOException;
-import java.util.List;
-import java.util.zip.*;
-
-//XXX we believe this is now unneeded
-public class UnwovenZipClassFile extends UnwovenClassFile {
- private ZipOutputStream zipOutputStream;
-
- public UnwovenZipClassFile(ZipOutputStream zipOutputStream, String filename, byte[] bytes) {
- super(filename, bytes);
- this.zipOutputStream = zipOutputStream;
- }
-
-
- public void writeWovenBytes(byte[] bytes, List childClasses) throws IOException {
- //??? we rewrite this every time
- if (!childClasses.isEmpty()) {
- throw new RuntimeException("unimplemented");
- }
-
- ZipEntry newEntry = new ZipEntry(filename); //??? get compression scheme right
-
- zipOutputStream.putNextEntry(newEntry);
- zipOutputStream.write(bytes);
- zipOutputStream.closeEntry();
-
- writtenBytes = bytes;
- }
-
-}
diff --git a/weaver/src/org/aspectj/weaver/patterns/DeclareParents.java b/weaver/src/org/aspectj/weaver/patterns/DeclareParents.java
index 38e5de365..8d67f7815 100644
--- a/weaver/src/org/aspectj/weaver/patterns/DeclareParents.java
+++ b/weaver/src/org/aspectj/weaver/patterns/DeclareParents.java
@@ -34,10 +34,15 @@ public class DeclareParents extends Declare {
}
public boolean match(ResolvedTypeX typeX) {
- return child.matchesStatically(typeX);
+ if (!child.matchesStatically(typeX)) return false;
+ if (typeX.getWorld().getLint().typeNotExposedToWeaver.isEnabled() &&
+ !typeX.isExposedToWeaver())
+ {
+ typeX.getWorld().getLint().typeNotExposedToWeaver.signal(typeX.getName(), getSourceLocation());
+ }
+
+ return true;
}
-
-
public String toString() {
StringBuffer buf = new StringBuffer();