jdk/src/java.instrument/share/classes/sun/instrument/TransformerManager.java
author alanb
Fri, 07 Apr 2017 08:05:54 +0000
changeset 44545 83b611b88ac8
parent 39739 5d058d6bd245
permissions -rw-r--r--
8177530: Module system implementation refresh (4/2017) Reviewed-by: mchung, alanb Contributed-by: alan.bateman@oracle.com, mandy.chung@oracle.com
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
36511
9d0388c6b336 8142968: Module System implementation
alanb
parents: 25859
diff changeset
     2
 * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
package sun.instrument;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
import java.lang.instrument.Instrumentation;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
import java.lang.instrument.ClassFileTransformer;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
import java.security.ProtectionDomain;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
 * Copyright 2003 Wily Technology, Inc.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
 * Support class for the InstrumentationImpl. Manages the list of registered transformers.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
 * Keeps everything in the right order, deals with sync of the list,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
 * and actually does the calling of the transformers.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
public class TransformerManager
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
    private class TransformerInfo {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
        final ClassFileTransformer  mTransformer;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
        String                      mPrefix;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
        TransformerInfo(ClassFileTransformer transformer) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
            mTransformer = transformer;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
            mPrefix = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
        ClassFileTransformer transformer() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
            return  mTransformer;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
        String getPrefix() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
            return mPrefix;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
        void setPrefix(String prefix) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
            mPrefix = prefix;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
     * a given instance of this list is treated as immutable to simplify sync;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
     * we pay copying overhead whenever the list is changed rather than every time
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
     * the list is referenced.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
     * The array is kept in the order the transformers are added via addTransformer
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
     * (first added is 0, last added is length-1)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
     * Use an array, not a List or other Collection. This keeps the set of classes
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
     * used by this code to a minimum. We want as few dependencies as possible in this
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
     * code, since it is used inside the class definition system. Any class referenced here
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
     * cannot be transformed by Java code.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
    private TransformerInfo[]  mTransformerList;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
    /***
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
     * Is this TransformerManager for transformers capable of retransformation?
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
    private boolean            mIsRetransformable;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
    TransformerManager(boolean isRetransformable) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
        mTransformerList    = new TransformerInfo[0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
        mIsRetransformable  = isRetransformable;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
    boolean isRetransformable() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
        return mIsRetransformable;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
    public synchronized void
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
    addTransformer( ClassFileTransformer    transformer) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
        TransformerInfo[] oldList = mTransformerList;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
        TransformerInfo[] newList = new TransformerInfo[oldList.length + 1];
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
        System.arraycopy(   oldList,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
                            0,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
                            newList,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
                            0,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
                            oldList.length);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
        newList[oldList.length] = new TransformerInfo(transformer);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
        mTransformerList = newList;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
    public synchronized boolean
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
    removeTransformer(ClassFileTransformer  transformer) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
        boolean                 found           = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
        TransformerInfo[]       oldList         = mTransformerList;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
        int                     oldLength       = oldList.length;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
        int                     newLength       = oldLength - 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
        // look for it in the list, starting at the last added, and remember
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
        // where it was if we found it
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
        int matchingIndex   = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
        for ( int x = oldLength - 1; x >= 0; x-- ) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
            if ( oldList[x].transformer() == transformer ) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
                found           = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
                matchingIndex   = x;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
                break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
        // make a copy of the array without the matching element
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
        if ( found ) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
            TransformerInfo[]  newList = new TransformerInfo[newLength];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
            // copy up to but not including the match
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
            if ( matchingIndex > 0 ) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
                System.arraycopy(   oldList,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
                                    0,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
                                    newList,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
                                    0,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
                                    matchingIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
            // if there is anything after the match, copy it as well
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
            if ( matchingIndex < (newLength) ) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
                System.arraycopy(   oldList,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
                                    matchingIndex + 1,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
                                    newList,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
                                    matchingIndex,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
                                    (newLength) - matchingIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
            mTransformerList = newList;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
        return found;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
    synchronized boolean
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
    includesTransformer(ClassFileTransformer transformer) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
        for (TransformerInfo info : mTransformerList) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
            if ( info.transformer() == transformer ) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
                return true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
        return false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
    // This function doesn't actually snapshot anything, but should be
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
    // used to set a local variable, which will snapshot the transformer
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
    // list because of the copying semantics of mTransformerList (see
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
    // the comment for mTransformerList).
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
    private TransformerInfo[]
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
    getSnapshotTransformerList() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
        return mTransformerList;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
    public byte[]
36511
9d0388c6b336 8142968: Module System implementation
alanb
parents: 25859
diff changeset
   169
    transform(  Module              module,
39739
5d058d6bd245 8159147: Add ClassLoader parameter to new ClassFileTransformer transform method
sspitsyn
parents: 36511
diff changeset
   170
                ClassLoader         loader,
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
                String              classname,
11125
99b115114fa3 7117357: Warnings in sun.instrument, tools and other sun.* classes
alanb
parents: 5506
diff changeset
   172
                Class<?>            classBeingRedefined,
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
                ProtectionDomain    protectionDomain,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
                byte[]              classfileBuffer) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
        boolean someoneTouchedTheBytecode = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
        TransformerInfo[]  transformerList = getSnapshotTransformerList();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
        byte[]  bufferToUse = classfileBuffer;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
        // order matters, gotta run 'em in the order they were added
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
        for ( int x = 0; x < transformerList.length; x++ ) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
            TransformerInfo         transformerInfo = transformerList[x];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
            ClassFileTransformer    transformer = transformerInfo.transformer();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
            byte[]                  transformedBytes = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
            try {
36511
9d0388c6b336 8142968: Module System implementation
alanb
parents: 25859
diff changeset
   188
                transformedBytes = transformer.transform(   module,
39739
5d058d6bd245 8159147: Add ClassLoader parameter to new ClassFileTransformer transform method
sspitsyn
parents: 36511
diff changeset
   189
                                                            loader,
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
                                                            classname,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
                                                            classBeingRedefined,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
                                                            protectionDomain,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
                                                            bufferToUse);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
            catch (Throwable t) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
                // don't let any one transformer mess it up for the others.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
                // This is where we need to put some logging. What should go here? FIXME
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
            if ( transformedBytes != null ) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
                someoneTouchedTheBytecode = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
                bufferToUse = transformedBytes;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
        // if someone modified it, return the modified buffer.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
        // otherwise return null to mean "no transforms occurred"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
        byte [] result;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
        if ( someoneTouchedTheBytecode ) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
            result = bufferToUse;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
        else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
            result = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
        return result;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
    int
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
    getTransformerCount() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
        TransformerInfo[]  transformerList = getSnapshotTransformerList();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
        return transformerList.length;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
    boolean
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
    setNativeMethodPrefix(ClassFileTransformer transformer, String prefix) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
        TransformerInfo[]  transformerList = getSnapshotTransformerList();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
        for ( int x = 0; x < transformerList.length; x++ ) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
            TransformerInfo         transformerInfo = transformerList[x];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
            ClassFileTransformer    aTransformer = transformerInfo.transformer();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
            if ( aTransformer == transformer ) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
                transformerInfo.setPrefix(prefix);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
                return true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
        return false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
    String[]
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
    getNativeMethodPrefixes() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
        TransformerInfo[]  transformerList = getSnapshotTransformerList();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
        String[] prefixes                  = new String[transformerList.length];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
        for ( int x = 0; x < transformerList.length; x++ ) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
            TransformerInfo         transformerInfo = transformerList[x];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
            prefixes[x] = transformerInfo.getPrefix();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
        return prefixes;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
}