jdk/src/share/classes/com/sun/jdi/Method.java
author jbachorik
Tue, 29 Apr 2014 11:15:21 +0200
changeset 24125 b85eeaae56c7
parent 23010 6dadb192ad81
child 24127 5d05d4c0de7f
permissions -rw-r--r--
8031195: Support default and static interface methods in JDI, JDWP and JDB Reviewed-by: sla, sspitsyn, dcubed
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
23010
6dadb192ad81 8029235: Update copyright year to match last edit in jdk8 jdk repository for 2013
lana
parents: 20742
diff changeset
     2
 * Copyright (c) 1998, 2013, 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
    /**
24125
b85eeaae56c7 8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents: 23010
diff changeset
   141
     * Determine if this method is a default method
b85eeaae56c7 8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents: 23010
diff changeset
   142
     *
b85eeaae56c7 8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents: 23010
diff changeset
   143
     * @return <code>true</code> if the method is declared default;
b85eeaae56c7 8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents: 23010
diff changeset
   144
     * false otherwise
b85eeaae56c7 8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents: 23010
diff changeset
   145
     *
b85eeaae56c7 8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents: 23010
diff changeset
   146
     * @since 1.8
b85eeaae56c7 8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents: 23010
diff changeset
   147
     */
b85eeaae56c7 8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents: 23010
diff changeset
   148
    boolean isDefault();
b85eeaae56c7 8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents: 23010
diff changeset
   149
