diff options
author | Paul Phillips <paulp@improving.org> | 2011-11-28 08:03:10 +0000 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2011-11-28 08:03:10 +0000 |
commit | 0bea2ab5f6b211a83bbf14ea46fe57b8163c6334 (patch) | |
tree | 1eda4c329deee6b43d82f5922fc58f3de878638d /src/fjbg/ch | |
parent | e4c5e04b06fc434eace07798486a108b6e2d4ae7 (diff) | |
download | scala-0bea2ab5f6b211a83bbf14ea46fe57b8163c6334.tar.gz scala-0bea2ab5f6b211a83bbf14ea46fe57b8163c6334.tar.bz2 scala-0bea2ab5f6b211a83bbf14ea46fe57b8163c6334.zip |
Fix for erroneous bytecode generation.
A remedy for an IllegalAccessError where generated bytecode referred to
an inaccessible type. Closes SI-1430.
Bonus materials:
- tore out all the invokedynamic support. The shipped jdk7
implementation shows limited resemblance to the one this was written
against; the code mostly serves to distract. (I think I could get
invokedynamic working pretty quickly, except that it would
mean having a codebase for java7 and one for 5-6, which is not a yak
I wish to shave today.)
- gave NullClass and NothingClass objects of their own, which
allowed a nice polymorphic simplification of isSubClass, plus a
couple other streamlinings.
Diffstat (limited to 'src/fjbg/ch')
-rw-r--r-- | src/fjbg/ch/epfl/lamp/fjbg/JAttributeFactory.java | 1 | ||||
-rw-r--r-- | src/fjbg/ch/epfl/lamp/fjbg/JBootstrapInvokeDynamic.java | 69 | ||||
-rw-r--r-- | src/fjbg/ch/epfl/lamp/fjbg/JClass.java | 8 |
3 files changed, 0 insertions, 78 deletions
diff --git a/src/fjbg/ch/epfl/lamp/fjbg/JAttributeFactory.java b/src/fjbg/ch/epfl/lamp/fjbg/JAttributeFactory.java index 212058a660..b66bbd8bc0 100644 --- a/src/fjbg/ch/epfl/lamp/fjbg/JAttributeFactory.java +++ b/src/fjbg/ch/epfl/lamp/fjbg/JAttributeFactory.java @@ -48,7 +48,6 @@ public class JAttributeFactory { Constructor defaultConstructor) { this.context = context; this.defaultConstructor = defaultConstructor; - registerClass("BootstrapInvokeDynamic", JBootstrapInvokeDynamic.class); registerClass("Code", JCodeAttribute.class); registerClass("ConstantValue", JConstantValueAttribute.class); registerClass("EnclosingMethod", JEnclosingMethodAttribute.class); diff --git a/src/fjbg/ch/epfl/lamp/fjbg/JBootstrapInvokeDynamic.java b/src/fjbg/ch/epfl/lamp/fjbg/JBootstrapInvokeDynamic.java deleted file mode 100644 index 91c4a465ae..0000000000 --- a/src/fjbg/ch/epfl/lamp/fjbg/JBootstrapInvokeDynamic.java +++ /dev/null @@ -1,69 +0,0 @@ -/* FJBG -- Fast Java Bytecode Generator - * Copyright 2002-2011 LAMP/EPFL - * @author Michel Schinz - */ - -package ch.epfl.lamp.fjbg; - -import java.io.DataInputStream; -import java.io.DataOutputStream; -import java.io.IOException; -import java.util.Iterator; - -/** - * BootstrapInvokeDynamic entry, as described by JSR 292 (invoke dynamic) - * - * @author Iulian Dragos - * @version 1.0 - * - */ -public class JBootstrapInvokeDynamic extends JAttribute { - /** Constant pool of the current classfile. */ - private JConstantPool pool; - - protected final int classIdx; - - public JBootstrapInvokeDynamic(FJBGContext context, - JClass clazz, - String className) { - super(context, clazz); - this.pool = clazz.pool; - - this.classIdx = pool.addClass(className); - } - - public JBootstrapInvokeDynamic(FJBGContext context, - JClass clazz, - Object owner, - String name, - int size, - DataInputStream stream) - throws IOException { - super(context, clazz, name); - - this.classIdx = stream.readShort(); - - assert name.equals(getName()); - } - - public String getName() { return "BootstrapInvokeDynamic"; } - - // Follows javap output format for BootstrapInvokeDynamic attribute. - /*@Override*/ public String toString() { - StringBuffer buf = new StringBuffer(" BootstrapInvokeDynamic:"); - buf.append("\n #"); - buf.append(classIdx); - buf.append("; // class "); - buf.append(pool.lookupClass(classIdx)); - buf.append("\n"); - return buf.toString(); - } - - protected int getSize() { - return 2; // Short.SIZE - } - - protected void writeContentsTo(DataOutputStream stream) throws IOException { - stream.writeShort(classIdx); - } -} diff --git a/src/fjbg/ch/epfl/lamp/fjbg/JClass.java b/src/fjbg/ch/epfl/lamp/fjbg/JClass.java index 31e30725c9..1d0bc0e19b 100644 --- a/src/fjbg/ch/epfl/lamp/fjbg/JClass.java +++ b/src/fjbg/ch/epfl/lamp/fjbg/JClass.java @@ -26,8 +26,6 @@ public class JClass extends JMember { protected final String sourceFileName; protected final JConstantPool pool; - protected JBootstrapInvokeDynamic bootstrapClassAttr = null; - public final static String[] NO_INTERFACES = new String[0]; protected final LinkedList/*<JMethod>*/ methods = new LinkedList(); @@ -307,12 +305,6 @@ public class JClass extends JMember { fStream.close(); } - public void setBootstrapClass(String bootstrapClass) { - assert bootstrapClassAttr == null; - bootstrapClassAttr = new JBootstrapInvokeDynamic(context, this, bootstrapClass); - addAttribute(bootstrapClassAttr); - } - /** * Writes the contents of the class to a data stream. * @param stream The data stream in which the class must be written. |