aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoraclement <aclement>2011-02-21 20:54:45 +0000
committeraclement <aclement>2011-02-21 20:54:45 +0000
commitf7e5b6d7cf264cf677950310506710317c24b8fc (patch)
treef0768fc676517010666292525ff0af674cbdd987
parent80785bfd5347e6bf06b3202013d435f68727c910 (diff)
downloadaspectj-f7e5b6d7cf264cf677950310506710317c24b8fc.tar.gz
aspectj-f7e5b6d7cf264cf677950310506710317c24b8fc.zip
synchronization to allow multiple threads to start using the world (see Thorstens post on the mailing list)
-rw-r--r--org.aspectj.matcher/src/org/aspectj/weaver/ReferenceType.java2
-rw-r--r--org.aspectj.matcher/src/org/aspectj/weaver/World.java30
2 files changed, 17 insertions, 15 deletions
diff --git a/org.aspectj.matcher/src/org/aspectj/weaver/ReferenceType.java b/org.aspectj.matcher/src/org/aspectj/weaver/ReferenceType.java
index eb4bff255..28718d474 100644
--- a/org.aspectj.matcher/src/org/aspectj/weaver/ReferenceType.java
+++ b/org.aspectj.matcher/src/org/aspectj/weaver/ReferenceType.java
@@ -111,7 +111,7 @@ public class ReferenceType extends ResolvedType {
// this.delegate = genericReferenceType.getDelegate();
// genericReferenceType.addDependentType(this);
// }
- private void addDependentType(ReferenceType dependent) {
+ private synchronized void addDependentType(ReferenceType dependent) {
this.derivativeTypes.add(dependent);
}
diff --git a/org.aspectj.matcher/src/org/aspectj/weaver/World.java b/org.aspectj.matcher/src/org/aspectj/weaver/World.java
index 779804c2f..43a63b10d 100644
--- a/org.aspectj.matcher/src/org/aspectj/weaver/World.java
+++ b/org.aspectj.matcher/src/org/aspectj/weaver/World.java
@@ -272,8 +272,8 @@ public abstract class World implements Dump.INode {
}
// dispatch back to the type variable reference to resolve its
- // constituent parts
- // don't do this for other unresolved types otherwise you'll end up in a
+ // constituent parts don't do this for other unresolved types otherwise
+ // you'll end up in a
// loop
if (ty.isTypeVariableReference()) {
return ty.resolve(this);
@@ -300,18 +300,18 @@ public abstract class World implements Dump.INode {
}
// no existing resolved type, create one
- if (ty.isArray()) {
- ResolvedType componentType = resolve(ty.getComponentType(), allowMissing);
- // String brackets =
- // signature.substring(0,signature.lastIndexOf("[")+1);
- ret = new ArrayReferenceType(signature, "[" + componentType.getErasureSignature(), this, componentType);
- } else {
- ret = resolveToReferenceType(ty, allowMissing);
- if (!allowMissing && ret.isMissing()) {
- ret = handleRequiredMissingTypeDuringResolution(ty);
- }
- if (completeBinaryTypes) {
- completeBinaryType(ret);
+ synchronized (buildingTypeLock) {
+ if (ty.isArray()) {
+ ResolvedType componentType = resolve(ty.getComponentType(), allowMissing);
+ ret = new ArrayReferenceType(signature, "[" + componentType.getErasureSignature(), this, componentType);
+ } else {
+ ret = resolveToReferenceType(ty, allowMissing);
+ if (!allowMissing && ret.isMissing()) {
+ ret = handleRequiredMissingTypeDuringResolution(ty);
+ }
+ if (completeBinaryTypes) {
+ completeBinaryType(ret);
+ }
}
}
@@ -329,6 +329,8 @@ public abstract class World implements Dump.INode {
}
}
+ private Object buildingTypeLock = new Object();
+
// Only need one representation of '?' in a world - can be shared
private BoundedReferenceType wildcard;