b85eeaae56c7 8031195: Support default and static interface methods in JDI, JDWP and JDB
jbachorik
parents: 23010
diff changeset
   150
    /**
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
     * Determine if this method is synchronized.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
     * @return <code>true</code> if the method is declared synchronized;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
     * false otherwise.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
    boolean isSynchronized();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
     * Determine if this method is native.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
     * @return <code>true</code> if the method is declared native;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
     * false otherwise.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
    boolean isNative();
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 accepts a variable number of arguments.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
     * @return <code>true</code> if the method accepts a variable number
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
     * of arguments, false otherwise.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
     * @since 1.5
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
    boolean isVarArgs();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
     * 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
   178
     * 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
   179
     * <cite>The Java&trade; Language Specification</cite>.
2
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 bridge method,
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
     * @since 1.5
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
    boolean isBridge();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
     * Determine if this method is a constructor.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
     * @return <code>true</code> if the method is a constructor;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
     * false otherwise.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
    boolean isConstructor();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
     * Determine if this method is a static initializer.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
     * @return <code>true</code> if the method is a static initializer;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
     * false otherwise.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
    boolean isStaticInitializer();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
     * Determine if this method is obsolete.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
     * @return <code>true</code> if this method has been made obsolete by a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
     * {@link VirtualMachine#redefineClasses} operation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
     * @since 1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
    boolean isObsolete();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
     * Returns a list containing a {@link Location} object for
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
     * each executable source line in this method.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
     * This method is equivalent to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
     * <code>allLineLocations(vm.getDefaultStratum(),null)</code> -
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
     * see {@link #allLineLocations(String,String)}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
     * for more information.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
     * @return a List of all source line {@link Location} objects.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
     * @throws AbsentInformationException if there is no line
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
     * number information for this (non-native, non-abstract)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
     * method.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
    List<Location> allLineLocations() throws AbsentInformationException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
     * Returns a list containing a {@link Location} object for
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
     * each executable source line in this method.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
     * Each location maps a source line to a range of code
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
     * indices.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
     * The beginning of the range can be determined through
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
     * {@link Location#codeIndex}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
     * The returned list is ordered by code index
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
     * (from low to high).
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
     * The returned list may contain multiple locations for a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
     * particular line number, if the compiler and/or VM has
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
     * mapped that line to two or more disjoint code index ranges.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
     * If the method is native or abstract, an empty list is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
     * returned.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
     * Returned list is for the specified <i>stratum</i>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
     * (see {@link Location} for a description of strata).
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
     * @param stratum The stratum to retrieve information from
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
     * or <code>null</code> for the {@link ReferenceType#defaultStratum()}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
     * @param sourceName Return locations only within this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
     * source file or <code>null</code> to return locations.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
     * @return a List of all source line {@link Location} objects.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
     * @throws AbsentInformationException if there is no line
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
     * number information for this (non-native, non-abstract)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
     * method.  Or if <i>sourceName</i> is non-<code>null</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
     * and source name information is not present.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
     * @since 1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
    List<Location> allLineLocations(String stratum, String sourceName)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
        throws AbsentInformationException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
     * Returns a List containing all {@link Location} objects
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
     * that map to the given line number.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
     * This method is equivalent to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
     * <code>locationsOfLine(vm.getDefaultStratum(), null,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
     * lineNumber)</code> -
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
     * see {@link
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
     * #locationsOfLine(java.lang.String,java.lang.String,int)}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
     * for more information.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
     * @param lineNumber the line number
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
     * @return a List of {@link Location} objects that map to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
     * the given line number.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
     * @throws AbsentInformationException if there is no line
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
     * number information for this method.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
    List<Location> locationsOfLine(int lineNumber) throws AbsentInformationException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
     * Returns a List containing all {@link Location} objects
90ce3da70b43 Initial load
duke
parents:
diff changeset
   293
     * that map to the given line number and source name.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
     * Returns a list containing each {@link Location} that maps
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
     * to the given line. The returned list will contain a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
     * location for each disjoint range of code indices that have
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
     * been assigned to the given line by the compiler and/or
90ce3da70b43 Initial load
duke
parents:
diff changeset
   299
     * VM. Each returned location corresponds to the beginning of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   300
     * this range.  An empty list will be returned if there is no
90ce3da70b43 Initial load
duke
parents:
diff changeset
   301
     * executable code at the specified line number; specifically,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
     * native and abstract methods will always return an empty
90ce3da70b43 Initial load
duke
parents:
diff changeset
   303
     * list.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   305
     * Returned list is for the specified <i>stratum</i>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   306
     * (see {@link Location} for a description of strata).
90ce3da70b43 Initial load
duke
parents:
diff changeset
   307
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   308
     * @param stratum the stratum to use for comparing line number
90ce3da70b43 Initial load
duke
parents:
diff changeset
   309
     *                and source name, or null to use the default
90ce3da70b43 Initial load
duke
parents:
diff changeset
   310
     *                stratum
90ce3da70b43 Initial load
duke
parents:
diff changeset
   311
     * @param sourceName the source name containing the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   312
     *                   line number, or null to match all
90ce3da70b43 Initial load
duke
parents:
diff changeset
   313
     *                   source names
90ce3da70b43 Initial load
duke
parents:
diff changeset
   314
     * @param lineNumber the line number
90ce3da70b43 Initial load
duke
parents:
diff changeset
   315
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   316
     * @return a List of {@link Location} objects that map to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   317
     * the given line number.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   318
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   319
     * @throws AbsentInformationException if there is no line
90ce3da70b43 Initial load
duke
parents:
diff changeset
   320
     * number information for this method.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   321
     * Or if <i>sourceName</i> is non-<code>null</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   322
     * and source name information is not present.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   323
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   324
     * @since 1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
   325
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   326
    List<Location> locationsOfLine(String stratum, String sourceName,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   327
                                   int lineNumber)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   328
        throws AbsentInformationException;
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 {@link Location} for the given code index.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   332
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   333
     * @return the {@link Location} corresponding to the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   334
     * given code index or null if the specified code index is not a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   335
     * valid code index for this method (native and abstract methods
90ce3da70b43 Initial load
duke
parents:
diff changeset
   336
     * will always return null).
90ce3da70b43 Initial load
duke
parents:
diff changeset
   337
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   338
    Location locationOfCodeIndex(long codeIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   339
90ce3da70b43 Initial load
duke
parents:
diff changeset
   340
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   341
     * Returns a list containing each {@link LocalVariable} declared
90ce3da70b43 Initial load
duke
parents:
diff changeset
   342
     * in this method. The list includes any variable declared in any
90ce3da70b43 Initial load
duke
parents:
diff changeset
   343
     * scope within the method. It may contain multiple variables of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   344
     * same name declared within disjoint scopes. Arguments are considered
90ce3da70b43 Initial load
duke
parents:
diff changeset
   345
     * local variables and will be present in the returned list.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   346
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   347
     * If local variable information is not available, values of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   348
     * actual arguments to method invocations can be obtained
90ce3da70b43 Initial load
duke
parents:
diff changeset
   349
     * by using the method {@link StackFrame#getArgumentValues()}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   350
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   351
     * @return the list of {@link LocalVariable} objects which mirror
90ce3da70b43 Initial load
duke
parents:
diff changeset
   352
     * local variables declared in this method in the target VM.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   353
     * If there are no local variables, a zero-length list is returned.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   354
     * @throws AbsentInformationException if there is no variable
90ce3da70b43 Initial load
duke
parents:
diff changeset
   355
     * information for this method.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   356
     * Generally, local variable information is not available for
90ce3da70b43 Initial load
duke
parents:
diff changeset
   357
     * native or abstract methods (that is, their argument name
90ce3da70b43 Initial load
duke
parents:
diff changeset
   358
     * information is not available), thus they will throw this exception.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   359
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   360
    List<LocalVariable> variables() throws AbsentInformationException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   361
90ce3da70b43 Initial load
duke
parents:
diff changeset
   362
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   363
     * Returns a list containing each {@link LocalVariable} of a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   364
     * given name in this method.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   365
     * Multiple variables can be returned
90ce3da70b43 Initial load
duke
parents:
diff changeset
   366
     * if the same variable name is used in disjoint
90ce3da70b43 Initial load
duke
parents:
diff changeset
   367
     * scopes within the method.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   368
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   369
     * @return the list of {@link LocalVariable} objects of the given
90ce3da70b43 Initial load
duke
parents:
diff changeset
   370
     * name.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   371
     * If there are no matching local variables, a zero-length list
90ce3da70b43 Initial load
duke
parents:
diff changeset
   372
     * is returned.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   373
     * @throws AbsentInformationException if there is no variable
90ce3da70b43 Initial load
duke
parents:
diff changeset
   374
     * information for this method.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   375
     * Generally, local variable information is not available for
90ce3da70b43 Initial load
duke
parents:
diff changeset
   376
     * native or abstract methods (that is, their argument name
90ce3da70b43 Initial load
duke
parents:
diff changeset
   377
     * information is not available), thus they will throw this exception.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   378
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   379
    List<LocalVariable> variablesByName(String name)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   380
        throws AbsentInformationException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   381
90ce3da70b43 Initial load
duke
parents:
diff changeset
   382
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   383
     * Returns a list containing each {@link LocalVariable} that is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   384
     * declared as an argument of this method.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   385
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   386
     * If local variable information is not available, values of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   387
     * actual arguments to method invocations can be obtained
90ce3da70b43 Initial load
duke
parents:
diff changeset
   388
     * by using the method {@link StackFrame#getArgumentValues()}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   389
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   390
     * @return the list of {@link LocalVariable} arguments.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   391
     * If there are no arguments, a zero-length list is returned.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   392
     * @throws AbsentInformationException if there is no variable
90ce3da70b43 Initial load
duke
parents:
diff changeset
   393
     * information for this method.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   394
     * Generally, local variable information is not available for
90ce3da70b43 Initial load
duke
parents:
diff changeset
   395
     * native or abstract methods (that is, their argument name
90ce3da70b43 Initial load
duke
parents:
diff changeset
   396
     * information is not available), thus they will throw this exception.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   397
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   398
    List<LocalVariable> arguments() throws AbsentInformationException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   399
90ce3da70b43 Initial load
duke
parents:
diff changeset
   400
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   401
     * Returns an array containing the bytecodes for this method.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   402
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   403
     * Not all target virtual machines support this operation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   404
     * Use {@link VirtualMachine#canGetBytecodes()}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   405
     * to determine if the operation is supported.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   406
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   407
     * @return the array of bytecodes; abstract and native methods
90ce3da70b43 Initial load
duke
parents:
diff changeset
   408
     * will return a zero-length array.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   409
     * @throws java.lang.UnsupportedOperationException if
90ce3da70b43 Initial load
duke
parents:
diff changeset
   410
     * the target virtual machine does not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
   411
     * the retrieval of bytecodes.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   412
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   413
    byte[] bytecodes();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   414
90ce3da70b43 Initial load
duke
parents:
diff changeset
   415
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   416
     * Returns the {@link Location} of this method, if there
90ce3da70b43 Initial load
duke
parents:
diff changeset
   417
     * is executable code associated with it.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   418
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   419
     * @return the {@link Location} of this mirror, or null if
90ce3da70b43 Initial load
duke
parents:
diff changeset
   420
     * this is an abstract method; native methods will return a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   421
     * Location object whose codeIndex is -1.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   422
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   423
    Location location();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   424
90ce3da70b43 Initial load
duke
parents:
diff changeset
   425
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   426
     * Compares the specified Object with this method for equality.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   427
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   428
     * @return true if the Object is a method and if both
90ce3da70b43 Initial load
duke
parents:
diff changeset
   429
     * mirror the same method (declared in the same class or interface, in
90ce3da70b43 Initial load
duke
parents:
diff changeset
   430
     * the same VM).
90ce3da70b43 Initial load
duke
parents:
diff changeset
   431
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   432
    boolean equals(Object obj);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   433
90ce3da70b43 Initial load
duke
parents:
diff changeset
   434
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   435
     * Returns the hash code value for this Method.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   436
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   437
     * @return the integer hash code
90ce3da70b43 Initial load
duke
parents:
diff changeset
   438
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   439
    int hashCode();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   440
}