# HG changeset patch # User acorn # Date 1364427060 25200 # Node ID 53f4040e809cf10b259dcd1f014761b8011a05e0 # Parent b601102d00c80dc1d7508c2574f000c6a9d8e7d4# Parent cd3089a5643844d0f219a0da5406787ebf89902c Merge diff -r cd3089a56438 -r 53f4040e809c src/share/vm/oops/constMethod.cpp --- a/src/share/vm/oops/constMethod.cpp Wed Mar 27 14:10:59 2013 -0400 +++ b/src/share/vm/oops/constMethod.cpp Wed Mar 27 16:31:00 2013 -0700 @@ -363,6 +363,26 @@ return (AnnotationArray**)constMethod_end() - offset; } +// copy annotations from 'cm' to 'this' +void ConstMethod::copy_annotations_from(ConstMethod* cm) { + if (cm->has_method_annotations()) { + assert(has_method_annotations(), "should be allocated already"); + set_method_annotations(cm->method_annotations()); + } + if (cm->has_parameter_annotations()) { + assert(has_parameter_annotations(), "should be allocated already"); + set_parameter_annotations(cm->parameter_annotations()); + } + if (cm->has_type_annotations()) { + assert(has_type_annotations(), "should be allocated already"); + set_type_annotations(cm->type_annotations()); + } + if (cm->has_default_annotations()) { + assert(has_default_annotations(), "should be allocated already"); + set_default_annotations(cm->default_annotations()); + } +} + // Printing void ConstMethod::print_on(outputStream* st) const { diff -r cd3089a56438 -r 53f4040e809c src/share/vm/oops/constMethod.hpp --- a/src/share/vm/oops/constMethod.hpp Wed Mar 27 14:10:59 2013 -0400 +++ b/src/share/vm/oops/constMethod.hpp Wed Mar 27 16:31:00 2013 -0700 @@ -441,6 +441,9 @@ return has_default_annotations() ? default_annotations()->length() : 0; } + // Copy annotations from other ConstMethod + void copy_annotations_from(ConstMethod* cm); + // byte codes void set_code(address code) { if (code_size() > 0) { diff -r cd3089a56438 -r 53f4040e809c src/share/vm/oops/method.cpp --- a/src/share/vm/oops/method.cpp Wed Mar 27 14:10:59 2013 -0400 +++ b/src/share/vm/oops/method.cpp Wed Mar 27 16:31:00 2013 -0700 @@ -1170,6 +1170,8 @@ newm->set_stackmap_data(stackmap_data); } + // copy annotations over to new method + newcm->copy_annotations_from(cm); return newm; } diff -r cd3089a56438 -r 53f4040e809c test/runtime/7116786/Test7116786.java --- a/test/runtime/7116786/Test7116786.java Wed Mar 27 14:10:59 2013 -0400 +++ b/test/runtime/7116786/Test7116786.java Wed Mar 27 16:31:00 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 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 @@ -338,9 +338,12 @@ "invalid constant pool index in ldc", "Invalid index in ldc"), - new Case("case58", "verifier.cpp", true, "verify_switch", + /* No longer a valid test case for bytecode version >= 51. Nonzero + * padding bytes are permitted with lookupswitch and tableswitch + * bytecodes as of JVMS 3d edition */ + new Case("case58", "verifier.cpp", false, "verify_switch", "bad switch padding", - "Nonzero padding byte in lookswitch or tableswitch"), + "Nonzero padding byte in lookupswitch or tableswitch"), new Case("case59", "verifier.cpp", true, "verify_switch", "tableswitch low is greater than high",