jdk/src/java.base/share/classes/java/lang/StackTraceElement.java
changeset 43712 5dfd0950317c
parent 42704 42d42181a1aa
child 44545 83b611b88ac8
equal deleted inserted replaced
43619:dc9102c475f3 43712:5dfd0950317c
    90      *         of -2 indicates that the method containing the execution point
    90      *         of -2 indicates that the method containing the execution point
    91      *         is a native method
    91      *         is a native method
    92      * @throws NullPointerException if {@code declaringClass} or
    92      * @throws NullPointerException if {@code declaringClass} or
    93      *         {@code methodName} is null
    93      *         {@code methodName} is null
    94      * @since 1.5
    94      * @since 1.5
       
    95      * @revised 9
       
    96      * @spec JPMS
    95      */
    97      */
    96     public StackTraceElement(String declaringClass, String methodName,
    98     public StackTraceElement(String declaringClass, String methodName,
    97                              String fileName, int lineNumber) {
    99                              String fileName, int lineNumber) {
    98         this(null, null, null, declaringClass, methodName, fileName, lineNumber);
   100         this(null, null, null, declaringClass, methodName, fileName, lineNumber);
    99     }
   101     }
   126      *
   128      *
   127      * @throws NullPointerException if {@code declaringClass} is {@code null}
   129      * @throws NullPointerException if {@code declaringClass} is {@code null}
   128      *         or {@code methodName} is {@code null}
   130      *         or {@code methodName} is {@code null}
   129      *
   131      *
   130      * @since 9
   132      * @since 9
       
   133      * @spec JPMS
   131      */
   134      */
   132     public StackTraceElement(String classLoaderName,
   135     public StackTraceElement(String classLoaderName,
   133                              String moduleName, String moduleVersion,
   136                              String moduleName, String moduleVersion,
   134                              String declaringClass, String methodName,
   137                              String declaringClass, String methodName,
   135                              String fileName, int lineNumber) {
   138                              String fileName, int lineNumber) {
   185      *
   188      *
   186      * @return the module name of the {@code Module} containing the execution
   189      * @return the module name of the {@code Module} containing the execution
   187      *         point represented by this stack trace element; {@code null}
   190      *         point represented by this stack trace element; {@code null}
   188      *         if the module name is not available.
   191      *         if the module name is not available.
   189      * @since 9
   192      * @since 9
       
   193      * @spec JPMS
   190      * @see java.lang.reflect.Module#getName()
   194      * @see java.lang.reflect.Module#getName()
   191      */
   195      */
   192     public String getModuleName() {
   196     public String getModuleName() {
   193         return moduleName;
   197         return moduleName;
   194     }
   198     }
   199      *
   203      *
   200      * @return the module version of the {@code Module} containing the execution
   204      * @return the module version of the {@code Module} containing the execution
   201      *         point represented by this stack trace element; {@code null}
   205      *         point represented by this stack trace element; {@code null}
   202      *         if the module version is not available.
   206      *         if the module version is not available.
   203      * @since 9
   207      * @since 9
       
   208      * @spec JPMS
   204      * @see java.lang.module.ModuleDescriptor.Version
   209      * @see java.lang.module.ModuleDescriptor.Version
   205      */
   210      */
   206     public String getModuleVersion() {
   211     public String getModuleVersion() {
   207         return moduleVersion;
   212         return moduleVersion;
   208     }
   213     }
   214      * @return the name of the class loader of the class containing the execution
   219      * @return the name of the class loader of the class containing the execution
   215      *         point represented by this stack trace element; {@code null}
   220      *         point represented by this stack trace element; {@code null}
   216      *         if the class loader is not named.
   221      *         if the class loader is not named.
   217      *
   222      *
   218      * @since 9
   223      * @since 9
       
   224      * @spec JPMS
   219      * @see java.lang.ClassLoader#getName()
   225      * @see java.lang.ClassLoader#getName()
   220      */
   226      */
   221     public String getClassLoaderName() {
   227     public String getClassLoaderName() {
   222         return classLoaderName;
   228         return classLoaderName;
   223     }
   229     }
   327      * {@linkplain #equals(Object) equal}, for example one created via the
   333      * {@linkplain #equals(Object) equal}, for example one created via the
   328      * constructor, and one obtained from {@link java.lang.Throwable} or
   334      * constructor, and one obtained from {@link java.lang.Throwable} or
   329      * {@link java.lang.StackWalker.StackFrame}, where an implementation may
   335      * {@link java.lang.StackWalker.StackFrame}, where an implementation may
   330      * choose to omit some element in the returned string.
   336      * choose to omit some element in the returned string.
   331      *
   337      *
       
   338      * @revised 9
       
   339      * @spec JPMS
   332      * @see    Throwable#printStackTrace()
   340      * @see    Throwable#printStackTrace()
   333      */
   341      */
   334     public String toString() {
   342     public String toString() {
   335         String s = "";
   343         String s = "";
   336         if (!dropClassLoaderName() && classLoaderName != null &&
   344         if (!dropClassLoaderName() && classLoaderName != null &&
   374      *
   382      *
   375      * @param  obj the object to be compared with this stack trace element.
   383      * @param  obj the object to be compared with this stack trace element.
   376      * @return true if the specified object is another
   384      * @return true if the specified object is another
   377      *         {@code StackTraceElement} instance representing the same
   385      *         {@code StackTraceElement} instance representing the same
   378      *         execution point as this instance.
   386      *         execution point as this instance.
       
   387      *
       
   388      * @revised 9
       
   389      * @spec JPMS
   379      */
   390      */
   380     public boolean equals(Object obj) {
   391     public boolean equals(Object obj) {
   381         if (obj==this)
   392         if (obj==this)
   382             return true;
   393             return true;
   383         if (!(obj instanceof StackTraceElement))
   394         if (!(obj instanceof StackTraceElement))