Skip to content

Commit 6671697

Browse files
lrytzretronym
authored andcommitted
[asm-cherry-pick] asm.CustomAttribute class
Allows creating an asm.Attribute and directly providing the content as a byte array. Originally added in lrytz/scala@9a7e518
1 parent 5da6299 commit 6671697

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

src/main/java/scala/tools/asm/Attribute.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public class Attribute {
4848
* The 6 header bytes of the attribute (attribute_name_index and attribute_length) are <i>not</i>
4949
* included.
5050
*/
51-
private byte[] content;
51+
protected byte[] content;
5252

5353
/**
5454
* The next attribute in this attribute list (Attribute instances can be linked via this field to
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/* NSC -- new Scala compiler
2+
* Copyright 2005-2012 LAMP/EPFL
3+
*/
4+
5+
package scala.tools.asm;
6+
7+
import scala.tools.asm.Attribute;
8+
9+
/**
10+
* A subclass of ASM's Attribute for the sole purpose of accessing a protected field there.
11+
*
12+
*/
13+
public class CustomAttr extends Attribute {
14+
15+
public CustomAttr(final String type, final byte[] value) {
16+
super(type);
17+
super.content = value;
18+
}
19+
20+
}

0 commit comments

Comments
 (0)