Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
f8b2536d
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看板
提交
f8b2536d
编写于
5月 24, 2012
作者:
D
dbhole
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
7117230: clean up warnings in java.text
Reviewed-by: jrose, smarks
上级
49997e44
变更
17
隐藏空白更改
内联
并排
Showing
17 changed file
with
162 addition
and
139 deletion
+162
-139
src/share/classes/java/text/AttributedCharacterIterator.java
src/share/classes/java/text/AttributedCharacterIterator.java
+2
-2
src/share/classes/java/text/AttributedString.java
src/share/classes/java/text/AttributedString.java
+61
-48
src/share/classes/java/text/BreakDictionary.java
src/share/classes/java/text/BreakDictionary.java
+3
-3
src/share/classes/java/text/BreakIterator.java
src/share/classes/java/text/BreakIterator.java
+7
-5
src/share/classes/java/text/CharacterIteratorFieldDelegate.java
...are/classes/java/text/CharacterIteratorFieldDelegate.java
+5
-5
src/share/classes/java/text/ChoiceFormat.java
src/share/classes/java/text/ChoiceFormat.java
+2
-2
src/share/classes/java/text/CollationElementIterator.java
src/share/classes/java/text/CollationElementIterator.java
+9
-8
src/share/classes/java/text/DateFormat.java
src/share/classes/java/text/DateFormat.java
+1
-1
src/share/classes/java/text/DecimalFormat.java
src/share/classes/java/text/DecimalFormat.java
+4
-4
src/share/classes/java/text/DictionaryBasedBreakIterator.java
...share/classes/java/text/DictionaryBasedBreakIterator.java
+15
-11
src/share/classes/java/text/MergeCollation.java
src/share/classes/java/text/MergeCollation.java
+10
-10
src/share/classes/java/text/MessageFormat.java
src/share/classes/java/text/MessageFormat.java
+7
-6
src/share/classes/java/text/NumberFormat.java
src/share/classes/java/text/NumberFormat.java
+3
-3
src/share/classes/java/text/ParseException.java
src/share/classes/java/text/ParseException.java
+2
-0
src/share/classes/java/text/RBCollationTables.java
src/share/classes/java/text/RBCollationTables.java
+11
-11
src/share/classes/java/text/RBTableBuilder.java
src/share/classes/java/text/RBTableBuilder.java
+17
-17
src/share/classes/java/text/RuleBasedBreakIterator.java
src/share/classes/java/text/RuleBasedBreakIterator.java
+3
-3
未找到文件。
src/share/classes/java/text/AttributedCharacterIterator.java
浏览文件 @
f8b2536d
...
...
@@ -97,7 +97,7 @@ public interface AttributedCharacterIterator extends CharacterIterator {
private
String
name
;
// table of all instances in this class, used by readResolve
private
static
final
Map
instanceMap
=
new
HashMap
(
7
);
private
static
final
Map
<
String
,
Attribute
>
instanceMap
=
new
HashMap
<>
(
7
);
/**
* Constructs an {@code Attribute} with the given name.
...
...
@@ -150,7 +150,7 @@ public interface AttributedCharacterIterator extends CharacterIterator {
throw
new
InvalidObjectException
(
"subclass didn't correctly implement readResolve"
);
}
Attribute
instance
=
(
Attribute
)
instanceMap
.
get
(
getName
());
Attribute
instance
=
instanceMap
.
get
(
getName
());
if
(
instance
!=
null
)
{
return
instance
;
}
else
{
...
...
src/share/classes/java/text/AttributedString.java
浏览文件 @
f8b2536d
...
...
@@ -61,8 +61,8 @@ public class AttributedString {
int
runArraySize
;
// current size of the arrays
int
runCount
;
// actual number of runs, <= runArraySize
int
runStarts
[];
// start index for each run
Vector
runAttributes
[];
// vector of attribute keys for each run
Vector
runAttributeValues
[];
// parallel vector of attribute values for each run
Vector
<
Attribute
>
runAttributes
[];
// vector of attribute keys for each run
Vector
<
Object
>
runAttributeValues
[];
// parallel vector of attribute values for each run
/**
* Constructs an AttributedString instance with the given
...
...
@@ -92,7 +92,7 @@ public class AttributedString {
// Determine the runs, creating a new run when the attributes
// differ.
int
offset
=
0
;
Map
last
=
null
;
Map
<
Attribute
,
Object
>
last
=
null
;
for
(
int
counter
=
0
;
counter
<
iterators
.
length
;
counter
++)
{
AttributedCharacterIterator
iterator
=
iterators
[
counter
];
...
...
@@ -103,7 +103,7 @@ public class AttributedString {
while
(
index
<
end
)
{
iterator
.
setIndex
(
index
);
Map
attrs
=
iterator
.
getAttributes
();
Map
<
Attribute
,
Object
>
attrs
=
iterator
.
getAttributes
();
if
(
mapsDiffer
(
last
,
attrs
))
{
setAttributes
(
attrs
,
index
-
start
+
offset
);
...
...
@@ -156,13 +156,14 @@ public class AttributedString {
int
attributeCount
=
attributes
.
size
();
if
(
attributeCount
>
0
)
{
createRunAttributeDataVectors
();
Vector
newRunAttributes
=
new
Vector
(
attributeCount
);
Vector
newRunAttributeValues
=
new
Vector
(
attributeCount
);
Vector
<
Attribute
>
newRunAttributes
=
new
Vector
<>
(
attributeCount
);
Vector
<
Object
>
newRunAttributeValues
=
new
Vector
<>
(
attributeCount
);
runAttributes
[
0
]
=
newRunAttributes
;
runAttributeValues
[
0
]
=
newRunAttributeValues
;
Iterator
iterator
=
attributes
.
entrySet
().
iterator
();
Iterator
<?
extends
Map
.
Entry
<?
extends
Attribute
,
?>>
iterator
=
attributes
.
entrySet
().
iterator
();
while
(
iterator
.
hasNext
())
{
Map
.
Entry
entry
=
(
Map
.
Entry
)
iterator
.
next
();
Map
.
Entry
<?
extends
Attribute
,
?>
entry
=
iterator
.
next
();
newRunAttributes
.
addElement
(
entry
.
getKey
());
newRunAttributeValues
.
addElement
(
entry
.
getValue
());
}
...
...
@@ -252,7 +253,7 @@ public class AttributedString {
return
;
// Select attribute keys to be taken care of
HashSet
keys
=
new
HashSet
();
HashSet
<
Attribute
>
keys
=
new
HashSet
<>
();
if
(
attributes
==
null
)
{
keys
.
addAll
(
text
.
getAllAttributeKeys
());
}
else
{
...
...
@@ -266,9 +267,9 @@ public class AttributedString {
// Get and set attribute runs for each attribute name. Need to
// scan from the top of the text so that we can discard any
// Annotation that is no longer applied to a subset text segment.
Iterator
itr
=
keys
.
iterator
();
Iterator
<
Attribute
>
itr
=
keys
.
iterator
();
while
(
itr
.
hasNext
())
{
Attribute
attributeKey
=
(
Attribute
)
itr
.
next
();
Attribute
attributeKey
=
itr
.
next
();
text
.
setIndex
(
textBeginIndex
);
while
(
text
.
getIndex
()
<
endIndex
)
{
int
start
=
text
.
getRunStart
(
attributeKey
);
...
...
@@ -390,10 +391,11 @@ public class AttributedString {
int
beginRunIndex
=
ensureRunBreak
(
beginIndex
);
int
endRunIndex
=
ensureRunBreak
(
endIndex
);
Iterator
iterator
=
attributes
.
entrySet
().
iterator
();
Iterator
<?
extends
Map
.
Entry
<?
extends
Attribute
,
?>>
iterator
=
attributes
.
entrySet
().
iterator
();
while
(
iterator
.
hasNext
())
{
Map
.
Entry
entry
=
(
Map
.
Entry
)
iterator
.
next
();
addAttributeRunData
(
(
Attribute
)
entry
.
getKey
(),
entry
.
getValue
(),
beginRunIndex
,
endRunIndex
);
Map
.
Entry
<?
extends
Attribute
,
?>
entry
=
iterator
.
next
();
addAttributeRunData
(
entry
.
getKey
(),
entry
.
getValue
(),
beginRunIndex
,
endRunIndex
);
}
}
...
...
@@ -415,8 +417,13 @@ public class AttributedString {
private
final
void
createRunAttributeDataVectors
()
{
// use temporary variables so things remain consistent in case of an exception
int
newRunStarts
[]
=
new
int
[
ARRAY_SIZE_INCREMENT
];
Vector
newRunAttributes
[]
=
new
Vector
[
ARRAY_SIZE_INCREMENT
];
Vector
newRunAttributeValues
[]
=
new
Vector
[
ARRAY_SIZE_INCREMENT
];
@SuppressWarnings
(
"unchecked"
)
Vector
<
Attribute
>
newRunAttributes
[]
=
(
Vector
<
Attribute
>[])
new
Vector
<?>[
ARRAY_SIZE_INCREMENT
];
@SuppressWarnings
(
"unchecked"
)
Vector
<
Object
>
newRunAttributeValues
[]
=
(
Vector
<
Object
>[])
new
Vector
<?>[
ARRAY_SIZE_INCREMENT
];
runStarts
=
newRunStarts
;
runAttributes
=
newRunAttributes
;
runAttributeValues
=
newRunAttributeValues
;
...
...
@@ -461,8 +468,13 @@ public class AttributedString {
if
(
runCount
==
runArraySize
)
{
int
newArraySize
=
runArraySize
+
ARRAY_SIZE_INCREMENT
;
int
newRunStarts
[]
=
new
int
[
newArraySize
];
Vector
newRunAttributes
[]
=
new
Vector
[
newArraySize
];
Vector
newRunAttributeValues
[]
=
new
Vector
[
newArraySize
];
@SuppressWarnings
(
"unchecked"
)
Vector
<
Attribute
>
newRunAttributes
[]
=
(
Vector
<
Attribute
>[])
new
Vector
<?>[
newArraySize
];
@SuppressWarnings
(
"unchecked"
)
Vector
<
Object
>
newRunAttributeValues
[]
=
(
Vector
<
Object
>[])
new
Vector
<?>[
newArraySize
];
for
(
int
i
=
0
;
i
<
runArraySize
;
i
++)
{
newRunStarts
[
i
]
=
runStarts
[
i
];
newRunAttributes
[
i
]
=
runAttributes
[
i
];
...
...
@@ -476,17 +488,17 @@ public class AttributedString {
// make copies of the attribute information of the old run that the new one used to be part of
// use temporary variables so things remain consistent in case of an exception
Vector
newRunAttributes
=
null
;
Vector
newRunAttributeValues
=
null
;
Vector
<
Attribute
>
newRunAttributes
=
null
;
Vector
<
Object
>
newRunAttributeValues
=
null
;
if
(
copyAttrs
)
{
Vector
oldRunAttributes
=
runAttributes
[
runIndex
-
1
];
Vector
oldRunAttributeValues
=
runAttributeValues
[
runIndex
-
1
];
Vector
<
Attribute
>
oldRunAttributes
=
runAttributes
[
runIndex
-
1
];
Vector
<
Object
>
oldRunAttributeValues
=
runAttributeValues
[
runIndex
-
1
];
if
(
oldRunAttributes
!=
null
)
{
newRunAttributes
=
(
Vector
)
oldRunAttributes
.
clone
(
);
newRunAttributes
=
new
Vector
<>(
oldRunAttributes
);
}
if
(
oldRunAttributeValues
!=
null
)
{
newRunAttributeValues
=
(
Vector
)
oldRunAttributeValues
.
clone
(
);
newRunAttributeValues
=
new
Vector
<>(
oldRunAttributeValues
);
}
}
...
...
@@ -511,8 +523,8 @@ public class AttributedString {
for
(
int
i
=
beginRunIndex
;
i
<
endRunIndex
;
i
++)
{
int
keyValueIndex
=
-
1
;
// index of key and value in our vectors; assume we don't have an entry yet
if
(
runAttributes
[
i
]
==
null
)
{
Vector
newRunAttributes
=
new
Vector
();
Vector
newRunAttributeValues
=
new
Vector
();
Vector
<
Attribute
>
newRunAttributes
=
new
Vector
<>
();
Vector
<
Object
>
newRunAttributeValues
=
new
Vector
<>
();
runAttributes
[
i
]
=
newRunAttributes
;
runAttributeValues
[
i
]
=
newRunAttributeValues
;
}
else
{
...
...
@@ -597,8 +609,8 @@ public class AttributedString {
}
private
synchronized
Object
getAttribute
(
Attribute
attribute
,
int
runIndex
)
{
Vector
currentRunAttributes
=
runAttributes
[
runIndex
];
Vector
currentRunAttributeValues
=
runAttributeValues
[
runIndex
];
Vector
<
Attribute
>
currentRunAttributes
=
runAttributes
[
runIndex
];
Vector
<
Object
>
currentRunAttributeValues
=
runAttributeValues
[
runIndex
];
if
(
currentRunAttributes
==
null
)
{
return
null
;
}
...
...
@@ -650,10 +662,10 @@ public class AttributedString {
}
// returns whether all specified attributes have equal values in the runs with the given indices
private
boolean
attributeValuesMatch
(
Set
attributes
,
int
runIndex1
,
int
runIndex2
)
{
Iterator
iterator
=
attributes
.
iterator
();
private
boolean
attributeValuesMatch
(
Set
<?
extends
Attribute
>
attributes
,
int
runIndex1
,
int
runIndex2
)
{
Iterator
<?
extends
Attribute
>
iterator
=
attributes
.
iterator
();
while
(
iterator
.
hasNext
())
{
Attribute
key
=
(
Attribute
)
iterator
.
next
();
Attribute
key
=
iterator
.
next
();
if
(!
valuesMatch
(
getAttribute
(
key
,
runIndex1
),
getAttribute
(
key
,
runIndex2
)))
{
return
false
;
}
...
...
@@ -690,7 +702,7 @@ public class AttributedString {
* (typically the end of the text) to the ones specified in attrs.
* This is only meant to be called from the constructor!
*/
private
void
setAttributes
(
Map
attrs
,
int
offset
)
{
private
void
setAttributes
(
Map
<
Attribute
,
Object
>
attrs
,
int
offset
)
{
if
(
runCount
==
0
)
{
createRunAttributeDataVectors
();
}
...
...
@@ -699,12 +711,12 @@ public class AttributedString {
int
size
;
if
(
attrs
!=
null
&&
(
size
=
attrs
.
size
())
>
0
)
{
Vector
runAttrs
=
new
Vector
(
size
);
Vector
runValues
=
new
Vector
(
size
);
Iterator
iterator
=
attrs
.
entrySet
().
iterator
();
Vector
<
Attribute
>
runAttrs
=
new
Vector
<>
(
size
);
Vector
<
Object
>
runValues
=
new
Vector
<>
(
size
);
Iterator
<
Map
.
Entry
<
Attribute
,
Object
>>
iterator
=
attrs
.
entrySet
().
iterator
();
while
(
iterator
.
hasNext
())
{
Map
.
Entry
entry
=
(
Map
.
Entry
)
iterator
.
next
();
Map
.
Entry
<
Attribute
,
Object
>
entry
=
iterator
.
next
();
runAttrs
.
add
(
entry
.
getKey
());
runValues
.
add
(
entry
.
getValue
());
...
...
@@ -717,7 +729,7 @@ public class AttributedString {
/**
* Returns true if the attributes specified in last and attrs differ.
*/
private
static
boolean
mapsDiffer
(
Map
last
,
Map
attrs
)
{
private
static
<
K
,
V
>
boolean
mapsDiffer
(
Map
<
K
,
V
>
last
,
Map
<
K
,
V
>
attrs
)
{
if
(
last
==
null
)
{
return
(
attrs
!=
null
&&
attrs
.
size
()
>
0
);
}
...
...
@@ -761,7 +773,7 @@ public class AttributedString {
this
.
currentIndex
=
beginIndex
;
updateRunInfo
();
if
(
attributes
!=
null
)
{
relevantAttributes
=
(
Attribute
[])
attributes
.
clone
();
relevantAttributes
=
attributes
.
clone
();
}
}
...
...
@@ -944,7 +956,7 @@ public class AttributedString {
if
(
runAttributes
==
null
||
currentRunIndex
==
-
1
||
runAttributes
[
currentRunIndex
]
==
null
)
{
// ??? would be nice to return null, but current spec doesn't allow it
// returning Hashtable saves AttributeMap from dealing with emptiness
return
new
Hashtable
();
return
new
Hashtable
<>
();
}
return
new
AttributeMap
(
currentRunIndex
,
beginIndex
,
endIndex
);
}
...
...
@@ -954,16 +966,16 @@ public class AttributedString {
if
(
runAttributes
==
null
)
{
// ??? would be nice to return null, but current spec doesn't allow it
// returning HashSet saves us from dealing with emptiness
return
new
HashSet
();
return
new
HashSet
<>
();
}
synchronized
(
AttributedString
.
this
)
{
// ??? should try to create this only once, then update if necessary,
// and give callers read-only view
Set
keys
=
new
HashSet
();
Set
<
Attribute
>
keys
=
new
HashSet
<>
();
int
i
=
0
;
while
(
i
<
runCount
)
{
if
(
runStarts
[
i
]
<
endIndex
&&
(
i
==
runCount
-
1
||
runStarts
[
i
+
1
]
>
beginIndex
))
{
Vector
currentRunAttributes
=
runAttributes
[
i
];
Vector
<
Attribute
>
currentRunAttributes
=
runAttributes
[
i
];
if
(
currentRunAttributes
!=
null
)
{
int
j
=
currentRunAttributes
.
size
();
while
(
j
--
>
0
)
{
...
...
@@ -1052,12 +1064,12 @@ public class AttributedString {
this
.
endIndex
=
endIndex
;
}
public
Set
entrySet
()
{
HashSet
set
=
new
HashSet
();
public
Set
<
Map
.
Entry
<
Attribute
,
Object
>>
entrySet
()
{
HashSet
<
Map
.
Entry
<
Attribute
,
Object
>>
set
=
new
HashSet
<>
();
synchronized
(
AttributedString
.
this
)
{
int
size
=
runAttributes
[
runIndex
].
size
();
for
(
int
i
=
0
;
i
<
size
;
i
++)
{
Attribute
key
=
(
Attribute
)
runAttributes
[
runIndex
].
get
(
i
);
Attribute
key
=
runAttributes
[
runIndex
].
get
(
i
);
Object
value
=
runAttributeValues
[
runIndex
].
get
(
i
);
if
(
value
instanceof
Annotation
)
{
value
=
AttributedString
.
this
.
getAttributeCheckRange
(
key
,
...
...
@@ -1066,7 +1078,8 @@ public class AttributedString {
continue
;
}
}
Map
.
Entry
entry
=
new
AttributeEntry
(
key
,
value
);
Map
.
Entry
<
Attribute
,
Object
>
entry
=
new
AttributeEntry
(
key
,
value
);
set
.
add
(
entry
);
}
}
...
...
@@ -1079,7 +1092,7 @@ public class AttributedString {
}
}
class
AttributeEntry
implements
Map
.
Entry
{
class
AttributeEntry
implements
Map
.
Entry
<
Attribute
,
Object
>
{
private
Attribute
key
;
private
Object
value
;
...
...
@@ -1098,7 +1111,7 @@ class AttributeEntry implements Map.Entry {
(
value
==
null
?
other
.
value
==
null
:
other
.
value
.
equals
(
value
));
}
public
Object
getKey
()
{
public
Attribute
getKey
()
{
return
key
;
}
...
...
src/share/classes/java/text/BreakDictionary.java
浏览文件 @
f8b2536d
...
...
@@ -145,9 +145,9 @@ class BreakDictionary {
BufferedInputStream
in
;
try
{
in
=
(
BufferedInputStream
)
AccessController
.
doPrivileged
(
new
PrivilegedExceptionAction
()
{
public
Object
run
()
throws
Exception
{
in
=
AccessController
.
doPrivileged
(
new
PrivilegedExceptionAction
<
BufferedInputStream
>
()
{
public
BufferedInputStream
run
()
throws
Exception
{
return
new
BufferedInputStream
(
getClass
().
getResourceAsStream
(
"/sun/text/resources/"
+
dictionaryName
));
}
}
...
...
src/share/classes/java/text/BreakIterator.java
浏览文件 @
f8b2536d
...
...
@@ -439,7 +439,9 @@ public abstract class BreakIterator implements Cloneable
private
static
final
int
WORD_INDEX
=
1
;
private
static
final
int
LINE_INDEX
=
2
;
private
static
final
int
SENTENCE_INDEX
=
3
;
private
static
final
SoftReference
[]
iterCache
=
new
SoftReference
[
4
];
@SuppressWarnings
(
"unchecked"
)
private
static
final
SoftReference
<
BreakIteratorCache
>[]
iterCache
=
(
SoftReference
<
BreakIteratorCache
>[])
new
SoftReference
<?>[
4
];
/**
* Returns a new <code>BreakIterator</code> instance
...
...
@@ -554,7 +556,7 @@ public abstract class BreakIterator implements Cloneable
String
dataName
,
String
dictionaryName
)
{
if
(
iterCache
[
type
]
!=
null
)
{
BreakIteratorCache
cache
=
(
BreakIteratorCache
)
iterCache
[
type
].
get
();
BreakIteratorCache
cache
=
iterCache
[
type
].
get
();
if
(
cache
!=
null
)
{
if
(
cache
.
getLocale
().
equals
(
locale
))
{
return
cache
.
createBreakInstance
();
...
...
@@ -567,13 +569,13 @@ public abstract class BreakIterator implements Cloneable
dataName
,
dictionaryName
);
BreakIteratorCache
cache
=
new
BreakIteratorCache
(
locale
,
result
);
iterCache
[
type
]
=
new
SoftReference
(
cache
);
iterCache
[
type
]
=
new
SoftReference
<>
(
cache
);
return
result
;
}
private
static
ResourceBundle
getBundle
(
final
String
baseName
,
final
Locale
locale
)
{
return
(
ResourceBundle
)
AccessController
.
doPrivileged
(
new
PrivilegedAction
()
{
public
Object
run
()
{
return
AccessController
.
doPrivileged
(
new
PrivilegedAction
<
ResourceBundle
>
()
{
public
ResourceBundle
run
()
{
return
ResourceBundle
.
getBundle
(
baseName
,
locale
);
}
});
...
...
src/share/classes/java/text/CharacterIteratorFieldDelegate.java
浏览文件 @
f8b2536d
...
...
@@ -41,7 +41,7 @@ class CharacterIteratorFieldDelegate implements Format.FieldDelegate {
* for existing regions result in invoking addAttribute on the existing
* AttributedStrings.
*/
private
ArrayList
attributedStrings
;
private
ArrayList
<
AttributedString
>
attributedStrings
;
/**
* Running count of the number of characters that have
* been encountered.
...
...
@@ -50,7 +50,7 @@ class CharacterIteratorFieldDelegate implements Format.FieldDelegate {
CharacterIteratorFieldDelegate
()
{
attributedStrings
=
new
ArrayList
();
attributedStrings
=
new
ArrayList
<>
();
}
public
void
formatted
(
Format
.
Field
attr
,
Object
value
,
int
start
,
int
end
,
...
...
@@ -62,7 +62,7 @@ class CharacterIteratorFieldDelegate implements Format.FieldDelegate {
int
asIndex
=
attributedStrings
.
size
()
-
1
;
while
(
start
<
index
)
{
AttributedString
as
=
(
AttributedString
)
attributedStrings
.
AttributedString
as
=
attributedStrings
.
get
(
asIndex
--);
int
newIndex
=
index
-
as
.
length
();
int
aStart
=
Math
.
max
(
0
,
start
-
newIndex
);
...
...
@@ -116,8 +116,8 @@ class CharacterIteratorFieldDelegate implements Format.FieldDelegate {
AttributedCharacterIterator
[
iCount
];
for
(
int
counter
=
0
;
counter
<
iCount
;
counter
++)
{
iterators
[
counter
]
=
((
AttributedString
)
attributedStrings
.
get
(
counter
)
)
.
getIterator
();
iterators
[
counter
]
=
attributedStrings
.
get
(
counter
).
getIterator
();
}
return
new
AttributedString
(
iterators
).
getIterator
();
}
...
...
src/share/classes/java/text/ChoiceFormat.java
浏览文件 @
f8b2536d
...
...
@@ -457,8 +457,8 @@ public class ChoiceFormat extends NumberFormat {
{
ChoiceFormat
other
=
(
ChoiceFormat
)
super
.
clone
();
// for primitives or immutables, shallow clone is enough
other
.
choiceLimits
=
(
double
[])
choiceLimits
.
clone
();
other
.
choiceFormats
=
(
String
[])
choiceFormats
.
clone
();
other
.
choiceLimits
=
choiceLimits
.
clone
();
other
.
choiceFormats
=
choiceFormats
.
clone
();
return
other
;
}
...
...
src/share/classes/java/text/CollationElementIterator.java
浏览文件 @
f8b2536d
...
...
@@ -412,6 +412,7 @@ public final class CollationElementIterator
* @param newOffset The new character offset into the original text.
* @since 1.2
*/
@SuppressWarnings
(
"deprecation"
)
// getBeginIndex, getEndIndex and setIndex are deprecated
public
void
setOffset
(
int
newOffset
)
{
if
(
text
!=
null
)
{
...
...
@@ -645,14 +646,14 @@ public final class CollationElementIterator
{
// First get the ordering of this single character,
// which is always the first element in the list
Vector
list
=
ordering
.
getContractValues
(
ch
);
EntryPair
pair
=
(
EntryPair
)
list
.
firstElement
();
Vector
<
EntryPair
>
list
=
ordering
.
getContractValues
(
ch
);
EntryPair
pair
=
list
.
firstElement
();
int
order
=
pair
.
value
;
// find out the length of the longest contracting character sequence in the list.
// There's logic in the builder code to make sure the longest sequence is always
// the last.
pair
=
(
EntryPair
)
list
.
lastElement
();
pair
=
list
.
lastElement
();
int
maxLength
=
pair
.
entryName
.
length
();
// (the Normalizer is cloned here so that the seeking we do in the next loop
...
...
@@ -684,7 +685,7 @@ public final class CollationElementIterator
// to this sequence
maxLength
=
1
;
for
(
int
i
=
list
.
size
()
-
1
;
i
>
0
;
i
--)
{
pair
=
(
EntryPair
)
list
.
elementAt
(
i
);
pair
=
list
.
elementAt
(
i
);
if
(!
pair
.
fwd
)
continue
;
...
...
@@ -721,11 +722,11 @@ public final class CollationElementIterator
// rather than off. Notice that we still use append() and startsWith() when
// working on the fragment. This is because the entry pairs that are used
// in reverse iteration have their names reversed already.
Vector
list
=
ordering
.
getContractValues
(
ch
);
EntryPair
pair
=
(
EntryPair
)
list
.
firstElement
();
Vector
<
EntryPair
>
list
=
ordering
.
getContractValues
(
ch
);
EntryPair
pair
=
list
.
firstElement
();
int
order
=
pair
.
value
;
pair
=
(
EntryPair
)
list
.
lastElement
();
pair
=
list
.
lastElement
();
int
maxLength
=
pair
.
entryName
.
length
();
NormalizerBase
tempText
=
(
NormalizerBase
)
text
.
clone
();
...
...
@@ -747,7 +748,7 @@ public final class CollationElementIterator
maxLength
=
1
;
for
(
int
i
=
list
.
size
()
-
1
;
i
>
0
;
i
--)
{
pair
=
(
EntryPair
)
list
.
elementAt
(
i
);
pair
=
list
.
elementAt
(
i
);
if
(
pair
.
fwd
)
continue
;
...
...
src/share/classes/java/text/DateFormat.java
浏览文件 @
f8b2536d
...
...
@@ -798,7 +798,7 @@ public abstract class DateFormat extends Format {
private
static
final
long
serialVersionUID
=
7441350119349544720L
;
// table of all instances in this class, used by readResolve
private
static
final
Map
instanceMap
=
new
HashMap
(
18
);
private
static
final
Map
<
String
,
Field
>
instanceMap
=
new
HashMap
<>
(
18
);
// Maps from Calendar constant (such as Calendar.ERA) to Field
// constant (such as Field.ERA).
private
static
final
Field
[]
calendarToFieldMapping
=
...
...
src/share/classes/java/text/DecimalFormat.java
浏览文件 @
f8b2536d
...
...
@@ -2051,7 +2051,7 @@ public class DecimalFormat extends NumberFormat {
* @return FieldPosition array of the resulting fields.
*/
private
FieldPosition
[]
expandAffix
(
String
pattern
)
{
ArrayList
positions
=
null
;
ArrayList
<
FieldPosition
>
positions
=
null
;
int
stringIndex
=
0
;
for
(
int
i
=
0
;
i
<
pattern
.
length
();
)
{
char
c
=
pattern
.
charAt
(
i
++);
...
...
@@ -2071,7 +2071,7 @@ public class DecimalFormat extends NumberFormat {
}
if
(
string
.
length
()
>
0
)
{
if
(
positions
==
null
)
{
positions
=
new
ArrayList
(
2
);
positions
=
new
ArrayList
<>
(
2
);
}
FieldPosition
fp
=
new
FieldPosition
(
Field
.
CURRENCY
);
fp
.
setBeginIndex
(
stringIndex
);
...
...
@@ -2098,7 +2098,7 @@ public class DecimalFormat extends NumberFormat {
}
if
(
fieldID
!=
null
)
{
if
(
positions
==
null
)
{
positions
=
new
ArrayList
(
2
);
positions
=
new
ArrayList
<>
(
2
);
}
FieldPosition
fp
=
new
FieldPosition
(
fieldID
,
field
);
fp
.
setBeginIndex
(
stringIndex
);
...
...
@@ -2109,7 +2109,7 @@ public class DecimalFormat extends NumberFormat {
stringIndex
++;
}
if
(
positions
!=
null
)
{
return
(
FieldPosition
[])
positions
.
toArray
(
EmptyFieldPositionArray
);
return
positions
.
toArray
(
EmptyFieldPositionArray
);
}
return
EmptyFieldPositionArray
;
}
...
...
src/share/classes/java/text/DictionaryBasedBreakIterator.java
浏览文件 @
f8b2536d
...
...
@@ -356,9 +356,9 @@ class DictionaryBasedBreakIterator extends RuleBasedBreakIterator {
// continues in this way until we either successfully make it all the way
// across the range, or exhaust all of our combinations of break
// positions.)
Stack
currentBreakPositions
=
new
Stack
();
Stack
possibleBreakPositions
=
new
Stack
();
Vector
wrongBreakPositions
=
new
Vector
();
Stack
<
Integer
>
currentBreakPositions
=
new
Stack
<>
();
Stack
<
Integer
>
possibleBreakPositions
=
new
Stack
<>
();
Vector
<
Integer
>
wrongBreakPositions
=
new
Vector
<>
();
// the dictionary is implemented as a trie, which is treated as a state
// machine. -1 represents the end of a legal word. Every word in the
...
...
@@ -374,7 +374,7 @@ class DictionaryBasedBreakIterator extends RuleBasedBreakIterator {
// farthest as real break positions, and then start over from scratch with
// the character where the error occurred.
int
farthestEndPoint
=
text
.
getIndex
();
Stack
bestBreakPositions
=
null
;
Stack
<
Integer
>
bestBreakPositions
=
null
;
// initialize (we always exit the loop with a break statement)
c
=
getCurrent
();
...
...
@@ -409,7 +409,11 @@ class DictionaryBasedBreakIterator extends RuleBasedBreakIterator {
// case there's an error in the text
if
(
text
.
getIndex
()
>
farthestEndPoint
)
{
farthestEndPoint
=
text
.
getIndex
();
bestBreakPositions
=
(
Stack
)(
currentBreakPositions
.
clone
());
@SuppressWarnings
(
"unchecked"
)
Stack
<
Integer
>
currentBreakPositionsCopy
=
(
Stack
<
Integer
>)
currentBreakPositions
.
clone
();
bestBreakPositions
=
currentBreakPositionsCopy
;
}
// wrongBreakPositions is a list of all break positions
...
...
@@ -448,7 +452,7 @@ class DictionaryBasedBreakIterator extends RuleBasedBreakIterator {
}
else
{
if
((
currentBreakPositions
.
size
()
==
0
||
((
Integer
)(
currentBreakPositions
.
peek
())
).
intValue
()
!=
text
.
getIndex
())
currentBreakPositions
.
peek
(
).
intValue
()
!=
text
.
getIndex
())
&&
text
.
getIndex
()
!=
startPos
)
{
currentBreakPositions
.
push
(
new
Integer
(
text
.
getIndex
()));
}
...
...
@@ -463,15 +467,15 @@ class DictionaryBasedBreakIterator extends RuleBasedBreakIterator {
// it. Then back up to that position and start over from there (i.e.,
// treat that position as the beginning of a new word)
else
{
Integer
temp
=
(
Integer
)
possibleBreakPositions
.
pop
();
Object
temp2
=
null
;
Integer
temp
=
possibleBreakPositions
.
pop
();
Integer
temp2
=
null
;
while
(!
currentBreakPositions
.
isEmpty
()
&&
temp
.
intValue
()
<
((
Integer
)
currentBreakPositions
.
peek
()
).
intValue
())
{
currentBreakPositions
.
peek
(
).
intValue
())
{
temp2
=
currentBreakPositions
.
pop
();
wrongBreakPositions
.
addElement
(
temp2
);
}
currentBreakPositions
.
push
(
temp
);
text
.
setIndex
(
((
Integer
)
currentBreakPositions
.
peek
()
).
intValue
());
text
.
setIndex
(
currentBreakPositions
.
peek
(
).
intValue
());
}
// re-sync "c" for the next go-round, and drop out of the loop if
...
...
@@ -507,7 +511,7 @@ class DictionaryBasedBreakIterator extends RuleBasedBreakIterator {
cachedBreakPositions
[
0
]
=
startPos
;
for
(
int
i
=
0
;
i
<
currentBreakPositions
.
size
();
i
++)
{
cachedBreakPositions
[
i
+
1
]
=
((
Integer
)
currentBreakPositions
.
elementAt
(
i
)
).
intValue
();
cachedBreakPositions
[
i
+
1
]
=
currentBreakPositions
.
elementAt
(
i
).
intValue
();
}
positionInCache
=
0
;
}
...
...
src/share/classes/java/text/MergeCollation.java
浏览文件 @
f8b2536d
...
...
@@ -88,19 +88,19 @@ final class MergeCollation {
public
String
getPattern
(
boolean
withWhiteSpace
)
{
StringBuffer
result
=
new
StringBuffer
();
PatternEntry
tmp
=
null
;
ArrayList
extList
=
null
;
ArrayList
<
PatternEntry
>
extList
=
null
;
int
i
;
for
(
i
=
0
;
i
<
patterns
.
size
();
++
i
)
{
PatternEntry
entry
=
(
PatternEntry
)
patterns
.
get
(
i
);
PatternEntry
entry
=
patterns
.
get
(
i
);
if
(
entry
.
extension
.
length
()
!=
0
)
{
if
(
extList
==
null
)
extList
=
new
ArrayList
();
extList
=
new
ArrayList
<>
();
extList
.
add
(
entry
);
}
else
{
if
(
extList
!=
null
)
{
PatternEntry
last
=
findLastWithNoExtension
(
i
-
1
);
for
(
int
j
=
extList
.
size
()
-
1
;
j
>=
0
;
j
--)
{
tmp
=
(
PatternEntry
)(
extList
.
get
(
j
)
);
tmp
=
extList
.
get
(
j
);
tmp
.
addToBuffer
(
result
,
false
,
withWhiteSpace
,
last
);
}
extList
=
null
;
...
...
@@ -111,7 +111,7 @@ final class MergeCollation {
if
(
extList
!=
null
)
{
PatternEntry
last
=
findLastWithNoExtension
(
i
-
1
);
for
(
int
j
=
extList
.
size
()
-
1
;
j
>=
0
;
j
--)
{
tmp
=
(
PatternEntry
)(
extList
.
get
(
j
)
);
tmp
=
extList
.
get
(
j
);
tmp
.
addToBuffer
(
result
,
false
,
withWhiteSpace
,
last
);
}
extList
=
null
;
...
...
@@ -121,7 +121,7 @@ final class MergeCollation {
private
final
PatternEntry
findLastWithNoExtension
(
int
i
)
{
for
(--
i
;
i
>=
0
;
--
i
)
{
PatternEntry
entry
=
(
PatternEntry
)
patterns
.
get
(
i
);
PatternEntry
entry
=
patterns
.
get
(
i
);
if
(
entry
.
extension
.
length
()
==
0
)
{
return
entry
;
}
...
...
@@ -149,7 +149,7 @@ final class MergeCollation {
StringBuffer
result
=
new
StringBuffer
();
for
(
int
i
=
0
;
i
<
patterns
.
size
();
++
i
)
{
PatternEntry
entry
=
(
PatternEntry
)
patterns
.
get
(
i
);
PatternEntry
entry
=
patterns
.
get
(
i
);
if
(
entry
!=
null
)
{
entry
.
addToBuffer
(
result
,
true
,
withWhiteSpace
,
null
);
}
...
...
@@ -198,13 +198,13 @@ final class MergeCollation {
* @return the requested pattern entry
*/
public
PatternEntry
getItemAt
(
int
index
)
{
return
(
PatternEntry
)
patterns
.
get
(
index
);
return
patterns
.
get
(
index
);
}
//============================================================
// privates
//============================================================
ArrayList
patterns
=
new
ArrayList
();
// a list of PatternEntries
ArrayList
<
PatternEntry
>
patterns
=
new
ArrayList
<>
();
// a list of PatternEntries
private
transient
PatternEntry
saveEntry
=
null
;
private
transient
PatternEntry
lastEntry
=
null
;
...
...
@@ -326,7 +326,7 @@ final class MergeCollation {
}
else
{
int
i
;
for
(
i
=
patterns
.
size
()
-
1
;
i
>=
0
;
--
i
)
{
PatternEntry
e
=
(
PatternEntry
)
patterns
.
get
(
i
);
PatternEntry
e
=
patterns
.
get
(
i
);
if
(
e
.
chars
.
regionMatches
(
0
,
entry
.
chars
,
0
,
e
.
chars
.
length
()))
{
excessChars
.
append
(
entry
.
chars
.
substring
(
e
.
chars
.
length
(),
...
...
src/share/classes/java/text/MessageFormat.java
浏览文件 @
f8b2536d
...
...
@@ -422,6 +422,7 @@ public class MessageFormat extends Format {
* @param pattern the pattern for this message format
* @exception IllegalArgumentException if the pattern is invalid
*/
@SuppressWarnings
(
"fallthrough"
)
// fallthrough in switch is expected, suppress it
public
void
applyPattern
(
String
pattern
)
{
StringBuilder
[]
segments
=
new
StringBuilder
[
4
];
// Allocate only segments[SEG_RAW] here. The rest are
...
...
@@ -897,7 +898,7 @@ public class MessageFormat extends Format {
*/
public
AttributedCharacterIterator
formatToCharacterIterator
(
Object
arguments
)
{
StringBuffer
result
=
new
StringBuffer
();
ArrayList
iterators
=
new
ArrayList
();
ArrayList
<
AttributedCharacterIterator
>
iterators
=
new
ArrayList
<>
();
if
(
arguments
==
null
)
{
throw
new
NullPointerException
(
...
...
@@ -908,7 +909,7 @@ public class MessageFormat extends Format {
return
createAttributedCharacterIterator
(
""
);
}
return
createAttributedCharacterIterator
(
(
AttributedCharacterIterator
[])
iterators
.
toArray
(
iterators
.
toArray
(
new
AttributedCharacterIterator
[
iterators
.
size
()]));
}
...
...
@@ -1074,14 +1075,14 @@ public class MessageFormat extends Format {
MessageFormat
other
=
(
MessageFormat
)
super
.
clone
();
// clone arrays. Can't do with utility because of bug in Cloneable
other
.
formats
=
(
Format
[])
formats
.
clone
();
// shallow clone
other
.
formats
=
formats
.
clone
();
// shallow clone
for
(
int
i
=
0
;
i
<
formats
.
length
;
++
i
)
{
if
(
formats
[
i
]
!=
null
)
other
.
formats
[
i
]
=
(
Format
)
formats
[
i
].
clone
();
}
// for primitives or immutables, shallow clone is enough
other
.
offsets
=
(
int
[])
offsets
.
clone
();
other
.
argumentNumbers
=
(
int
[])
argumentNumbers
.
clone
();
other
.
offsets
=
offsets
.
clone
();
other
.
argumentNumbers
=
argumentNumbers
.
clone
();
return
other
;
}
...
...
@@ -1224,7 +1225,7 @@ public class MessageFormat extends Format {
* expected by the format element(s) that use it.
*/
private
StringBuffer
subformat
(
Object
[]
arguments
,
StringBuffer
result
,
FieldPosition
fp
,
List
characterIterators
)
{
FieldPosition
fp
,
List
<
AttributedCharacterIterator
>
characterIterators
)
{
// note: this implementation assumes a fast substring & index.
// if this is not true, would be better to append chars one by one.
int
lastOffset
=
0
;
...
...
src/share/classes/java/text/NumberFormat.java
浏览文件 @
f8b2536d
...
...
@@ -756,7 +756,7 @@ public abstract class NumberFormat extends Format {
}
/* try the cache first */
String
[]
numberPatterns
=
(
String
[])
cachedLocaleData
.
get
(
desiredLocale
);
String
[]
numberPatterns
=
cachedLocaleData
.
get
(
desiredLocale
);
if
(
numberPatterns
==
null
)
{
/* cache miss */
ResourceBundle
resource
=
LocaleData
.
getNumberFormatData
(
desiredLocale
);
numberPatterns
=
resource
.
getStringArray
(
"NumberPatterns"
);
...
...
@@ -844,7 +844,7 @@ public abstract class NumberFormat extends Format {
/**
* Cache to hold the NumberPatterns of a Locale.
*/
private
static
final
Hashtable
cachedLocaleData
=
new
Hashtable
(
3
);
private
static
final
Hashtable
<
Locale
,
String
[]>
cachedLocaleData
=
new
Hashtable
<>
(
3
);
// Constants used by factory methods to specify a style of format.
private
static
final
int
NUMBERSTYLE
=
0
;
...
...
@@ -1035,7 +1035,7 @@ public abstract class NumberFormat extends Format {
private
static
final
long
serialVersionUID
=
7494728892700160890L
;
// table of all instances in this class, used by readResolve
private
static
final
Map
instanceMap
=
new
HashMap
(
11
);
private
static
final
Map
<
String
,
Field
>
instanceMap
=
new
HashMap
<>
(
11
);
/**
* Creates a Field instance with the specified
...
...
src/share/classes/java/text/ParseException.java
浏览文件 @
f8b2536d
...
...
@@ -49,6 +49,8 @@ package java.text;
public
class
ParseException
extends
Exception
{
private
static
final
long
serialVersionUID
=
2703218443322787634L
;
/**
* Constructs a ParseException with the specified detail message and
* offset.
...
...
src/share/classes/java/text/RBCollationTables.java
浏览文件 @
f8b2536d
...
...
@@ -112,8 +112,8 @@ final class RBCollationTables {
void
fillInTables
(
boolean
f2ary
,
boolean
swap
,
UCompactIntArray
map
,
Vector
cTbl
,
Vector
eTbl
,
Vector
<
Vector
<
EntryPair
>>
cTbl
,
Vector
<
int
[]>
eTbl
,
IntHashtable
cFlgs
,
short
mso
,
short
mto
)
{
...
...
@@ -155,18 +155,18 @@ final class RBCollationTables {
* table.
* @param ch the starting character of the contracting string
*/
Vector
getContractValues
(
int
ch
)
Vector
<
EntryPair
>
getContractValues
(
int
ch
)
{
int
index
=
mapping
.
elementAt
(
ch
);
return
getContractValuesImpl
(
index
-
CONTRACTCHARINDEX
);
}
//get contract values from contractTable by index
private
Vector
getContractValuesImpl
(
int
index
)
private
Vector
<
EntryPair
>
getContractValuesImpl
(
int
index
)
{
if
(
index
>=
0
)
{
return
(
Vector
)
contractTable
.
elementAt
(
index
);
return
contractTable
.
elementAt
(
index
);
}
else
// not found
{
...
...
@@ -202,7 +202,7 @@ final class RBCollationTables {
// this could cause a performance problem, but in practise that
// rarely happens
for
(
int
i
=
0
;
i
<
expandTable
.
size
();
i
++)
{
int
[]
valueList
=
(
int
[])
expandTable
.
elementAt
(
i
);
int
[]
valueList
=
expandTable
.
elementAt
(
i
);
int
length
=
valueList
.
length
;
if
(
length
>
result
&&
valueList
[
length
-
1
]
==
order
)
{
...
...
@@ -220,7 +220,7 @@ final class RBCollationTables {
* @param idx the index of the expanding string value list
*/
final
int
[]
getExpandValueList
(
int
order
)
{
return
(
int
[])
expandTable
.
elementAt
(
order
-
EXPANDCHARINDEX
);
return
expandTable
.
elementAt
(
order
-
EXPANDCHARINDEX
);
}
/**
...
...
@@ -260,9 +260,9 @@ final class RBCollationTables {
}
}
final
static
int
getEntry
(
Vector
list
,
String
name
,
boolean
fwd
)
{
final
static
int
getEntry
(
Vector
<
EntryPair
>
list
,
String
name
,
boolean
fwd
)
{
for
(
int
i
=
0
;
i
<
list
.
size
();
i
++)
{
EntryPair
pair
=
(
EntryPair
)
list
.
elementAt
(
i
);
EntryPair
pair
=
list
.
elementAt
(
i
);
if
(
pair
.
fwd
==
fwd
&&
pair
.
entryName
.
equals
(
name
))
{
return
i
;
}
...
...
@@ -294,8 +294,8 @@ final class RBCollationTables {
private
boolean
seAsianSwapping
=
false
;
private
UCompactIntArray
mapping
=
null
;
private
Vector
contractTable
=
null
;
private
Vector
expandTable
=
null
;
private
Vector
<
Vector
<
EntryPair
>>
contractTable
=
null
;
private
Vector
<
int
[]>
expandTable
=
null
;
private
IntHashtable
contractFlags
=
null
;
private
short
maxSecOrder
=
0
;
...
...
src/share/classes/java/text/RBTableBuilder.java
浏览文件 @
f8b2536d
...
...
@@ -85,7 +85,7 @@ final class RBTableBuilder {
throw
new
ParseException
(
"Build rules empty."
,
0
);
// This array maps Unicode characters to their collation ordering
mapping
=
new
UCompactIntArray
(
(
int
)
RBCollationTables
.
UNMAPPED
);
mapping
=
new
UCompactIntArray
(
RBCollationTables
.
UNMAPPED
);
// Normalize the build rules. Find occurances of all decomposed characters
// and normalize the rules before feeding into the builder. By "normalize",
// we mean that all precomposed Unicode characters must be converted into
...
...
@@ -263,7 +263,7 @@ final class RBTableBuilder {
{
if
(
expandTable
!=
null
)
{
for
(
int
i
=
0
;
i
<
expandTable
.
size
();
i
++)
{
int
[]
valueList
=
(
int
[])
expandTable
.
elementAt
(
i
);
int
[]
valueList
=
expandTable
.
elementAt
(
i
);
for
(
int
j
=
0
;
j
<
valueList
.
length
;
j
++)
{
int
order
=
valueList
[
j
];
if
(
order
<
RBCollationTables
.
EXPANDCHARINDEX
&&
order
>
CHARINDEX
)
{
...
...
@@ -354,7 +354,7 @@ final class RBTableBuilder {
boolean
fwd
)
{
if
(
contractTable
==
null
)
{
contractTable
=
new
Vector
(
INITIALTABLESIZE
);
contractTable
=
new
Vector
<>
(
INITIALTABLESIZE
);
}
//initial character
...
...
@@ -366,12 +366,12 @@ final class RBTableBuilder {
*/
// See if the initial character of the string already has a contract table.
int
entry
=
mapping
.
elementAt
(
ch
);
Vector
entryTable
=
getContractValuesImpl
(
entry
-
RBCollationTables
.
CONTRACTCHARINDEX
);
Vector
<
EntryPair
>
entryTable
=
getContractValuesImpl
(
entry
-
RBCollationTables
.
CONTRACTCHARINDEX
);
if
(
entryTable
==
null
)
{
// We need to create a new table of contract entries for this base char
int
tableIndex
=
RBCollationTables
.
CONTRACTCHARINDEX
+
contractTable
.
size
();
entryTable
=
new
Vector
(
INITIALTABLESIZE
);
entryTable
=
new
Vector
<>
(
INITIALTABLESIZE
);
contractTable
.
addElement
(
entryTable
);
// Add the initial character's current ordering first. then
...
...
@@ -383,10 +383,10 @@ final class RBTableBuilder {
// Now add (or replace) this string in the table
int
index
=
RBCollationTables
.
getEntry
(
entryTable
,
groupChars
,
fwd
);
if
(
index
!=
RBCollationTables
.
UNMAPPED
)
{
EntryPair
pair
=
(
EntryPair
)
entryTable
.
elementAt
(
index
);
EntryPair
pair
=
entryTable
.
elementAt
(
index
);
pair
.
value
=
anOrder
;
}
else
{
EntryPair
pair
=
(
EntryPair
)
entryTable
.
lastElement
();
EntryPair
pair
=
entryTable
.
lastElement
();
// NOTE: This little bit of logic is here to speed CollationElementIterator
// .nextContractChar(). This code ensures that the longest sequence in
...
...
@@ -426,11 +426,11 @@ final class RBTableBuilder {
int ch = Character.isHighSurrogate(ch0)?
Character.toCodePoint(ch0, groupChars.charAt(1)):ch0;
*/
Vector
entryTable
=
getContractValues
(
ch
);
Vector
<
EntryPair
>
entryTable
=
getContractValues
(
ch
);
if
(
entryTable
!=
null
)
{
int
index
=
RBCollationTables
.
getEntry
(
entryTable
,
groupChars
,
true
);
if
(
index
!=
RBCollationTables
.
UNMAPPED
)
{
EntryPair
pair
=
(
EntryPair
)
entryTable
.
elementAt
(
index
);
EntryPair
pair
=
entryTable
.
elementAt
(
index
);
result
=
pair
.
value
;
}
}
...
...
@@ -442,8 +442,8 @@ final class RBTableBuilder {
int
order
=
mapping
.
elementAt
(
ch
);
if
(
order
>=
RBCollationTables
.
CONTRACTCHARINDEX
)
{
Vector
groupList
=
getContractValuesImpl
(
order
-
RBCollationTables
.
CONTRACTCHARINDEX
);
EntryPair
pair
=
(
EntryPair
)
groupList
.
firstElement
();
Vector
<
EntryPair
>
groupList
=
getContractValuesImpl
(
order
-
RBCollationTables
.
CONTRACTCHARINDEX
);
EntryPair
pair
=
groupList
.
firstElement
();
order
=
pair
.
value
;
}
return
order
;
...
...
@@ -454,17 +454,17 @@ final class RBTableBuilder {
* table.
* @param ch the starting character of the contracting string
*/
private
Vector
getContractValues
(
int
ch
)
private
Vector
<
EntryPair
>
getContractValues
(
int
ch
)
{
int
index
=
mapping
.
elementAt
(
ch
);
return
getContractValuesImpl
(
index
-
RBCollationTables
.
CONTRACTCHARINDEX
);
}
private
Vector
getContractValuesImpl
(
int
index
)
private
Vector
<
EntryPair
>
getContractValuesImpl
(
int
index
)
{
if
(
index
>=
0
)
{
return
(
Vector
)
contractTable
.
elementAt
(
index
);
return
contractTable
.
elementAt
(
index
);
}
else
// not found
{
...
...
@@ -513,7 +513,7 @@ final class RBTableBuilder {
*/
private
int
addExpansion
(
int
anOrder
,
String
expandChars
)
{
if
(
expandTable
==
null
)
{
expandTable
=
new
Vector
(
INITIALTABLESIZE
);
expandTable
=
new
Vector
<>
(
INITIALTABLESIZE
);
}
// If anOrder is valid, we want to add it at the beginning of the list
...
...
@@ -610,8 +610,8 @@ final class RBTableBuilder {
private
boolean
seAsianSwapping
=
false
;
private
UCompactIntArray
mapping
=
null
;
private
Vector
contractTable
=
null
;
private
Vector
expandTable
=
null
;
private
Vector
<
Vector
<
EntryPair
>>
contractTable
=
null
;
private
Vector
<
int
[]>
expandTable
=
null
;
private
short
maxSecOrder
=
0
;
private
short
maxTerOrder
=
0
;
...
...
src/share/classes/java/text/RuleBasedBreakIterator.java
浏览文件 @
f8b2536d
...
...
@@ -444,9 +444,9 @@ class RuleBasedBreakIterator extends BreakIterator {
BufferedInputStream
is
;
try
{
is
=
(
BufferedInputStream
)
AccessController
.
doPrivileged
(
new
PrivilegedExceptionAction
()
{
public
Object
run
()
throws
Exception
{
is
=
AccessController
.
doPrivileged
(
new
PrivilegedExceptionAction
<
BufferedInputStream
>
()
{
public
BufferedInputStream
run
()
throws
Exception
{
return
new
BufferedInputStream
(
getClass
().
getResourceAsStream
(
"/sun/text/resources/"
+
datafile
));
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录