Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add a reset() method to classweaver so that we can clean up some inte…

…rnal Kilim state, since this builds up and confuses repeat invocations of the weaver.
  • Loading branch information...
commit 7f19a2a76ab9f6f70300544debba85329f968299 1 parent a620ee0
@krestenkrab authored
Showing with 12 additions and 3 deletions.
  1. +12 −3 src/kilim/analysis/ClassWeaver.java
View
15 src/kilim/analysis/ClassWeaver.java
@@ -29,7 +29,16 @@
public class ClassWeaver {
ClassFlow classFlow;
List<ClassInfo> classInfoList = new LinkedList<ClassInfo>();
- static HashSet<String> stateClasses = new HashSet<String>();
+
+ static ThreadLocal<HashSet<String>> stateClasses = new ThreadLocal<HashSet<String>>() {
+ protected java.util.HashSet<String> initialValue() {
+ return new HashSet<String>();
+ }
+ };
+
+ public static void reset() {
+ stateClasses.set(new HashSet<String>());
+ }
public ClassWeaver(byte[] data, Detector detector) {
classFlow = new ClassFlow(data, detector);
@@ -183,10 +192,10 @@ String createStateClass(ValInfoList valInfoList) {
numByType[vi.vmt]++;
}
String className = makeClassName(numByType);
- if (stateClasses.contains(className)) {
+ if (stateClasses.get().contains(className)) {
return className;
}
- stateClasses.add(className);
+ stateClasses.get().add(className);
ClassWriter cw = new ClassWriter(false);
cw.visit(V1_1, ACC_PUBLIC | ACC_FINAL, className, null, "kilim/State", null);
Please sign in to comment.
Something went wrong with that request. Please try again.