diff --git a/src/share/classes/com/sun/java/util/jar/pack/Attribute.java b/src/share/classes/com/sun/java/util/jar/pack/Attribute.java index fd644bf759eae8f1266d05232ba225275d27448f..9e891fc7c87feb07d93bb2761866286e260f74b0 100644 --- a/src/share/classes/com/sun/java/util/jar/pack/Attribute.java +++ b/src/share/classes/com/sun/java/util/jar/pack/Attribute.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -177,6 +177,7 @@ class Attribute implements Comparable { define(sd, ATTR_CONTEXT_METHOD, "Synthetic", ""); define(sd, ATTR_CONTEXT_METHOD, "Deprecated", ""); define(sd, ATTR_CONTEXT_METHOD, "Exceptions", "NH[RCH]"); + define(sd, ATTR_CONTEXT_METHOD, "MethodParameters", "NB[RUNHI]"); //define(sd, ATTR_CONTEXT_METHOD, "Code", "HHNI[B]NH[PHPOHPOHRCNH]NH[RUHNI[B]]"); define(sd, ATTR_CONTEXT_CODE, "StackMapTable", diff --git a/src/share/classes/com/sun/java/util/jar/pack/BandStructure.java b/src/share/classes/com/sun/java/util/jar/pack/BandStructure.java index f3d5cec8e48d9baf12c4200ef31a989f134426b3..fdfb87dc136914ed7664c2b255c6881945825776 100644 --- a/src/share/classes/com/sun/java/util/jar/pack/BandStructure.java +++ b/src/share/classes/com/sun/java/util/jar/pack/BandStructure.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -1502,6 +1502,10 @@ class BandStructure { CPRefBand method_Exceptions_RC = method_attr_bands.newCPRefBand("method_Exceptions_RC", CONSTANT_Class); CPRefBand method_Signature_RS = method_attr_bands.newCPRefBand("method_Signature_RS", CONSTANT_Signature); MultiBand method_metadata_bands = method_attr_bands.newMultiBand("(method_metadata_bands)", UNSIGNED5); + // band for predefine method parameters + IntBand method_MethodParameters_NB = method_attr_bands.newIntBand("method_MethodParameters_NB", BYTE1); + CPRefBand method_MethodParameters_name_RUN = method_attr_bands.newCPRefBand("method_MethodParameters_name_RUN", UNSIGNED5, CONSTANT_Utf8, NULL_IS_OK); + IntBand method_MethodParameters_flag_I = method_attr_bands.newIntBand("method_MethodParameters_flag_I"); MultiBand class_attr_bands = class_bands.newMultiBand("(class_attr_bands)", UNSIGNED5); IntBand class_flags_hi = class_attr_bands.newIntBand("class_flags_hi"); @@ -1768,6 +1772,13 @@ class BandStructure { method_Exceptions_RC }, "Exceptions", "NH[RCH]"); + predefineAttribute(METHOD_ATTR_MethodParameters, ATTR_CONTEXT_METHOD, + new Band[]{ + method_MethodParameters_NB, + method_MethodParameters_name_RUN, + method_MethodParameters_flag_I + }, + "MethodParameters", "NB[RUNHI]"); assert(attrCodeEmpty == Package.attrCodeEmpty); predefineAttribute(X_ATTR_Signature, ATTR_CONTEXT_METHOD, new Band[] { method_Signature_RS }, diff --git a/src/share/classes/com/sun/java/util/jar/pack/Constants.java b/src/share/classes/com/sun/java/util/jar/pack/Constants.java index b5c1d124ef6321cf8567268916faac001039f76a..158826243811918e489f3ca2062399e053f581f6 100644 --- a/src/share/classes/com/sun/java/util/jar/pack/Constants.java +++ b/src/share/classes/com/sun/java/util/jar/pack/Constants.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -73,6 +73,9 @@ class Constants { public final static Package.Version JAVA7_PACKAGE_VERSION = Package.Version.of(170, 1); + public final static Package.Version JAVA8_PACKAGE_VERSION = + Package.Version.of(171, 0); + // upper limit, should point to the latest class version public final static Package.Version JAVA_MAX_CLASS_VERSION = JAVA8_MAX_CLASS_VERSION; @@ -158,6 +161,7 @@ class Constants { METHOD_ATTR_RuntimeInvisibleParameterAnnotations = 24, CLASS_ATTR_ClassFile_version = 24, METHOD_ATTR_AnnotationDefault = 25, + METHOD_ATTR_MethodParameters = 26, CODE_ATTR_StackMapTable = 0, // new in Java 6 CODE_ATTR_LineNumberTable = 1, CODE_ATTR_LocalVariableTable = 2, diff --git a/src/share/classes/com/sun/java/util/jar/pack/PackageReader.java b/src/share/classes/com/sun/java/util/jar/pack/PackageReader.java index 26bade85c5d1571ba4d039fcf66ac49308871b26..319b87933477bcced996f1408b5f050d70a298aa 100644 --- a/src/share/classes/com/sun/java/util/jar/pack/PackageReader.java +++ b/src/share/classes/com/sun/java/util/jar/pack/PackageReader.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -242,6 +242,7 @@ class PackageReader extends BandStructure { void checkArchiveVersion() throws IOException { Package.Version versionFound = null; for (Package.Version v : new Package.Version[] { + JAVA8_PACKAGE_VERSION, JAVA7_PACKAGE_VERSION, JAVA6_PACKAGE_VERSION, JAVA5_PACKAGE_VERSION @@ -252,7 +253,9 @@ class PackageReader extends BandStructure { } } if (versionFound == null) { - String expVer = JAVA7_PACKAGE_VERSION.toString() + String expVer = JAVA8_PACKAGE_VERSION.toString() + + "OR" + + JAVA7_PACKAGE_VERSION.toString() + " OR " + JAVA6_PACKAGE_VERSION.toString() + " OR " @@ -1516,6 +1519,9 @@ class PackageReader extends BandStructure { // method_metadata_bands // *method_Exceptions_N :UNSIGNED5 // *method_Exceptions_RC :UNSIGNED5 (cp_Class) + // *method_MethodParameters_NB: BYTE1 + // *method_MethodParameters_RUN: UNSIGNED5 (cp_Utf8) + // *method_MethodParameters_I: UNSIGNED5 (flag) // // code_attr_bands: // *code_flags :UNSIGNED5 diff --git a/src/share/classes/com/sun/java/util/jar/pack/PackageWriter.java b/src/share/classes/com/sun/java/util/jar/pack/PackageWriter.java index 78754b5c72b44acbf5b92ef305643ba6a73f727c..e69904511350361ef3a52d01aa5a89d1db4daf68 100644 --- a/src/share/classes/com/sun/java/util/jar/pack/PackageWriter.java +++ b/src/share/classes/com/sun/java/util/jar/pack/PackageWriter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -142,12 +142,14 @@ class PackageWriter extends BandStructure { } else if (highV.equals(JAVA6_MAX_CLASS_VERSION) || (highV.equals(JAVA7_MAX_CLASS_VERSION) && !pkg.cp.haveExtraTags())) { // force down the package version if we have jdk7 classes without - // any Indy references, this is because jdk7 class file (52.0) without - // Indy is identical to jdk6 class file (51.0). + // any Indy references, this is because jdk7 class file (51.0) without + // Indy is identical to jdk6 class file (50.0). packageVersion = JAVA6_PACKAGE_VERSION; + } else if (highV.equals(JAVA7_MAX_CLASS_VERSION)) { + packageVersion = JAVA7_PACKAGE_VERSION; } else { // Normal case. Use the newest archive format, when available - packageVersion = JAVA7_PACKAGE_VERSION; + packageVersion = JAVA8_PACKAGE_VERSION; } if (verbose > 0) { diff --git a/src/share/native/com/sun/java/util/jar/pack/bands.cpp b/src/share/native/com/sun/java/util/jar/pack/bands.cpp index 08cdc8d3e76030218928e39f0261daa6450acf57..8ad5e556c4176518165ae3383abe0344f701a46a 100644 --- a/src/share/native/com/sun/java/util/jar/pack/bands.cpp +++ b/src/share/native/com/sun/java/util/jar/pack/bands.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -352,6 +352,9 @@ const band_init all_band_inits[] = { BAND_INIT(method_Exceptions_RC, UNSIGNED5_spec, INDEX(CONSTANT_Class)), BAND_INIT(method_Signature_RS, UNSIGNED5_spec, INDEX(CONSTANT_Signature)), BAND_INIT(method_metadata_bands, -1, -1), + BAND_INIT(method_MethodParameters_NB, BYTE1_spec, 0), + BAND_INIT(method_MethodParameters_name_RUN, UNSIGNED5_spec, NULL_OR_INDEX(CONSTANT_Utf8)), + BAND_INIT(method_MethodParameters_flag_I, UNSIGNED5_spec, 0), BAND_INIT(method_attr_bands, -1, -1), BAND_INIT(class_flags_hi, UNSIGNED5_spec, 0), BAND_INIT(class_flags_lo, UNSIGNED5_spec, 0), diff --git a/src/share/native/com/sun/java/util/jar/pack/bands.h b/src/share/native/com/sun/java/util/jar/pack/bands.h index b8e322aa1db7ec65f4e2a0b0e466999be4fa2047..c555936d02e0623f92991f9fc45b2ec8d6e863da 100644 --- a/src/share/native/com/sun/java/util/jar/pack/bands.h +++ b/src/share/native/com/sun/java/util/jar/pack/bands.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -212,6 +212,9 @@ enum band_number { e_method_Exceptions_RC, e_method_Signature_RS, e_method_metadata_bands, + e_method_MethodParameters_NB, + e_method_MethodParameters_name_RUN, + e_method_MethodParameters_flag_I, e_method_attr_bands, e_class_flags_hi, @@ -388,6 +391,9 @@ enum band_number { #define method_Exceptions_N all_bands[e_method_Exceptions_N] #define method_Exceptions_RC all_bands[e_method_Exceptions_RC] #define method_Signature_RS all_bands[e_method_Signature_RS] +#define method_MethodParameters_NB all_bands[e_method_MethodParameters_NB] +#define method_MethodParameters_name_RUN all_bands[e_method_MethodParameters_name_RUN] +#define method_MethodParameters_flag_I all_bands[e_method_MethodParameters_flag_I] #define method_attr_bands all_bands[e_method_attr_bands] #define class_flags_hi all_bands[e_class_flags_hi] #define class_flags_lo all_bands[e_class_flags_lo] diff --git a/src/share/native/com/sun/java/util/jar/pack/constants.h b/src/share/native/com/sun/java/util/jar/pack/constants.h index dde13b8625b2f2763d94f217059ed01185ce11b4..040d8edd55b190e120ee72d4bd5e8d36fb411f8f 100644 --- a/src/share/native/com/sun/java/util/jar/pack/constants.h +++ b/src/share/native/com/sun/java/util/jar/pack/constants.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -59,6 +59,9 @@ #define JAVA7_PACKAGE_MAJOR_VERSION 170 #define JAVA7_PACKAGE_MINOR_VERSION 1 +#define JAVA8_PACKAGE_MAJOR_VERSION 171 +#define JAVA8_PACKAGE_MINOR_VERSION 0 + // magic number for gzip streams (for processing pack200-gzip data) #define GZIP_MAGIC 0x1F8B0800 #define GZIP_MAGIC_MASK 0xFFFFFF00 // last byte is variable "flg" field @@ -120,6 +123,7 @@ enum { METHOD_ATTR_RuntimeVisibleParameterAnnotations = 23, METHOD_ATTR_RuntimeInvisibleParameterAnnotations = 24, METHOD_ATTR_AnnotationDefault = 25, + METHOD_ATTR_MethodParameters = 26, CODE_ATTR_StackMapTable = 0, CODE_ATTR_LineNumberTable = 1, CODE_ATTR_LocalVariableTable = 2, @@ -160,6 +164,7 @@ enum { F(METHOD_ATTR_RuntimeVisibleParameterAnnotations,RuntimeVisibleParameterAnnotations) \ F(METHOD_ATTR_RuntimeInvisibleParameterAnnotations,RuntimeInvisibleParameterAnnotations) \ F(METHOD_ATTR_AnnotationDefault,AnnotationDefault) \ + F(METHOD_ATTR_MethodParameters,MethodParameters) \ /*(end)*/ #define CODE_ATTR_DO(F) \ F(CODE_ATTR_StackMapTable,StackMapTable) \ diff --git a/src/share/native/com/sun/java/util/jar/pack/main.cpp b/src/share/native/com/sun/java/util/jar/pack/main.cpp index 1f0d0d2f3f188e84d348e20ca573f4f6f4bd04b7..6fbc43a18aef5365ad7c43c30c7e241a06103c21 100644 --- a/src/share/native/com/sun/java/util/jar/pack/main.cpp +++ b/src/share/native/com/sun/java/util/jar/pack/main.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -71,7 +71,7 @@ NOT_PRODUCT(static THRTYPE uThread = -1;) unpacker* unpacker::non_mt_current = null; unpacker* unpacker::current() { - assert(uThread == THREAD_SELF); + //assert(uThread == THREAD_SELF); return non_mt_current; } static void set_current_unpacker(unpacker* u) { diff --git a/src/share/native/com/sun/java/util/jar/pack/unpack.cpp b/src/share/native/com/sun/java/util/jar/pack/unpack.cpp index d7c51978ded07e0d34212ea2f94630f4a70fb376..bc91827f66c4a94f97bfe961e70aa3b3eeffbcee 100644 --- a/src/share/native/com/sun/java/util/jar/pack/unpack.cpp +++ b/src/share/native/com/sun/java/util/jar/pack/unpack.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -648,13 +648,14 @@ void unpacker::read_file_header() { majver = hdr.getInt(); hdrVals += 2; - int majmin[3][2] = { + int majmin[4][2] = { {JAVA5_PACKAGE_MAJOR_VERSION, JAVA5_PACKAGE_MINOR_VERSION}, {JAVA6_PACKAGE_MAJOR_VERSION, JAVA6_PACKAGE_MINOR_VERSION}, - {JAVA7_PACKAGE_MAJOR_VERSION, JAVA7_PACKAGE_MINOR_VERSION} + {JAVA7_PACKAGE_MAJOR_VERSION, JAVA7_PACKAGE_MINOR_VERSION}, + {JAVA8_PACKAGE_MAJOR_VERSION, JAVA8_PACKAGE_MINOR_VERSION} }; int majminfound = false; - for (int i = 0 ; i < 3 ; i++) { + for (int i = 0 ; i < 4 ; i++) { if (majver == majmin[i][0] && minver == majmin[i][1]) { majminfound = true; break; @@ -663,11 +664,12 @@ void unpacker::read_file_header() { if (majminfound == null) { char message[200]; sprintf(message, "@" ERROR_FORMAT ": magic/ver = " - "%08X/%d.%d should be %08X/%d.%d OR %08X/%d.%d OR %08X/%d.%d\n", + "%08X/%d.%d should be %08X/%d.%d OR %08X/%d.%d OR %08X/%d.%d OR %08X/%d.%d\n", magic, majver, minver, JAVA_PACKAGE_MAGIC, JAVA5_PACKAGE_MAJOR_VERSION, JAVA5_PACKAGE_MINOR_VERSION, JAVA_PACKAGE_MAGIC, JAVA6_PACKAGE_MAJOR_VERSION, JAVA6_PACKAGE_MINOR_VERSION, - JAVA_PACKAGE_MAGIC, JAVA7_PACKAGE_MAJOR_VERSION, JAVA7_PACKAGE_MINOR_VERSION); + JAVA_PACKAGE_MAGIC, JAVA7_PACKAGE_MAJOR_VERSION, JAVA7_PACKAGE_MINOR_VERSION, + JAVA_PACKAGE_MAGIC, JAVA8_PACKAGE_MAJOR_VERSION, JAVA8_PACKAGE_MINOR_VERSION); abort(message); } CHECK; @@ -2481,6 +2483,13 @@ void unpacker::read_attrs(int attrc, int obj_count) { ad.readBandData(METHOD_ATTR_RuntimeInvisibleParameterAnnotations); ad.readBandData(METHOD_ATTR_AnnotationDefault); CHECK; + + count = ad.predefCount(METHOD_ATTR_MethodParameters); + method_MethodParameters_NB.readData(count); + count = method_MethodParameters_NB.getIntTotal(); + method_MethodParameters_name_RUN.readData(count); + method_MethodParameters_flag_I.readData(count); + CHECK; break; case ATTR_CONTEXT_CODE: @@ -4417,6 +4426,15 @@ int unpacker::write_attrs(int attrc, julong indexBits) { } break; + case ADH_BYTE(ATTR_CONTEXT_METHOD, METHOD_ATTR_MethodParameters): + aname = cp.sym[cpool::s_MethodParameters]; + putu1(count = method_MethodParameters_NB.getByte()); + for (j = 0; j < count; j++) { + putref(method_MethodParameters_name_RUN.getRefN()); + putu4(method_MethodParameters_flag_I.getInt()); + } + break; + case ADH_BYTE(ATTR_CONTEXT_CODE, CODE_ATTR_StackMapTable): aname = cp.sym[cpool::s_StackMapTable]; // (keep this code aligned with its brother in unpacker::read_attrs) diff --git a/test/ProblemList.txt b/test/ProblemList.txt index 6929924565e6a17120ed0650039620c133b169cc..8191d5f0b91bb28342fcf411b69de2535c01284d 100644 --- a/test/ProblemList.txt +++ b/test/ProblemList.txt @@ -321,9 +321,6 @@ tools/pack200/Pack200Test.java generic-all # 7150569 tools/launcher/UnicodeTest.java macosx-all -# 8005252 -tools/pack200/AttributeTests.java generic-all - ############################################################################ # jdk_jdi diff --git a/test/tools/pack200/AttributeTests.java b/test/tools/pack200/AttributeTests.java index 695470830257bd72d65ba757db0874c57e929a86..d4a40a90cc59d85b83a0954eb651d0771a11fd67 100644 --- a/test/tools/pack200/AttributeTests.java +++ b/test/tools/pack200/AttributeTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,13 +21,15 @@ * questions. */ import java.io.File; -import java.io.IOException; +import java.nio.charset.Charset; +import java.nio.file.Files; import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import static java.nio.file.StandardOpenOption.*; /* * @test - * @bug 6746111 + * @bug 6746111 8005252 * @summary tests various classfile format and attribute handling by pack200 * @compile -XDignore.symbol.file Utils.java AttributeTests.java * @run main AttributeTests @@ -37,8 +39,46 @@ public class AttributeTests { public static void main(String... args) throws Exception { test6746111(); + testMethodParameters(); } + /* + * this tests ensure that MethodParameters produces by javac is packed + * correctly. Usually this is not the case as new attributes are available + * in the sdk jars, since MethodParameters happens to be an optional + * attribute, thus this test. + */ + static void testMethodParameters() throws Exception { + List scratch = new ArrayList<>(); + final String fname = "MP"; + String javaFileName = fname + Utils.JAVA_FILE_EXT; + String javaClassName = fname + Utils.CLASS_FILE_EXT; + scratch.add("class " + fname + " {"); + scratch.add("void foo2(int j, final int k){}"); + scratch.add("}"); + File cwd = new File("."); + File javaFile = new File(cwd, javaFileName); + Files.write(javaFile.toPath(), scratch, Charset.defaultCharset(), + CREATE, TRUNCATE_EXISTING); + + Utils.compiler(javaFile.getName(), "-parameters"); + + // jar the file up + File testjarFile = new File(cwd, "test" + Utils.JAR_FILE_EXT); + Utils.jar("cvf", testjarFile.getName(), javaClassName); + + // pack using --repack + File outjarFile = new File(cwd, "out" + Utils.JAR_FILE_EXT); + scratch.clear(); + scratch.add(Utils.getPack200Cmd()); + scratch.add("--repack"); + scratch.add("--unknown-attribute=error"); + scratch.add(outjarFile.getName()); + scratch.add(testjarFile.getName()); + Utils.runExec(scratch); + + Utils.doCompareVerify(testjarFile, outjarFile); + } /* * this test checks to see if we get the expected strings for output */ diff --git a/test/tools/pack200/pack200-verifier/src/xmlkit/ClassReader.java b/test/tools/pack200/pack200-verifier/src/xmlkit/ClassReader.java index 0579b5b99cdbfbb846367bb3b5c91f101e550c0d..177849872a990fe4784ea4fbd5cc89cb5c1d3e87 100644 --- a/test/tools/pack200/pack200-verifier/src/xmlkit/ClassReader.java +++ b/test/tools/pack200/pack200-verifier/src/xmlkit/ClassReader.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -53,6 +53,7 @@ import com.sun.tools.classfile.LineNumberTable_attribute; import com.sun.tools.classfile.LocalVariableTable_attribute; import com.sun.tools.classfile.LocalVariableTypeTable_attribute; import com.sun.tools.classfile.Method; +import com.sun.tools.classfile.MethodParameters_attribute; import com.sun.tools.classfile.Opcode; import com.sun.tools.classfile.RuntimeInvisibleAnnotations_attribute; import com.sun.tools.classfile.RuntimeInvisibleParameterAnnotations_attribute; @@ -1073,6 +1074,19 @@ class AttributeVisitor implements Attribute.Visitor { return null; // already added to parent } + @Override + public Element visitMethodParameters(MethodParameters_attribute mp, Element p) { + String name = x.getCpString(mp.attribute_name_index); + for (MethodParameters_attribute.Entry e : mp.method_parameter_table) { + Element l = new Element(name); + l.setAttr("name", x.getCpString(e.name_index)); + l.setAttr("flag", "" + e.flags); + l.trimToSize(); + p.add(l); + } + return null; // already added to parent + } + private void parseAnnotations(Annotation[] ra, Element p) { for (Annotation anno : ra) { Element ea = new Element("Member");