test/hotspot/jtreg/runtime/RedefineTests/RedefineAnnotations.java
changeset 52515 746df0ae4fe1
parent 47216 71c04702a3d5
equal deleted inserted replaced
52514:f4e3900c8d08 52515:746df0ae4fe1
     1 /*
     1 /*
     2  * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
    61 import java.util.Map;
    61 import java.util.Map;
    62 import jdk.internal.org.objectweb.asm.ClassReader;
    62 import jdk.internal.org.objectweb.asm.ClassReader;
    63 import jdk.internal.org.objectweb.asm.ClassVisitor;
    63 import jdk.internal.org.objectweb.asm.ClassVisitor;
    64 import jdk.internal.org.objectweb.asm.ClassWriter;
    64 import jdk.internal.org.objectweb.asm.ClassWriter;
    65 import jdk.internal.org.objectweb.asm.FieldVisitor;
    65 import jdk.internal.org.objectweb.asm.FieldVisitor;
    66 import static jdk.internal.org.objectweb.asm.Opcodes.ASM5;
    66 import static jdk.internal.org.objectweb.asm.Opcodes.ASM7;
    67 
    67 
    68 @Retention(RetentionPolicy.RUNTIME)
    68 @Retention(RetentionPolicy.RUNTIME)
    69 @Target(ElementType.TYPE_USE)
    69 @Target(ElementType.TYPE_USE)
    70 @interface TestAnn {
    70 @interface TestAnn {
    71     String site();
    71     String site();
    83                 Class<?> classBeingRedefined,
    83                 Class<?> classBeingRedefined,
    84                 ProtectionDomain protectionDomain, byte[] classfileBuffer)
    84                 ProtectionDomain protectionDomain, byte[] classfileBuffer)
    85             throws IllegalClassFormatException {
    85             throws IllegalClassFormatException {
    86 
    86 
    87             ClassWriter cw = new ClassWriter(0);
    87             ClassWriter cw = new ClassWriter(0);
    88             ClassVisitor cv = new ReAddDummyFieldsClassVisitor(ASM5, cw) { };
    88             ClassVisitor cv = new ReAddDummyFieldsClassVisitor(ASM7, cw) { };
    89             ClassReader cr = new ClassReader(classfileBuffer);
    89             ClassReader cr = new ClassReader(classfileBuffer);
    90             cr.accept(cv, 0);
    90             cr.accept(cv, 0);
    91             return cw.toByteArray();
    91             return cw.toByteArray();
    92         }
    92         }
    93 
    93