Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
33a455f7
D
dragonwell8_jdk
项目概览
openanolis
/
dragonwell8_jdk
通知
4
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dragonwell8_jdk
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
33a455f7
编写于
2月 02, 2011
作者:
B
briangoetz
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
7012540: java.util.Objects.nonNull() incorrectly named
Reviewed-by: darcy, weijun
上级
e3b58020
变更
12
显示空白变更内容
内联
并排
Showing
12 changed file
with
42 addition
and
45 deletion
+42
-45
src/share/classes/java/io/PrintStream.java
src/share/classes/java/io/PrintStream.java
+6
-6
src/share/classes/java/io/PrintWriter.java
src/share/classes/java/io/PrintWriter.java
+1
-1
src/share/classes/java/lang/StackTraceElement.java
src/share/classes/java/lang/StackTraceElement.java
+2
-2
src/share/classes/java/nio/file/DirectoryIteratorException.java
...are/classes/java/nio/file/DirectoryIteratorException.java
+1
-1
src/share/classes/java/nio/file/FileTreeWalker.java
src/share/classes/java/nio/file/FileTreeWalker.java
+1
-2
src/share/classes/java/nio/file/Files.java
src/share/classes/java/nio/file/Files.java
+4
-4
src/share/classes/java/nio/file/SimpleFileVisitor.java
src/share/classes/java/nio/file/SimpleFileVisitor.java
+6
-6
src/share/classes/java/util/Formatter.java
src/share/classes/java/util/Formatter.java
+2
-5
src/share/classes/java/util/Objects.java
src/share/classes/java/util/Objects.java
+5
-5
src/share/classes/java/util/Scanner.java
src/share/classes/java/util/Scanner.java
+9
-8
src/share/classes/sun/security/krb5/KrbAsRep.java
src/share/classes/sun/security/krb5/KrbAsRep.java
+1
-1
test/java/util/Objects/BasicObjectsTest.java
test/java/util/Objects/BasicObjectsTest.java
+4
-4
未找到文件。
src/share/classes/java/io/PrintStream.java
浏览文件 @
33a455f7
...
@@ -70,11 +70,11 @@ public class PrintStream extends FilterOutputStream
...
@@ -70,11 +70,11 @@ public class PrintStream extends FilterOutputStream
private
OutputStreamWriter
charOut
;
private
OutputStreamWriter
charOut
;
/**
/**
*
n
onNull is explicitly declared here so as not to create an extra
*
requireN
onNull is explicitly declared here so as not to create an extra
* dependency on java.util.Objects.
n
onNull. PrintStream is loaded
* dependency on java.util.Objects.
requireN
onNull. PrintStream is loaded
* early during system initialization.
* early during system initialization.
*/
*/
private
static
<
T
>
T
n
onNull
(
T
obj
,
String
message
)
{
private
static
<
T
>
T
requireN
onNull
(
T
obj
,
String
message
)
{
if
(
obj
==
null
)
if
(
obj
==
null
)
throw
new
NullPointerException
(
message
);
throw
new
NullPointerException
(
message
);
return
obj
;
return
obj
;
...
@@ -88,7 +88,7 @@ public class PrintStream extends FilterOutputStream
...
@@ -88,7 +88,7 @@ public class PrintStream extends FilterOutputStream
private
static
Charset
toCharset
(
String
csn
)
private
static
Charset
toCharset
(
String
csn
)
throws
UnsupportedEncodingException
throws
UnsupportedEncodingException
{
{
n
onNull
(
csn
,
"charsetName"
);
requireN
onNull
(
csn
,
"charsetName"
);
try
{
try
{
return
Charset
.
forName
(
csn
);
return
Charset
.
forName
(
csn
);
}
catch
(
IllegalCharsetNameException
|
UnsupportedCharsetException
unused
)
{
}
catch
(
IllegalCharsetNameException
|
UnsupportedCharsetException
unused
)
{
...
@@ -148,7 +148,7 @@ public class PrintStream extends FilterOutputStream
...
@@ -148,7 +148,7 @@ public class PrintStream extends FilterOutputStream
* @see java.io.PrintWriter#PrintWriter(java.io.OutputStream, boolean)
* @see java.io.PrintWriter#PrintWriter(java.io.OutputStream, boolean)
*/
*/
public
PrintStream
(
OutputStream
out
,
boolean
autoFlush
)
{
public
PrintStream
(
OutputStream
out
,
boolean
autoFlush
)
{
this
(
autoFlush
,
n
onNull
(
out
,
"Null output stream"
));
this
(
autoFlush
,
requireN
onNull
(
out
,
"Null output stream"
));
}
}
/**
/**
...
@@ -173,7 +173,7 @@ public class PrintStream extends FilterOutputStream
...
@@ -173,7 +173,7 @@ public class PrintStream extends FilterOutputStream
throws
UnsupportedEncodingException
throws
UnsupportedEncodingException
{
{
this
(
autoFlush
,
this
(
autoFlush
,
n
onNull
(
out
,
"Null output stream"
),
requireN
onNull
(
out
,
"Null output stream"
),
toCharset
(
encoding
));
toCharset
(
encoding
));
}
}
...
...
src/share/classes/java/io/PrintWriter.java
浏览文件 @
33a455f7
...
@@ -82,7 +82,7 @@ public class PrintWriter extends Writer {
...
@@ -82,7 +82,7 @@ public class PrintWriter extends Writer {
private
static
Charset
toCharset
(
String
csn
)
private
static
Charset
toCharset
(
String
csn
)
throws
UnsupportedEncodingException
throws
UnsupportedEncodingException
{
{
Objects
.
n
onNull
(
csn
,
"charsetName"
);
Objects
.
requireN
onNull
(
csn
,
"charsetName"
);
try
{
try
{
return
Charset
.
forName
(
csn
);
return
Charset
.
forName
(
csn
);
}
catch
(
IllegalCharsetNameException
|
UnsupportedCharsetException
unused
)
{
}
catch
(
IllegalCharsetNameException
|
UnsupportedCharsetException
unused
)
{
...
...
src/share/classes/java/lang/StackTraceElement.java
浏览文件 @
33a455f7
...
@@ -68,8 +68,8 @@ public final class StackTraceElement implements java.io.Serializable {
...
@@ -68,8 +68,8 @@ public final class StackTraceElement implements java.io.Serializable {
*/
*/
public
StackTraceElement
(
String
declaringClass
,
String
methodName
,
public
StackTraceElement
(
String
declaringClass
,
String
methodName
,
String
fileName
,
int
lineNumber
)
{
String
fileName
,
int
lineNumber
)
{
this
.
declaringClass
=
Objects
.
n
onNull
(
declaringClass
,
"Declaring class is null"
);
this
.
declaringClass
=
Objects
.
requireN
onNull
(
declaringClass
,
"Declaring class is null"
);
this
.
methodName
=
Objects
.
n
onNull
(
methodName
,
"Method name is null"
);
this
.
methodName
=
Objects
.
requireN
onNull
(
methodName
,
"Method name is null"
);
this
.
fileName
=
fileName
;
this
.
fileName
=
fileName
;
this
.
lineNumber
=
lineNumber
;
this
.
lineNumber
=
lineNumber
;
}
}
...
...
src/share/classes/java/nio/file/DirectoryIteratorException.java
浏览文件 @
33a455f7
...
@@ -56,7 +56,7 @@ public final class DirectoryIteratorException
...
@@ -56,7 +56,7 @@ public final class DirectoryIteratorException
* if the cause is {@code null}
* if the cause is {@code null}
*/
*/
public
DirectoryIteratorException
(
IOException
cause
)
{
public
DirectoryIteratorException
(
IOException
cause
)
{
super
(
Objects
.
n
onNull
(
cause
));
super
(
Objects
.
requireN
onNull
(
cause
));
}
}
/**
/**
...
...
src/share/classes/java/nio/file/FileTreeWalker.java
浏览文件 @
33a455f7
...
@@ -69,8 +69,7 @@ class FileTreeWalker {
...
@@ -69,8 +69,7 @@ class FileTreeWalker {
FileVisitResult
result
=
walk
(
start
,
FileVisitResult
result
=
walk
(
start
,
0
,
0
,
new
ArrayList
<
AncestorDirectory
>());
new
ArrayList
<
AncestorDirectory
>());
if
(
result
==
null
)
Objects
.
requireNonNull
(
result
,
"FileVisitor returned null"
);
throw
new
NullPointerException
(
"FileVisitor returned null"
);
}
}
/**
/**
...
...
src/share/classes/java/nio/file/Files.java
浏览文件 @
33a455f7
...
@@ -2779,7 +2779,7 @@ public final class Files {
...
@@ -2779,7 +2779,7 @@ public final class Files {
throws
IOException
throws
IOException
{
{
// ensure not null before opening file
// ensure not null before opening file
Objects
.
n
onNull
(
in
);
Objects
.
requireN
onNull
(
in
);
// check for REPLACE_EXISTING
// check for REPLACE_EXISTING
boolean
replaceExisting
=
false
;
boolean
replaceExisting
=
false
;
...
@@ -2861,7 +2861,7 @@ public final class Files {
...
@@ -2861,7 +2861,7 @@ public final class Files {
*/
*/
public
static
long
copy
(
Path
source
,
OutputStream
out
)
throws
IOException
{
public
static
long
copy
(
Path
source
,
OutputStream
out
)
throws
IOException
{
// ensure not null before opening file
// ensure not null before opening file
Objects
.
n
onNull
(
out
);
Objects
.
requireN
onNull
(
out
);
try
(
InputStream
in
=
newInputStream
(
source
))
{
try
(
InputStream
in
=
newInputStream
(
source
))
{
return
copy
(
in
,
out
);
return
copy
(
in
,
out
);
...
@@ -3035,7 +3035,7 @@ public final class Files {
...
@@ -3035,7 +3035,7 @@ public final class Files {
throws
IOException
throws
IOException
{
{
// ensure bytes is not null before opening file
// ensure bytes is not null before opening file
Objects
.
n
onNull
(
bytes
);
Objects
.
requireN
onNull
(
bytes
);
try
(
OutputStream
out
=
Files
.
newOutputStream
(
path
,
options
))
{
try
(
OutputStream
out
=
Files
.
newOutputStream
(
path
,
options
))
{
int
len
=
bytes
.
length
;
int
len
=
bytes
.
length
;
...
@@ -3094,7 +3094,7 @@ public final class Files {
...
@@ -3094,7 +3094,7 @@ public final class Files {
throws
IOException
throws
IOException
{
{
// ensure lines is not null before opening file
// ensure lines is not null before opening file
Objects
.
n
onNull
(
lines
);
Objects
.
requireN
onNull
(
lines
);
CharsetEncoder
encoder
=
cs
.
newEncoder
();
CharsetEncoder
encoder
=
cs
.
newEncoder
();
OutputStream
out
=
newOutputStream
(
path
,
options
);
OutputStream
out
=
newOutputStream
(
path
,
options
);
try
(
BufferedWriter
writer
=
new
BufferedWriter
(
new
OutputStreamWriter
(
out
,
encoder
)))
{
try
(
BufferedWriter
writer
=
new
BufferedWriter
(
new
OutputStreamWriter
(
out
,
encoder
)))
{
...
...
src/share/classes/java/nio/file/SimpleFileVisitor.java
浏览文件 @
33a455f7
...
@@ -57,8 +57,8 @@ public class SimpleFileVisitor<T> implements FileVisitor<T> {
...
@@ -57,8 +57,8 @@ public class SimpleFileVisitor<T> implements FileVisitor<T> {
public
FileVisitResult
preVisitDirectory
(
T
dir
,
BasicFileAttributes
attrs
)
public
FileVisitResult
preVisitDirectory
(
T
dir
,
BasicFileAttributes
attrs
)
throws
IOException
throws
IOException
{
{
Objects
.
n
onNull
(
dir
);
Objects
.
requireN
onNull
(
dir
);
Objects
.
n
onNull
(
attrs
);
Objects
.
requireN
onNull
(
attrs
);
return
FileVisitResult
.
CONTINUE
;
return
FileVisitResult
.
CONTINUE
;
}
}
...
@@ -72,8 +72,8 @@ public class SimpleFileVisitor<T> implements FileVisitor<T> {
...
@@ -72,8 +72,8 @@ public class SimpleFileVisitor<T> implements FileVisitor<T> {
public
FileVisitResult
visitFile
(
T
file
,
BasicFileAttributes
attrs
)
public
FileVisitResult
visitFile
(
T
file
,
BasicFileAttributes
attrs
)
throws
IOException
throws
IOException
{
{
Objects
.
n
onNull
(
file
);
Objects
.
requireN
onNull
(
file
);
Objects
.
n
onNull
(
attrs
);
Objects
.
requireN
onNull
(
attrs
);
return
FileVisitResult
.
CONTINUE
;
return
FileVisitResult
.
CONTINUE
;
}
}
...
@@ -87,7 +87,7 @@ public class SimpleFileVisitor<T> implements FileVisitor<T> {
...
@@ -87,7 +87,7 @@ public class SimpleFileVisitor<T> implements FileVisitor<T> {
public
FileVisitResult
visitFileFailed
(
T
file
,
IOException
exc
)
public
FileVisitResult
visitFileFailed
(
T
file
,
IOException
exc
)
throws
IOException
throws
IOException
{
{
Objects
.
n
onNull
(
file
);
Objects
.
requireN
onNull
(
file
);
throw
exc
;
throw
exc
;
}
}
...
@@ -104,7 +104,7 @@ public class SimpleFileVisitor<T> implements FileVisitor<T> {
...
@@ -104,7 +104,7 @@ public class SimpleFileVisitor<T> implements FileVisitor<T> {
public
FileVisitResult
postVisitDirectory
(
T
dir
,
IOException
exc
)
public
FileVisitResult
postVisitDirectory
(
T
dir
,
IOException
exc
)
throws
IOException
throws
IOException
{
{
Objects
.
n
onNull
(
dir
);
Objects
.
requireN
onNull
(
dir
);
if
(
exc
!=
null
)
if
(
exc
!=
null
)
throw
exc
;
throw
exc
;
return
FileVisitResult
.
CONTINUE
;
return
FileVisitResult
.
CONTINUE
;
...
...
src/share/classes/java/util/Formatter.java
浏览文件 @
33a455f7
...
@@ -47,9 +47,6 @@ import java.text.DateFormatSymbols;
...
@@ -47,9 +47,6 @@ import java.text.DateFormatSymbols;
import
java.text.DecimalFormat
;
import
java.text.DecimalFormat
;
import
java.text.DecimalFormatSymbols
;
import
java.text.DecimalFormatSymbols
;
import
java.text.NumberFormat
;
import
java.text.NumberFormat
;
import
java.util.Calendar
;
import
java.util.Date
;
import
java.util.Locale
;
import
java.util.regex.Matcher
;
import
java.util.regex.Matcher
;
import
java.util.regex.Pattern
;
import
java.util.regex.Pattern
;
...
@@ -1859,7 +1856,7 @@ public final class Formatter implements Closeable, Flushable {
...
@@ -1859,7 +1856,7 @@ public final class Formatter implements Closeable, Flushable {
private
static
Charset
toCharset
(
String
csn
)
private
static
Charset
toCharset
(
String
csn
)
throws
UnsupportedEncodingException
throws
UnsupportedEncodingException
{
{
Objects
.
n
onNull
(
csn
,
"charsetName"
);
Objects
.
requireN
onNull
(
csn
,
"charsetName"
);
try
{
try
{
return
Charset
.
forName
(
csn
);
return
Charset
.
forName
(
csn
);
}
catch
(
IllegalCharsetNameException
|
UnsupportedCharsetException
unused
)
{
}
catch
(
IllegalCharsetNameException
|
UnsupportedCharsetException
unused
)
{
...
@@ -2179,7 +2176,7 @@ public final class Formatter implements Closeable, Flushable {
...
@@ -2179,7 +2176,7 @@ public final class Formatter implements Closeable, Flushable {
*/
*/
public
Formatter
(
PrintStream
ps
)
{
public
Formatter
(
PrintStream
ps
)
{
this
(
Locale
.
getDefault
(
Locale
.
Category
.
FORMAT
),
this
(
Locale
.
getDefault
(
Locale
.
Category
.
FORMAT
),
(
Appendable
)
Objects
.
n
onNull
(
ps
));
(
Appendable
)
Objects
.
requireN
onNull
(
ps
));
}
}
/**
/**
...
...
src/share/classes/java/util/Objects.java
浏览文件 @
33a455f7
...
@@ -187,7 +187,7 @@ public final class Objects {
...
@@ -187,7 +187,7 @@ public final class Objects {
* and constructors, as demonstrated below:
* and constructors, as demonstrated below:
* <blockquote><pre>
* <blockquote><pre>
* public Foo(Bar bar) {
* public Foo(Bar bar) {
* this.bar = Objects.
n
onNull(bar);
* this.bar = Objects.
requireN
onNull(bar);
* }
* }
* </pre></blockquote>
* </pre></blockquote>
*
*
...
@@ -196,7 +196,7 @@ public final class Objects {
...
@@ -196,7 +196,7 @@ public final class Objects {
* @return {@code obj} if not {@code null}
* @return {@code obj} if not {@code null}
* @throws NullPointerException if {@code obj} is {@code null}
* @throws NullPointerException if {@code obj} is {@code null}
*/
*/
public
static
<
T
>
T
n
onNull
(
T
obj
)
{
public
static
<
T
>
T
requireN
onNull
(
T
obj
)
{
if
(
obj
==
null
)
if
(
obj
==
null
)
throw
new
NullPointerException
();
throw
new
NullPointerException
();
return
obj
;
return
obj
;
...
@@ -209,8 +209,8 @@ public final class Objects {
...
@@ -209,8 +209,8 @@ public final class Objects {
* constructors with multiple parameters, as demonstrated below:
* constructors with multiple parameters, as demonstrated below:
* <blockquote><pre>
* <blockquote><pre>
* public Foo(Bar bar, Baz baz) {
* public Foo(Bar bar, Baz baz) {
* this.bar = Objects.
n
onNull(bar, "bar must not be null");
* this.bar = Objects.
requireN
onNull(bar, "bar must not be null");
* this.baz = Objects.
n
onNull(baz, "baz must not be null");
* this.baz = Objects.
requireN
onNull(baz, "baz must not be null");
* }
* }
* </pre></blockquote>
* </pre></blockquote>
*
*
...
@@ -221,7 +221,7 @@ public final class Objects {
...
@@ -221,7 +221,7 @@ public final class Objects {
* @return {@code obj} if not {@code null}
* @return {@code obj} if not {@code null}
* @throws NullPointerException if {@code obj} is {@code null}
* @throws NullPointerException if {@code obj} is {@code null}
*/
*/
public
static
<
T
>
T
n
onNull
(
T
obj
,
String
message
)
{
public
static
<
T
>
T
requireN
onNull
(
T
obj
,
String
message
)
{
if
(
obj
==
null
)
if
(
obj
==
null
)
throw
new
NullPointerException
(
message
);
throw
new
NullPointerException
(
message
);
return
obj
;
return
obj
;
...
...
src/share/classes/java/util/Scanner.java
浏览文件 @
33a455f7
...
@@ -35,6 +35,7 @@ import java.nio.channels.*;
...
@@ -35,6 +35,7 @@ import java.nio.channels.*;
import
java.nio.charset.*
;
import
java.nio.charset.*
;
import
java.text.*
;
import
java.text.*
;
import
java.util.Locale
;
import
java.util.Locale
;
import
sun.misc.LRUCache
;
import
sun.misc.LRUCache
;
/**
/**
...
@@ -592,7 +593,7 @@ public final class Scanner implements Iterator<String>, Closeable {
...
@@ -592,7 +593,7 @@ public final class Scanner implements Iterator<String>, Closeable {
* interface
* interface
*/
*/
public
Scanner
(
Readable
source
)
{
public
Scanner
(
Readable
source
)
{
this
(
Objects
.
n
onNull
(
source
,
"source"
),
WHITESPACE_PATTERN
);
this
(
Objects
.
requireN
onNull
(
source
,
"source"
),
WHITESPACE_PATTERN
);
}
}
/**
/**
...
@@ -619,7 +620,7 @@ public final class Scanner implements Iterator<String>, Closeable {
...
@@ -619,7 +620,7 @@ public final class Scanner implements Iterator<String>, Closeable {
* does not exist
* does not exist
*/
*/
public
Scanner
(
InputStream
source
,
String
charsetName
)
{
public
Scanner
(
InputStream
source
,
String
charsetName
)
{
this
(
makeReadable
(
Objects
.
n
onNull
(
source
,
"source"
),
toCharset
(
charsetName
)),
this
(
makeReadable
(
Objects
.
requireN
onNull
(
source
,
"source"
),
toCharset
(
charsetName
)),
WHITESPACE_PATTERN
);
WHITESPACE_PATTERN
);
}
}
...
@@ -629,7 +630,7 @@ public final class Scanner implements Iterator<String>, Closeable {
...
@@ -629,7 +630,7 @@ public final class Scanner implements Iterator<String>, Closeable {
* @throws IllegalArgumentException if the charset is not supported
* @throws IllegalArgumentException if the charset is not supported
*/
*/
private
static
Charset
toCharset
(
String
csn
)
{
private
static
Charset
toCharset
(
String
csn
)
{
Objects
.
n
onNull
(
csn
,
"charsetName"
);
Objects
.
requireN
onNull
(
csn
,
"charsetName"
);
try
{
try
{
return
Charset
.
forName
(
csn
);
return
Charset
.
forName
(
csn
);
}
catch
(
IllegalCharsetNameException
|
UnsupportedCharsetException
e
)
{
}
catch
(
IllegalCharsetNameException
|
UnsupportedCharsetException
e
)
{
...
@@ -670,7 +671,7 @@ public final class Scanner implements Iterator<String>, Closeable {
...
@@ -670,7 +671,7 @@ public final class Scanner implements Iterator<String>, Closeable {
public
Scanner
(
File
source
,
String
charsetName
)
public
Scanner
(
File
source
,
String
charsetName
)
throws
FileNotFoundException
throws
FileNotFoundException
{
{
this
(
Objects
.
n
onNull
(
source
),
toDecoder
(
charsetName
));
this
(
Objects
.
requireN
onNull
(
source
),
toDecoder
(
charsetName
));
}
}
private
Scanner
(
File
source
,
CharsetDecoder
dec
)
private
Scanner
(
File
source
,
CharsetDecoder
dec
)
...
@@ -680,7 +681,7 @@ public final class Scanner implements Iterator<String>, Closeable {
...
@@ -680,7 +681,7 @@ public final class Scanner implements Iterator<String>, Closeable {
}
}
private
static
CharsetDecoder
toDecoder
(
String
charsetName
)
{
private
static
CharsetDecoder
toDecoder
(
String
charsetName
)
{
Objects
.
n
onNull
(
charsetName
,
"charsetName"
);
Objects
.
requireN
onNull
(
charsetName
,
"charsetName"
);
try
{
try
{
return
Charset
.
forName
(
charsetName
).
newDecoder
();
return
Charset
.
forName
(
charsetName
).
newDecoder
();
}
catch
(
IllegalCharsetNameException
|
UnsupportedCharsetException
unused
)
{
}
catch
(
IllegalCharsetNameException
|
UnsupportedCharsetException
unused
)
{
...
@@ -729,7 +730,7 @@ public final class Scanner implements Iterator<String>, Closeable {
...
@@ -729,7 +730,7 @@ public final class Scanner implements Iterator<String>, Closeable {
* @since 1.7
* @since 1.7
*/
*/
public
Scanner
(
Path
source
,
String
charsetName
)
throws
IOException
{
public
Scanner
(
Path
source
,
String
charsetName
)
throws
IOException
{
this
(
Objects
.
n
onNull
(
source
),
toCharset
(
charsetName
));
this
(
Objects
.
requireN
onNull
(
source
),
toCharset
(
charsetName
));
}
}
private
Scanner
(
Path
source
,
Charset
charset
)
throws
IOException
{
private
Scanner
(
Path
source
,
Charset
charset
)
throws
IOException
{
...
@@ -755,7 +756,7 @@ public final class Scanner implements Iterator<String>, Closeable {
...
@@ -755,7 +756,7 @@ public final class Scanner implements Iterator<String>, Closeable {
* @param source A channel to scan
* @param source A channel to scan
*/
*/
public
Scanner
(
ReadableByteChannel
source
)
{
public
Scanner
(
ReadableByteChannel
source
)
{
this
(
makeReadable
(
Objects
.
n
onNull
(
source
,
"source"
)),
this
(
makeReadable
(
Objects
.
requireN
onNull
(
source
,
"source"
)),
WHITESPACE_PATTERN
);
WHITESPACE_PATTERN
);
}
}
...
@@ -775,7 +776,7 @@ public final class Scanner implements Iterator<String>, Closeable {
...
@@ -775,7 +776,7 @@ public final class Scanner implements Iterator<String>, Closeable {
* does not exist
* does not exist
*/
*/
public
Scanner
(
ReadableByteChannel
source
,
String
charsetName
)
{
public
Scanner
(
ReadableByteChannel
source
,
String
charsetName
)
{
this
(
makeReadable
(
Objects
.
n
onNull
(
source
,
"source"
),
toDecoder
(
charsetName
)),
this
(
makeReadable
(
Objects
.
requireN
onNull
(
source
,
"source"
),
toDecoder
(
charsetName
)),
WHITESPACE_PATTERN
);
WHITESPACE_PATTERN
);
}
}
...
...
src/share/classes/sun/security/krb5/KrbAsRep.java
浏览文件 @
33a455f7
...
@@ -173,7 +173,7 @@ class KrbAsRep extends KrbKdcRep {
...
@@ -173,7 +173,7 @@ class KrbAsRep extends KrbKdcRep {
}
}
Credentials
getCreds
()
{
Credentials
getCreds
()
{
return
Objects
.
n
onNull
(
creds
,
"Creds not available yet."
);
return
Objects
.
requireN
onNull
(
creds
,
"Creds not available yet."
);
}
}
sun
.
security
.
krb5
.
internal
.
ccache
.
Credentials
getCCreds
()
{
sun
.
security
.
krb5
.
internal
.
ccache
.
Credentials
getCCreds
()
{
...
...
test/java/util/Objects/BasicObjectsTest.java
浏览文件 @
33a455f7
...
@@ -164,7 +164,7 @@ public class BasicObjectsTest {
...
@@ -164,7 +164,7 @@ public class BasicObjectsTest {
// Test 1-arg variant
// Test 1-arg variant
try
{
try
{
s
=
Objects
.
n
onNull
(
"pants"
);
s
=
Objects
.
requireN
onNull
(
"pants"
);
if
(
s
!=
"pants"
)
{
if
(
s
!=
"pants"
)
{
System
.
err
.
printf
(
"1-arg non-null failed to return its arg"
);
System
.
err
.
printf
(
"1-arg non-null failed to return its arg"
);
errors
++;
errors
++;
...
@@ -175,7 +175,7 @@ public class BasicObjectsTest {
...
@@ -175,7 +175,7 @@ public class BasicObjectsTest {
}
}
try
{
try
{
s
=
Objects
.
n
onNull
(
null
);
s
=
Objects
.
requireN
onNull
(
null
);
System
.
err
.
printf
(
"1-arg nonNull failed to throw NPE"
);
System
.
err
.
printf
(
"1-arg nonNull failed to throw NPE"
);
errors
++;
errors
++;
}
catch
(
NullPointerException
e
)
{
}
catch
(
NullPointerException
e
)
{
...
@@ -184,7 +184,7 @@ public class BasicObjectsTest {
...
@@ -184,7 +184,7 @@ public class BasicObjectsTest {
// Test 2-arg variant
// Test 2-arg variant
try
{
try
{
s
=
Objects
.
n
onNull
(
"pants"
,
"trousers"
);
s
=
Objects
.
requireN
onNull
(
"pants"
,
"trousers"
);
if
(
s
!=
"pants"
)
{
if
(
s
!=
"pants"
)
{
System
.
err
.
printf
(
"2-arg nonNull failed to return its arg"
);
System
.
err
.
printf
(
"2-arg nonNull failed to return its arg"
);
errors
++;
errors
++;
...
@@ -195,7 +195,7 @@ public class BasicObjectsTest {
...
@@ -195,7 +195,7 @@ public class BasicObjectsTest {
}
}
try
{
try
{
s
=
Objects
.
n
onNull
(
null
,
"pantaloons"
);
s
=
Objects
.
requireN
onNull
(
null
,
"pantaloons"
);
System
.
err
.
printf
(
"2-arg nonNull failed to throw NPE"
);
System
.
err
.
printf
(
"2-arg nonNull failed to throw NPE"
);
errors
++;
errors
++;
}
catch
(
NullPointerException
e
)
{
}
catch
(
NullPointerException
e
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录