summaryrefslogtreecommitdiff
path: root/src/fjbg/ch/epfl/lamp/fjbg/JBootstrapInvokeDynamic.java
blob: ad4acfc3295fc635675301a522a04cff05a2cca7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package ch.epfl.lamp.fjbg;

import java.io.DataOutputStream;
import java.io.IOException;
import java.util.Iterator;

/**
 * BootstrapInvokeDynamic entry, as described by JSR 292 (invoke dynamic)
 *
 * @author Iulian Dragos
 *
 */
public class JBootstrapInvokeDynamic extends JAttribute {
	/** Constant pool of the current classfile. */
	private JConstantPool pool;

	private int classIndex = -1;

    public JBootstrapInvokeDynamic(FJBGContext context,
            JClass clazz, String className) {
    	super(context, clazz);
    	this.pool = clazz.pool;
    	this.classIndex = pool.addClass(className);
    }

    public String getName() { return "BootstrapInvokeDynamic"; }

	protected int getSize() {
		return 2;
	}

	protected void writeContentsTo(DataOutputStream stream) throws IOException {
		stream.writeShort(classIndex);
	}
}