harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ndbe...@apache.org
Subject svn commit: r418817 - /incubator/harmony/enhanced/classlib/trunk/modules/luni-kernel/src/main/java/java/lang/StackTraceElement.java
Date Mon, 03 Jul 2006 17:57:34 GMT
Author: ndbeyer
Date: Mon Jul  3 10:57:33 2006
New Revision: 418817

URL: http://svn.apache.org/viewvc?rev=418817&view=rev
Log:
Minor cleanup.

Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/luni-kernel/src/main/java/java/lang/StackTraceElement.java

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni-kernel/src/main/java/java/lang/StackTraceElement.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni-kernel/src/main/java/java/lang/StackTraceElement.java?rev=418817&r1=418816&r2=418817&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni-kernel/src/main/java/java/lang/StackTraceElement.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni-kernel/src/main/java/java/lang/StackTraceElement.java
Mon Jul  3 10:57:33 2006
@@ -16,6 +16,8 @@
 /*[INCLUDE-IF mJava14]*/
 package java.lang;
 
+import java.io.Serializable;
+
 /**
  * An implementation of this class is provided, but the documented constructor
  * can be used by the VM specific implementation to create instances.
@@ -25,12 +27,17 @@
  * @see Throwable#getStackTrace()
  * @since 1.4
  */
-public final class StackTraceElement implements java.io.Serializable {
-	private static final long serialVersionUID = 6992337162326171013L;
+public final class StackTraceElement implements Serializable {
+    
+    private static final long serialVersionUID = 6992337162326171013L;
+
+    String declaringClass;
+
+    String methodName;
 
-	String declaringClass, methodName, fileName;
+    String fileName;
 
-	int lineNumber;
+    int lineNumber;
 
 	/**
      * <p>
@@ -51,8 +58,10 @@
      * @since 1.5
      */
 	public StackTraceElement(String cls, String method, String file, int line) {
-		if (cls == null || method == null)
-			throw new NullPointerException();
+        super();
+		if (cls == null || method == null) {
+            throw new NullPointerException();
+        }
 		declaringClass = cls;
 		methodName = method;
 		fileName = file;
@@ -65,7 +74,7 @@
      * </p>
      */
 	private StackTraceElement() {
-		// Empty
+		super();
 	}
 
 	/**
@@ -73,33 +82,42 @@
 	 * 
 	 * @param obj Object to compare with
 	 */
-	public boolean equals(Object obj) {
-		if (!(obj instanceof StackTraceElement))
-			return false;
-		StackTraceElement castObj = (StackTraceElement) obj;
-
-		// Unknown methods are never equal to anything (not strictly to spec,
-		// but spec does not allow null method/class names)
-		if ((methodName == null) || (castObj.methodName == null))
-			return false;
-
-		if (!getMethodName().equals(castObj.getMethodName()))
-			return false;
-		if (!getClassName().equals(castObj.getClassName()))
-			return false;
-		String localFileName = getFileName();
-		if (localFileName == null) {
-			if (castObj.getFileName() != null)
-				return false;
-		} else {
-			if (!localFileName.equals(castObj.getFileName()))
-				return false;
-		}
-		if (getLineNumber() != castObj.getLineNumber())
-			return false;
+    public boolean equals(Object obj) {
+        if (!(obj instanceof StackTraceElement)) {
+            return false;
+        }
+        StackTraceElement castObj = (StackTraceElement) obj;
+
+        /*
+         * Unknown methods are never equal to anything (not strictly to spec,
+         * but spec does not allow null method/class names)
+         */
+        if ((methodName == null) || (castObj.methodName == null)) {
+            return false;
+        }
+
+        if (!getMethodName().equals(castObj.getMethodName())) {
+            return false;
+        }
+        if (!getClassName().equals(castObj.getClassName())) {
+            return false;
+        }
+        String localFileName = getFileName();
+        if (localFileName == null) {
+            if (castObj.getFileName() != null) {
+                return false;
+            }
+        } else {
+            if (!localFileName.equals(castObj.getFileName())) {
+                return false;
+            }
+        }
+        if (getLineNumber() != castObj.getLineNumber()) {
+            return false;
+        }
 
-		return true;
-	}
+        return true;
+    }
 
 	/**
 	 * Returns the full name (i.e. including the package) of the class where
@@ -131,7 +149,7 @@
 	 * 
 	 * @return if available, the line number in the source file for the class
 	 *         where this stack trace element is executing. If no such detail is
-	 *         available, a number &lt; <code>0</code>.
+	 *         available, a number less than <code>0</code>.
 	 */
 	public int getLineNumber() {
 		return lineNumber;
@@ -153,14 +171,18 @@
 	 * 
 	 * @return This objects hash code
 	 */
-	public int hashCode() {
-		// either both methodName and declaringClass are null, or neither are
-		// null
-		if (methodName == null)
-			return 0; // all unknown methods hash the same
-		// declaringClass never null if methodName is non-null
-		return methodName.hashCode() ^ declaringClass.hashCode();
-	}
+    public int hashCode() {
+        /*
+         * Either both methodName and declaringClass are null, or neither are
+         * null.
+         */
+        if (methodName == null) {
+            // all unknown methods hash the same
+            return 0;
+        }
+        // declaringClass never null if methodName is non-null
+        return methodName.hashCode() ^ declaringClass.hashCode();
+    }
 
 	/**
 	 * Returns <code>true</code> if the method name returned by
@@ -178,7 +200,7 @@
 	 * 
 	 * @return String representing this object
 	 */
-	public String toString() {
+    public String toString() {
 		StringBuilder buf = new StringBuilder(80);
 
 		buf.append(getClassName());



Mime
View raw message