RFR 8176147: JVM should throw CFE for duplicate Signature attributes

David Holmes david.holmes at oracle.com
Wed Mar 8 02:23:38 UTC 2017


Sorry just noticed something minor ...

For the class signature attribute you could just check if 
_generic_signature_index == 0 instead of adding the local 
signature_exists flag.

David

On 8/03/2017 12:13 PM, David Holmes wrote:
> Hi Harold,
>
> Changes look good.
>
> To avoid duplication in the tests I've been using this pattern for the
> JDK 10 work I'm doing that's checking classfile format:
>
>      public static void main(String args[]) throws Throwable {
>          String[] badClasses = new String[] {
>              "class1",
>              "class2",
>              "class3",
>          };
>          String[] messages = new String[] {
>              "message1",
>              "message2",
>              "message3",
>          };
>
>          for (int i = 0; i < badClasses.length; i++ ) {
>              try {
>                  Class c = Class.forName(badClasses[i]);
>                  throw new Error("Missing ClassFormatError: " +
> messages[i]);
>              }
>              catch (ClassFormatError expected) {
>                  if (!expected.getMessage().contains(messages[i]))
>                     throw new Error("Wrong ClassFormatError message: \"" +
>                                     expected.getMessage() + "\" does not
> contain \"" +
>                                     messages[i] + "\"");
>                  System.out.println("OK - got expected exception: " +
> expected);
>              }
>          }
>      }
>
> Cheers,
> David
>
> On 7/03/2017 11:52 PM, harold seigel wrote:
>> Hi,
>>
>> Please review this JDK-9 fix to throw a ClassFormatError exception if
>> the attributes table for a class, field, or method contains more than
>> one Signature attribute.
>>
>> Open webrev: http://cr.openjdk.java.net/~hseigel/bug_8176147/webrev/
>>
>> JBS Bug: https://bugs.openjdk.java.net/browse/JDK-8176147
>>
>> The fix was tested with the JCK lang and vm tests, the JTreg hotspot,
>> java/io, java/lang, java/util and other tests, the RBT tier2 -tier5
>> tests, the colocated and non-colocated NSK tests, and with JPRT.
>>
>> Thanks, Harold
>>


More information about the hotspot-runtime-dev mailing list