jdk/src/share/classes/com/sun/jdi/Method.java
author alanb
Wed, 09 Oct 2013 09:20:12 +0100
changeset 20742 4ae78e8060d6
parent 14342 8435a30053c1
child 23010 6dadb192ad81
permissions -rw-r--r--
8008662: Add @jdk.Exported to JDK-specific/exported APIs Reviewed-by: chegar, vinnie, dfuchs, mchung, mullan, darcy
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
14342
8435a30053c1 7197491: update copyright year to match last edit in jdk8 jdk repository
alanb
parents: 9266
diff changeset
     2
 * Copyright (c) 1998, 2011, 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 com.sun.jdi;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
import java.util.List;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
 * A static or instance method in the target VM. See {@link TypeComponent}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
 * for general information about Field and Method mirrors.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
 * @see ObjectReference
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
 * @see ReferenceType
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
 * @author Robert Field
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
 * @author Gordon Hirsch
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
 * @author James McIlree
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
 * @since  1.3
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
 */
20742
4ae78e8060d6 8008662: Add @jdk.Exported to JDK-specific/exported APIs
alanb
parents: 14342
diff changeset
    42
@jdk.Exported
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
public interface Method extends TypeComponent, Locatable, Comparable<Method> {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
     * Returns a text representation of the return type,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
     * as specified in the declaration of this method.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
     * This type name is always available even if
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
     * the type has not yet been created or loaded.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
     * @return a String containing the return type name.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
    String returnTypeName();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
     * Returns the return type,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
     * as specified in the declaration of this method.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
     * Note: if the return type of this method is a reference type (class,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
     * interface, or array) and it has not been created or loaded
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
     * by the declaring type's class loader - that is,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
     * {@link TypeComponent#declaringType <CODE>declaringType()</CODE>}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
     * <CODE>.classLoader()</CODE>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
     * then ClassNotLoadedException will be thrown.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
     * Also, a reference type may have been loaded but not yet prepared,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
     * in which case the type will be returned
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
     * but attempts to perform some operations on the returned type
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
     * (e.g. {@link ReferenceType#fields() fields()}) will throw
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
     * a {@link ClassNotPreparedException}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
     * Use {@link ReferenceType#isPrepared()} to determine if
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
     * a reference type is prepared.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
     * @see Type
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
     * @see Field#type() Field.type() - for usage examples
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
     * @return the return {@link Type} of this method.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
     * @throws ClassNotLoadedException if the type has not yet been
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
     * created or loaded
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
     * through the appropriate class loader.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
    Type returnType() throws ClassNotLoadedException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
     * Returns a list containing a text representation of the type
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
     * of each formal parameter of this method.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
     * This list is always available even if
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
     * the types have not yet been created or loaded.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
     * @return a {@link java.util.List List} of {@link String},
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
     * one List element for each parameter of this method.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
     * Each element represents the type of a formal parameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
     * as specified at compile-time.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
     * If the formal parameter was declared with an ellipsis, then
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
     * it is represented as an array of the type before the ellipsis.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
    List<String> argumentTypeNames();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
     * Returns a list containing the type
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
     * of each formal parameter of this method.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
     * Note: if there is any parameter whose type
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
     * is a reference type (class, interface, or array)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
     * and it has not been created or loaded
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
     * by the declaring type's class loader - that is,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
     * {@link TypeComponent#declaringType <CODE>declaringType()</CODE>}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
     * <CODE>.classLoader()</CODE>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
     * then ClassNotLoadedException will be thrown.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
     * Also, a reference type may have been loaded but not yet prepared,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
     * in which case the list will be returned
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
     * but attempts to perform some operations on the type
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
     * (e.g. {@link ReferenceType#fields() fields()}) will throw
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
     * a {@link ClassNotPreparedException}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
     * Use {@link ReferenceType#isPrepared()} to determine if
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
     * a reference type is prepared.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
     * @see Type
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
     * @return return a {@link java.util.List List} of {@link Type},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
     * one List element for each parameter of this method.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
     * Each element represents the type of a formal parameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
     * as specified at compile-time.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
     * If the formal parameter was declared with an ellipsis, then
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
     * it is represented as an array of the type before the ellipsis.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
     * @throws ClassNotLoadedException if the type has not yet been loaded
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
     * through the appropriate class loader.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
    List<Type> argumentTypes() throws ClassNotLoadedException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
     * Determine if this method is abstract.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
     * @return <code>true</code> if the method is declared abstract;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
     * false otherwise.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
    boolean isAbstract();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
     * Determine if this method is synchronized.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
     * @return <code>true</code> if the method is declared synchronized;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
     * false otherwise.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
    boolean isSynchronized();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
     * Determine if this method is native.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
     * @return <code>true</code> if the method is declared native;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
     * false otherwise.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
    boolean isNative();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
     * Determine if this method accepts a variable number of arguments.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
     * @return <code>true</code> if the method accepts a variable number
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
     * of arguments, false otherwise.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
     * @since 1.5
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
    boolean isVarArgs();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
     * Determine if this method is a bridge method. Bridge
9266
121fb370f179 7032960: API files in java.awt need to be updated for references to JVM Spec with editions/hyperlinks
jjh
parents: 5506
diff changeset
   168
     * methods are defined in
121fb370f179 7032960: API files in java.awt need to be updated for references to JVM Spec with editions/hyperlinks
jjh
parents: 5506
diff changeset
   169
     * <cite>The Java&trade; Language Specification</cite>.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
     * @return <code>true</code> if the method is a bridge method,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
     * false otherwise.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
     * @since 1.5
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
    boolean isBridge();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
     * Determine if this method is a constructor.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
     * @return <code>true</code> if the method is a constructor;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
     * false otherwise.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
    boolean isConstructor();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
     * Determine if this method is a static initializer.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
     * @return <code>true</code> if the method is a static initializer;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
     * false otherwise.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
    boolean isStaticInitializer();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
     * Determine if this method is obsolete.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
     * @return <code>true</code> if this method has been made obsolete by a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
     * {@link VirtualMachine#redefineClasses} operation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
     * @since 1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
    boolean isObsolete();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
     * Returns a list containing a {@link Location} object for
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
     * each executable source line in this method.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
     * This method is equivalent to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
     * <code>allLineLocations(vm.getDefaultStratum(),null)</code> -
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
     * see {@link #allLineLocations(String,String)}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
     * for more information.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
     * @return a List of all source line {@link Location} objects.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
     * @throws AbsentInformationException if there is no line
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
     * number information for this (non-native, non-abstract)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
     * method.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
    List<Location> allLineLocations() throws AbsentInformationException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
     * Returns a list containing a {@link Location} object for
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
     * each executable source line in this method.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
     * Each location maps a source line to a range of code
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
     * indices.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
     * The beginning of the range can be determined through
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
     * {@link Location#codeIndex}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
     * The returned list is ordered by code index
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
     * (from low to high).
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
     * The returned list may contain multiple locations for a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
     * particular line number, if the compiler and/or VM has
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
     * mapped that line to two or more disjoint code index ranges.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
     * If the method is native or abstract, an empty list is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
     * returned.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
     * Returned list is for the specified <i>stratum</i>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
     * (see {@link Location} for a description of strata).
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
     * @param stratum The stratum to retrieve information from
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
     * or <code>null</code> for the {@link ReferenceType#defaultStratum()}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
     * @param sourceName Return locations only within this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
     * source file or <code>null</code> to return locations.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
     * @return a List of all source line {@link Location} objects.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
     * @throws AbsentInformationException if there is no line
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
     * number information for this (non-native, non-abstract)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
     * method.  Or if <i>sourceName</i> is non-<code>null</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
     * and source name information is not present.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
     * @since 1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
    List<Location> allLineLocations(String stratum, String sourceName)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
        throws AbsentInformationException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
     * Returns a List containing all {@link Location} objects
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
     * that map to the given line number.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
     * This method is equivalent to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
     * <code>locationsOfLine(vm.getDefaultStratum(), null,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
     * lineNumber)</code> -
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
     * see {@link
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
     * #locationsOfLine(java.lang.String,java.lang.String,int)}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
     * for more information.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
     * @param lineNumber the line number
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
     * @return a List of {@link Location} objects that map to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
     * the given line number.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
     * @throws AbsentInformationException if there is no line
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
     * number information for this method.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
    List<Location> locationsOfLine(int lineNumber) throws AbsentInformationException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
     * Returns a List containing all {@link Location} objects
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
     * that map to the given line number and source name.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
     * Returns a list containing each {@link Location} that maps
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
     * to the given line. The returned list will contain a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
     * location for each disjoint range of code indices that have
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
     * been assigned to the given line by the compiler and/or
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
     * VM. Each returned location corresponds to the beginning of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
     * this range.  An empty list will be returned if there is no
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
     * executable code at the specified line number; specifically,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
     * native and abstract methods will always return an empty
90ce3da70b43 Initial load
duke
parents:
diff changeset
   293
     * list.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
     * Returned list is for the specified <i>stratum</i>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
     * (see {@link Location} for a description of strata).
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
     * @param stratum the stratum to use for comparing line number
90ce3da70b43 Initial load
duke
parents:
diff changeset
   299
     *                and source name, or null to use the default
90ce3da70b43 Initial load
duke
parents:
diff changeset
   300
     *                stratum
90ce3da70b43 Initial load
duke
parents:
diff changeset
   301
     * @param sourceName the source name containing the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
     *                   line number, or null to match all
90ce3da70b43 Initial load
duke
parents:
diff changeset
   303
     *                   source names
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
     * @param lineNumber the line number
90ce3da70b43 Initial load
duke
parents:
diff changeset
   305
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   306
     * @return a List of {@link Location} objects that map to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   307
     * the given line number.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   308
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   309
     * @throws AbsentInformationException if there is no line
90ce3da70b43 Initial load
duke
parents:
diff changeset
   310
     * number information for this method.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   311
     * Or if <i>sourceName</i> is non-<code>null</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   312
     * and source name information is not present.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   313
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   314
     * @since 1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
   315
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   316
    List<Location> locationsOfLine(String stratum, String sourceName,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   317
                                   int lineNumber)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   318
        throws AbsentInformationException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   319
90ce3da70b43 Initial load
duke
parents:
diff changeset
   320
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   321
     * Returns a {@link Location} for the given code index.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   322
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   323
     * @return the {@link Location} corresponding to the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   324
     * given code index or null if the specified code index is not a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   325
     * valid code index for this method (native and abstract methods
90ce3da70b43 Initial load
duke
parents:
diff changeset
   326
     * will always return null).
90ce3da70b43 Initial load
duke
parents:
diff changeset
   327
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   328
    Location locationOfCodeIndex(long codeIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   329
90ce3da70b43 Initial load
duke
parents:
diff changeset
   330
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   331
     * Returns a list containing each {@link LocalVariable} declared
90ce3da70b43 Initial load
duke
parents:
diff changeset
   332
     * in this method. The list includes any variable declared in any
90ce3da70b43 Initial load
duke
parents:
diff changeset
   333
     * scope within the method. It may contain multiple variables of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   334
     * same name declared within disjoint scopes. Arguments are considered
90ce3da70b43 Initial load
duke
parents:
diff changeset
   335
     * local variables and will be present in the returned list.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   336
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   337
     * If local variable information is not available, values of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   338
     * actual arguments to method invocations can be obtained
90ce3da70b43 Initial load
duke
parents:
diff changeset
   339
     * by using the method {@link StackFrame#getArgumentValues()}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   340
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   341
     * @return the list of {@link LocalVariable} objects which mirror
90ce3da70b43 Initial load
duke
parents:
diff changeset
   342
     * local variables declared in this method in the target VM.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   343
     * If there are no local variables, a zero-length list is returned.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   344
     * @throws AbsentInformationException if there is no variable
90ce3da70b43 Initial load
duke
parents:
diff changeset
   345
     * information for this method.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   346
     * Generally, local variable information is not available for
90ce3da70b43 Initial load
duke
parents:
diff changeset
   347
     * native or abstract methods (that is, their argument name
90ce3da70b43 Initial load
duke
parents:
diff changeset
   348
     * information is not available), thus they will throw this exception.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   349
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   350
    List<LocalVariable> variables() throws AbsentInformationException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   351
90ce3da70b43 Initial load
duke
parents:
diff changeset
   352
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   353
     * Returns a list containing each {@link LocalVariable} of a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   354
     * given name in this method.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   355
     * Multiple variables can be returned
90ce3da70b43 Initial load
duke
parents:
diff changeset
   356
     * if the same variable name is used in disjoint
90ce3da70b43 Initial load
duke
parents:
diff changeset
   357
     * scopes within the method.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   358
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   359
     * @return the list of {@link LocalVariable} objects of the given
90ce3da70b43 Initial load
duke
parents:
diff changeset
   360
     * name.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   361
     * If there are no matching local variables, a zero-length list
90ce3da70b43 Initial load
duke
parents:
diff changeset
   362
     * is returned.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   363
     * @throws AbsentInformationException if there is no variable
90ce3da70b43 Initial load
duke
parents:
diff changeset
   364
     * information for this method.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   365
     * Generally, local variable information is not available for
90ce3da70b43 Initial load
duke
parents:
diff changeset
   366
     * native or abstract methods (that is, their argument name
90ce3da70b43 Initial load
duke
parents:
diff changeset
   367
     * information is not available), thus they will throw this exception.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   368
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   369
    List<LocalVariable> variablesByName(String name)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   370
        throws AbsentInformationException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   371
90ce3da70b43 Initial load
duke
parents:
diff changeset
   372
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   373
     * Returns a list containing each {@link LocalVariable} that is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   374
     * declared as an argument of this method.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   375
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   376
     * If local variable information is not available, values of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   377
     * actual arguments to method invocations can be obtained
90ce3da70b43 Initial load
duke
parents:
diff changeset
   378
     * by using the method {@link StackFrame#getArgumentValues()}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   379
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   380
     * @return the list of {@link LocalVariable} arguments.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   381
     * If there are no arguments, a zero-length list is returned.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   382
     * @throws AbsentInformationException if there is no variable
90ce3da70b43 Initial load
duke
parents:
diff changeset
   383
     * information for this method.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   384
     * Generally, local variable information is not available for
90ce3da70b43 Initial load
duke
parents:
diff changeset
   385
     * native or abstract methods (that is, their argument name
90ce3da70b43 Initial load
duke
parents:
diff changeset
   386
     * information is not available), thus they will throw this exception.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   387
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   388
    List<LocalVariable> arguments() throws AbsentInformationException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   389
90ce3da70b43 Initial load
duke
parents:
diff changeset
   390
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   391
     * Returns an array containing the bytecodes for this method.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   392
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   393
     * Not all target virtual machines support this operation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   394
     * Use {@link VirtualMachine#canGetBytecodes()}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   395
     * to determine if the operation is supported.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   396
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   397
     * @return the array of bytecodes; abstract and native methods
90ce3da70b43 Initial load
duke
parents:
diff changeset
   398
     * will return a zero-length array.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   399
     * @throws java.lang.UnsupportedOperationException if
90ce3da70b43 Initial load
duke
parents:
diff changeset
   400
     * the target virtual machine does not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
   401
     * the retrieval of bytecodes.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   402
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   403
    byte[] bytecodes();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   404
90ce3da70b43 Initial load
duke
parents:
diff changeset
   405
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   406
     * Returns the {@link Location} of this method, if there
90ce3da70b43 Initial load
duke
parents:
diff changeset
   407
     * is executable code associated with it.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   408
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   409
     * @return the {@link Location} of this mirror, or null if
90ce3da70b43 Initial load
duke
parents:
diff changeset
   410
     * this is an abstract method; native methods will return a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   411
     * Location object whose codeIndex is -1.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   412
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   413
    Location location();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   414
90ce3da70b43 Initial load
duke
parents:
diff changeset
   415
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   416
     * Compares the specified Object with this method for equality.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   417
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   418
     * @return true if the Object is a method and if both
90ce3da70b43 Initial load
duke
parents:
diff changeset
   419
     * mirror the same method (declared in the same class or interface, in
90ce3da70b43 Initial load
duke
parents:
diff changeset
   420
     * the same VM).
90ce3da70b43 Initial load
duke
parents:
diff changeset
   421
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   422
    boolean equals(Object obj);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   423
90ce3da70b43 Initial load
duke
parents:
diff changeset
   424
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   425
     * Returns the hash code value for this Method.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   426
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   427
     * @return the integer hash code
90ce3da70b43 Initial load
duke
parents:
diff changeset
   428
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   429
    int hashCode();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   430
}