mirror of
https://github.com/openRuyi-Project/gcc.git
synced 2026-06-16 00:16:04 +00:00
String.java (toString): Check for this == null and throw NullPointerException.
1999-07-01 Bryce McKinlay <bryce@albatross.co.nz> * java/lang/String.java (toString): Check for this == null and throw NullPointerException. From-SVN: r27895
This commit is contained in:
committed by
Bryce McKinlay
parent
cb1902adbf
commit
659c26fc49
@@ -115,6 +115,9 @@ public final class String
|
||||
|
||||
public String toString ()
|
||||
{
|
||||
// because String is final, we actually get this far on a null reference
|
||||
if (this == null)
|
||||
throw new NullPointerException();
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user