Permalink
Browse files

fix bug in compiler/kilim interaction where kilim tried to Class.forN…

…ame() a class while weaving (requires new kilim lib too)
  • Loading branch information...
1 parent 2ca5363 commit 25ab9b0781a2cffd70cc57e2d531fcb32bdacade @krestenkrab krestenkrab committed Dec 14, 2009
Showing with 30 additions and 0 deletions.
  1. BIN lib/kilim-0.6-krab.jar
  2. +30 −0 src/main/java/erjang/beam/Compiler.java
View
Binary file not shown.
@@ -24,12 +24,15 @@
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.ArrayList;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
import java.util.zip.CRC32;
import java.util.zip.CheckedInputStream;
import kilim.analysis.ClassInfo;
import kilim.analysis.ClassWeaver;
import kilim.analysis.Detector;
+import kilim.mirrors.ClassMirrorNotFoundException;
import kilim.mirrors.Mirrors;
import org.objectweb.asm.ClassWriter;
@@ -39,6 +42,8 @@
import com.ericsson.otp.erlang.OtpAuthException;
import erjang.EBinary;
+import erjang.EFun;
+import erjang.EObject;
import erjang.beam.analysis.BeamTypeAnalysis;
public class Compiler implements Opcodes {
@@ -158,6 +163,31 @@ public ErjangDetector(String className) {
this.className = className;
}
+
+ static Pattern FUN = Pattern.compile("^erjang\\.m\\..*\\$FN_.*__([0-9])+$");
+
+ /* (non-Javadoc)
+ * @see kilim.analysis.Detector#getSuperClasses(java.lang.String)
+ */
+ @Override
+ public ArrayList<String> getSuperClasses(String cc)
+ throws ClassMirrorNotFoundException {
+
+ Matcher m = FUN.matcher(cc);
+ if (m.matches()) {
+ int arity = Integer.parseInt(m.group(1));
+
+ ArrayList<String> result = new ArrayList<String>();
+ result.add(EFun.class.getName()+arity);
+ result.add(EFun.class.getName());
+ result.add(EObject.class.getName());
+ result.add(Object.class.getName());
+ return result;
+ }
+
+ return super.getSuperClasses(cc);
+ }
+
@Override
public int getPausableStatus(String className, String methodName,
String desc) {

0 comments on commit 25ab9b0

Please sign in to comment.