diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassWriter.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassWriter.java index 765e1a36987f4..6710c4879a200 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassWriter.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassWriter.java @@ -868,12 +868,9 @@ int writeRecordAttribute(ClassSymbol csym) { int writeMatcherAttribute(MethodSymbol m) { final int attrIndex = writeAttr(names.Matcher); - databuf.appendChar(MatcherFlags.value(m.matcherFlags)); - databuf.appendChar(poolWriter.putName(m.name)); - - Type patternDescriptor = m.type; - databuf.appendChar(poolWriter.putDescriptor(patternDescriptor)); + databuf.appendChar(MatcherFlags.value(m.matcherFlags)); + databuf.appendChar(poolWriter.putConstant(m.type.asMethodType())); int acountIdx = beginAttrs(); int acount = 0; @@ -887,6 +884,7 @@ int writeMatcherAttribute(MethodSymbol m) { endAttrs(acountIdx, acount); endAttr(attrIndex); + return 1; } diff --git a/src/jdk.jdeps/share/classes/com/sun/tools/classfile/ClassWriter.java b/src/jdk.jdeps/share/classes/com/sun/tools/classfile/ClassWriter.java index fbcc65fae4f00..54bf47e9a4d8a 100644 --- a/src/jdk.jdeps/share/classes/com/sun/tools/classfile/ClassWriter.java +++ b/src/jdk.jdeps/share/classes/com/sun/tools/classfile/ClassWriter.java @@ -528,9 +528,9 @@ protected void writeLocalVariableTypeTableEntry(LocalVariableTypeTable_attribute @Override public Void visitMatcher(Matcher_attribute attr, ClassOutputStream out) { - out.writeShort(attr.pattern_flags); - out.writeShort(attr.pattern_name_index); - out.writeShort(attr.pattern_descriptor.index); + out.writeShort(attr.matcher_flags); + out.writeShort(attr.matcher_name_index); + out.writeShort(attr.matcher_methodtype.descriptor_index); int size = attr.attributes.size(); out.writeShort(size); for (Attribute componentAttr: attr.attributes) diff --git a/src/jdk.jdeps/share/classes/com/sun/tools/classfile/Matcher_attribute.java b/src/jdk.jdeps/share/classes/com/sun/tools/classfile/Matcher_attribute.java index d8c78b85a95ed..d167adb0c31c4 100644 --- a/src/jdk.jdeps/share/classes/com/sun/tools/classfile/Matcher_attribute.java +++ b/src/jdk.jdeps/share/classes/com/sun/tools/classfile/Matcher_attribute.java @@ -27,6 +27,8 @@ import java.io.IOException; +import static com.sun.tools.classfile.ConstantPool.*; + /** *
This is NOT part of any supported API.
* If you write code that depends on this, you do so at your own risk.
@@ -37,19 +39,19 @@ public class Matcher_attribute extends Attribute {
public static final int PAT_DECONSTRUCTOR = 0x0001;
public static final int PAT_TOTAL = 0x0002;
- Matcher_attribute(ClassReader cr, int name_index, int length) throws IOException {
+ Matcher_attribute(ClassReader cr, int name_index, int length) throws IOException, ConstantPoolException {
super(name_index, length);
- pattern_flags = cr.readUnsignedShort();
- pattern_name_index = cr.readUnsignedShort();
- pattern_descriptor = new Descriptor(cr);
+ matcher_name_index = cr.readUnsignedShort();
+ matcher_flags = cr.readUnsignedShort();
+ matcher_methodtype = new CONSTANT_MethodType_info(cr.getConstantPool(), cr.readUnsignedShort());
attributes = new Attributes(cr);
}
- public Matcher_attribute(int name_index, int pattern_flags, int pattern_name_index, Descriptor pattern_descriptor, Attributes attributes) {
+ public Matcher_attribute(int name_index, int pattern_flags, int matcher_name_index, CONSTANT_MethodType_info matcher_methodtype, Attributes attributes) {
super(name_index, 4);
- this.pattern_flags = pattern_flags;
- this.pattern_name_index = pattern_name_index;
- this.pattern_descriptor = pattern_descriptor;
+ this.matcher_name_index = matcher_name_index;
+ this.matcher_flags = pattern_flags;
+ this.matcher_methodtype = matcher_methodtype;
this.attributes = attributes;
}
@@ -58,8 +60,8 @@ public