提交 97a0c859 编写于 作者: V valeriep

Merge

...@@ -218,9 +218,7 @@ ifeq ($(JAVAC_WARNINGS_FATAL), true) ...@@ -218,9 +218,7 @@ ifeq ($(JAVAC_WARNINGS_FATAL), true)
BOOT_JAVACFLAGS += -Werror BOOT_JAVACFLAGS += -Werror
endif endif
BOOT_SOURCE_LANGUAGE_VERSION = 6 BOOT_JAVACFLAGS += -encoding ascii
BOOT_TARGET_CLASS_VERSION = 6
BOOT_JAVACFLAGS += -encoding ascii -source $(BOOT_SOURCE_LANGUAGE_VERSION) -target $(BOOT_TARGET_CLASS_VERSION)
BOOT_JAR_JFLAGS += $(JAR_JFLAGS) BOOT_JAR_JFLAGS += $(JAR_JFLAGS)
BOOT_JAVACFLAGS += $(NO_PROPRIETARY_API_WARNINGS) BOOT_JAVACFLAGS += $(NO_PROPRIETARY_API_WARNINGS)
......
...@@ -191,7 +191,7 @@ endif ...@@ -191,7 +191,7 @@ endif
# Generic # Generic
REQUIRED_ANT_VER = 1.7.1 REQUIRED_ANT_VER = 1.7.1
REQUIRED_BOOT_VER = 1.6 REQUIRED_BOOT_VER = 1.7
REQUIRED_FREETYPE_VERSION = 2.3.0 REQUIRED_FREETYPE_VERSION = 2.3.0
REQUIRED_MAKE_VER = 3.81 REQUIRED_MAKE_VER = 3.81
REQUIRED_UNZIP_VER = 5.12 REQUIRED_UNZIP_VER = 5.12
......
...@@ -28,6 +28,8 @@ ...@@ -28,6 +28,8 @@
# #
BUILDDIR = .. BUILDDIR = ..
SUBDIRS_MAKEFLAGS += JAVAC_MAX_WARNINGS=true JAVAC_WARNINGS_FATAL=true
include $(BUILDDIR)/common/Defs.gmk include $(BUILDDIR)/common/Defs.gmk
# Note: freetypecheck is built by Sanity.gmk if needed # Note: freetypecheck is built by Sanity.gmk if needed
......
/* /*
* Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -114,8 +114,8 @@ public class BuildMetaIndex { ...@@ -114,8 +114,8 @@ public class BuildMetaIndex {
*/ */
out.println(jmi.getJarFileKind().getMarkerChar() + " " + filename); out.println(jmi.getJarFileKind().getMarkerChar() + " " + filename);
for (Iterator<String> iter = index.iterator(); iter.hasNext(); ) { for (String entry : index) {
out.println(iter.next()); out.println(entry);
} }
} }
...@@ -171,8 +171,7 @@ class JarMetaIndex { ...@@ -171,8 +171,7 @@ class JarMetaIndex {
* A hashmap contains a mapping from the prefix string to * A hashmap contains a mapping from the prefix string to
* a hashset which contains a set of the second level of prefix string. * a hashset which contains a set of the second level of prefix string.
*/ */
private HashMap<String, HashSet<String>> knownPrefixMap = new private HashMap<String, HashSet<String>> knownPrefixMap = new HashMap<>();
HashMap<String, HashSet<String>>();
/* /*
* We add maximum 5 second level entries to "sun", "java" and * We add maximum 5 second level entries to "sun", "java" and
...@@ -195,12 +194,12 @@ class JarMetaIndex { ...@@ -195,12 +194,12 @@ class JarMetaIndex {
if (indexSet == null) { if (indexSet == null) {
synchronized(this) { synchronized(this) {
if (indexSet == null) { if (indexSet == null) {
indexSet = new HashSet<String>(); indexSet = new HashSet<>();
Enumeration entries = jar.entries(); Enumeration<JarEntry> entries = jar.entries();
boolean containsOnlyClass = true; boolean containsOnlyClass = true;
boolean containsOnlyResource = true; boolean containsOnlyResource = true;
while (entries.hasMoreElements()) { while (entries.hasMoreElements()) {
JarEntry entry = (JarEntry) entries.nextElement(); JarEntry entry = entries.nextElement();
String name = entry.getName(); String name = entry.getName();
/* We only look at the non-directory entry. /* We only look at the non-directory entry.
MANIFEST file is also skipped. */ MANIFEST file is also skipped. */
...@@ -338,9 +337,7 @@ class JarMetaIndex { ...@@ -338,9 +337,7 @@ class JarMetaIndex {
/* Iterate through the hash map, add the second level package names /* Iterate through the hash map, add the second level package names
* to the indexSet if has any. * to the indexSet if has any.
*/ */
for (Iterator<String> keysIterator = knownPrefixMap.keySet().iterator(); for (String key : knownPrefixMap.keySet()) {
keysIterator.hasNext();) {
String key = keysIterator.next();
HashSet<String> pkgSetStartsWithKey = knownPrefixMap.get(key); HashSet<String> pkgSetStartsWithKey = knownPrefixMap.get(key);
int setSize = pkgSetStartsWithKey.size(); int setSize = pkgSetStartsWithKey.size();
...@@ -353,9 +350,8 @@ class JarMetaIndex { ...@@ -353,9 +350,8 @@ class JarMetaIndex {
/* If the set contains less than MAX_PKGS_WITH_KNOWN_PREFIX, add /* If the set contains less than MAX_PKGS_WITH_KNOWN_PREFIX, add
* them to the indexSet of the MetaIndex object. * them to the indexSet of the MetaIndex object.
*/ */
for (Iterator<String> secondPkgElements = pkgSetStartsWithKey.iterator(); for (String secondPkgElement : pkgSetStartsWithKey) {
secondPkgElements.hasNext();) { indexSet.add(key + "/" + secondPkgElement);
indexSet.add(key + "/" + secondPkgElements.next());
} }
} }
} // end the outer "for" } // end the outer "for"
......
/* /*
* Copyright (c) 2002, 2005, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -36,7 +36,6 @@ import java.io.Writer; ...@@ -36,7 +36,6 @@ import java.io.Writer;
import java.text.MessageFormat; import java.text.MessageFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Properties; import java.util.Properties;
...@@ -223,18 +222,16 @@ public class CompileProperties { ...@@ -223,18 +222,16 @@ public class CompileProperties {
if ( ok ) { if ( ok ) {
String packageName = inferPackageName(propertiesPath, outputPath); String packageName = inferPackageName(propertiesPath, outputPath);
System.out.println("inferred package name: " + packageName); System.out.println("inferred package name: " + packageName);
List<String> sortedKeys = new ArrayList<String>(); List<String> sortedKeys = new ArrayList<>();
for ( Object key : p.keySet() ) { for ( Object key : p.keySet() ) {
sortedKeys.add((String)key); sortedKeys.add((String)key);
} }
Collections.sort(sortedKeys); Collections.sort(sortedKeys);
Iterator keys = sortedKeys.iterator();
StringBuffer data = new StringBuffer(); StringBuffer data = new StringBuffer();
while (keys.hasNext()) { for (String key : sortedKeys) {
Object key = keys.next(); data.append(" { \"" + escape(key) + "\", \"" +
data.append(" { \"" + escape((String)key) + "\", \"" +
escape((String)p.get(key)) + "\" },\n"); escape((String)p.get(key)) + "\" },\n");
} }
......
/* /*
* Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -164,7 +164,7 @@ public class DirDiff implements Runnable { ...@@ -164,7 +164,7 @@ public class DirDiff implements Runnable {
} }
File[] currentGoldenDirs = null; File[] currentGoldenDirs = null;
TreeSet goldDirSet = new TreeSet(); TreeSet<String> goldDirSet = new TreeSet<>();
if (goldenDir != null) { if (goldenDir != null) {
currentGoldenDirs = goldenDir.listFiles(); currentGoldenDirs = goldenDir.listFiles();
for (int i=0; i<currentGoldenDirs.length; i++) { for (int i=0; i<currentGoldenDirs.length; i++) {
......
/* /*
* Copyright (c) 1998, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -63,9 +63,9 @@ class DTDBuilder extends DTD { ...@@ -63,9 +63,9 @@ class DTDBuilder extends DTD {
static PublicMapping mapping = null; static PublicMapping mapping = null;
// Hash from name to Integer // Hash from name to Integer
private Hashtable namesHash = new Hashtable(); private Hashtable<String, Integer> namesHash = new Hashtable<>();
// Vector of all names // Vector of all names
private Vector namesVector = new Vector(); private Vector<String> namesVector = new Vector<>();
/** /**
* Create a new DTD. * Create a new DTD.
...@@ -87,15 +87,15 @@ class DTDBuilder extends DTD { ...@@ -87,15 +87,15 @@ class DTDBuilder extends DTD {
int numNames = namesVector.size(); int numNames = namesVector.size();
out.writeShort((short) (namesVector.size())); out.writeShort((short) (namesVector.size()));
for (int i = 0; i < namesVector.size(); i++) { for (int i = 0; i < namesVector.size(); i++) {
String nm = (String) namesVector.elementAt(i); String nm = namesVector.elementAt(i);
out.writeUTF(nm); out.writeUTF(nm);
} }
saveEntities(out); saveEntities(out);
out.writeShort((short) (elements.size())); out.writeShort((short) (elements.size()));
for (Enumeration e = elements.elements() ; e.hasMoreElements() ; ) { for (Enumeration<Element> e = elements.elements() ; e.hasMoreElements() ; ) {
saveElement(out, (Element)e.nextElement()); saveElement(out, e.nextElement());
} }
if (namesVector.size() != numNames) { if (namesVector.size() != numNames) {
...@@ -106,21 +106,21 @@ class DTDBuilder extends DTD { ...@@ -106,21 +106,21 @@ class DTDBuilder extends DTD {
} }
private void buildNamesTable() { private void buildNamesTable() {
for (Enumeration e = entityHash.elements() ; e.hasMoreElements() ; ) { for (Enumeration<Entity> e = entityHash.elements() ; e.hasMoreElements() ; ) {
Entity ent = (Entity) e.nextElement(); Entity ent = e.nextElement();
// Do even if not isGeneral(). That way, exclusions and inclusions // Do even if not isGeneral(). That way, exclusions and inclusions
// will definitely have their element. // will definitely have their element.
getNameId(ent.getName()); getNameId(ent.getName());
} }
for (Enumeration e = elements.elements() ; e.hasMoreElements() ; ) { for (Enumeration<Element> e = elements.elements() ; e.hasMoreElements() ; ) {
Element el = (Element) e.nextElement(); Element el = e.nextElement();
getNameId(el.getName()); getNameId(el.getName());
for (AttributeList atts = el.getAttributes() ; atts != null ; atts = atts.getNext()) { for (AttributeList atts = el.getAttributes() ; atts != null ; atts = atts.getNext()) {
getNameId(atts.getName()); getNameId(atts.getName());
if (atts.getValue() != null) { if (atts.getValue() != null) {
getNameId(atts.getValue()); getNameId(atts.getValue());
} }
Enumeration vals = atts.getValues(); Enumeration<?> vals = atts.getValues();
while (vals != null && vals.hasMoreElements()) { while (vals != null && vals.hasMoreElements()) {
String s = (String) vals.nextElement(); String s = (String) vals.nextElement();
getNameId(s); getNameId(s);
...@@ -133,9 +133,9 @@ class DTDBuilder extends DTD { ...@@ -133,9 +133,9 @@ class DTDBuilder extends DTD {
// The the id of a name from the list of names // The the id of a name from the list of names
// //
private short getNameId(String name) { private short getNameId(String name) {
Object o = namesHash.get(name); Integer o = namesHash.get(name);
if (o != null) { if (o != null) {
return (short) ((Integer) o).intValue(); return (short) o.intValue();
} }
int i = namesVector.size(); int i = namesVector.size();
namesVector.addElement(name); namesVector.addElement(name);
...@@ -149,16 +149,16 @@ class DTDBuilder extends DTD { ...@@ -149,16 +149,16 @@ class DTDBuilder extends DTD {
*/ */
void saveEntities(DataOutputStream out) throws IOException { void saveEntities(DataOutputStream out) throws IOException {
int num = 0; int num = 0;
for (Enumeration e = entityHash.elements() ; e.hasMoreElements() ; ) { for (Enumeration<Entity> e = entityHash.elements() ; e.hasMoreElements() ; ) {
Entity ent = (Entity) e.nextElement(); Entity ent = e.nextElement();
if (ent.isGeneral()) { if (ent.isGeneral()) {
num++; num++;
} }
} }
out.writeShort((short) num); out.writeShort((short) num);
for (Enumeration e = entityHash.elements() ; e.hasMoreElements() ; ) { for (Enumeration<Entity> e = entityHash.elements() ; e.hasMoreElements() ; ) {
Entity ent = (Entity) e.nextElement(); Entity ent = e.nextElement();
if (ent.isGeneral()) { if (ent.isGeneral()) {
out.writeShort(getNameId(ent.getName())); out.writeShort(getNameId(ent.getName()));
out.writeByte(ent.getType() & ~GENERAL); out.writeByte(ent.getType() & ~GENERAL);
......
/* /*
* Copyright (c) 1998, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -48,7 +48,7 @@ import java.net.URL; ...@@ -48,7 +48,7 @@ import java.net.URL;
public final public final
class DTDInputStream extends FilterReader implements DTDConstants { class DTDInputStream extends FilterReader implements DTDConstants {
public DTD dtd; public DTD dtd;
public Stack stack = new Stack(); public Stack<Object> stack = new Stack<>();
public char str[] = new char[64]; public char str[] = new char[64];
public int replace = 0; public int replace = 0;
public int ln = 1; public int ln = 1;
...@@ -105,6 +105,7 @@ class DTDInputStream extends FilterReader implements DTDConstants { ...@@ -105,6 +105,7 @@ class DTDInputStream extends FilterReader implements DTDConstants {
* parameter entities. * parameter entities.
* [60] 350:22 * [60] 350:22
*/ */
@SuppressWarnings("fallthrough")
public int read() throws IOException { public int read() throws IOException {
switch (ch) { switch (ch) {
case '%': { case '%': {
...@@ -134,6 +135,7 @@ class DTDInputStream extends FilterReader implements DTDConstants { ...@@ -134,6 +135,7 @@ class DTDInputStream extends FilterReader implements DTDConstants {
switch (ch) { switch (ch) {
case '\r': case '\r':
ln++; ln++;
/* fall through */
case ';': case ';':
ch = in.read(); ch = in.read();
break; break;
......
/* /*
* Copyright (c) 1998, 2000, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -87,7 +87,7 @@ class DTDParser implements DTDConstants { ...@@ -87,7 +87,7 @@ class DTDParser implements DTDConstants {
return null; return null;
} }
return MessageFormat.format(prop, args); return MessageFormat.format(prop, (Object[])args);
} }
/** /**
...@@ -201,6 +201,7 @@ class DTDParser implements DTDConstants { ...@@ -201,6 +201,7 @@ class DTDParser implements DTDConstants {
* Parse identifier. Uppercase characters are automatically * Parse identifier. Uppercase characters are automatically
* folded to lowercase. Returns falsed if no identifier is found. * folded to lowercase. Returns falsed if no identifier is found.
*/ */
@SuppressWarnings("fallthrough")
boolean parseIdentifier(boolean lower) throws IOException { boolean parseIdentifier(boolean lower) throws IOException {
switch (ch) { switch (ch) {
case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':
...@@ -211,6 +212,7 @@ class DTDParser implements DTDConstants { ...@@ -211,6 +212,7 @@ class DTDParser implements DTDConstants {
if (lower) { if (lower) {
ch = 'a' + (ch - 'A'); ch = 'a' + (ch - 'A');
} }
/* fall through */
case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
case 'g': case 'h': case 'i': case 'j': case 'k': case 'l': case 'g': case 'h': case 'i': case 'j': case 'k': case 'l':
...@@ -233,6 +235,7 @@ class DTDParser implements DTDConstants { ...@@ -233,6 +235,7 @@ class DTDParser implements DTDConstants {
* Parses name token. If <code>lower</code> is true, upper case letters * Parses name token. If <code>lower</code> is true, upper case letters
* are folded to lower case. Returns falsed if no token is found. * are folded to lower case. Returns falsed if no token is found.
*/ */
@SuppressWarnings("fallthrough")
boolean parseNameToken(boolean lower) throws IOException { boolean parseNameToken(boolean lower) throws IOException {
boolean first = true; boolean first = true;
...@@ -246,6 +249,7 @@ class DTDParser implements DTDConstants { ...@@ -246,6 +249,7 @@ class DTDParser implements DTDConstants {
if (lower) { if (lower) {
ch = 'a' + (ch - 'A'); ch = 'a' + (ch - 'A');
} }
/* fall through */
case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
case 'g': case 'h': case 'i': case 'j': case 'k': case 'l': case 'g': case 'h': case 'i': case 'j': case 'k': case 'l':
...@@ -271,8 +275,8 @@ class DTDParser implements DTDConstants { ...@@ -271,8 +275,8 @@ class DTDParser implements DTDConstants {
/** /**
* Parse a list of identifiers. * Parse a list of identifiers.
*/ */
Vector parseIdentifierList(boolean lower) throws IOException { Vector<String> parseIdentifierList(boolean lower) throws IOException {
Vector elems = new Vector(); Vector<String> elems = new Vector<>();
skipSpace(); skipSpace();
switch (ch) { switch (ch) {
case '(': case '(':
...@@ -507,7 +511,7 @@ class DTDParser implements DTDConstants { ...@@ -507,7 +511,7 @@ class DTDParser implements DTDConstants {
* [116] 405:6 * [116] 405:6
*/ */
void parseElementDeclaration() throws IOException { void parseElementDeclaration() throws IOException {
Vector elems = parseIdentifierList(true); Vector<String> elems = parseIdentifierList(true);
BitSet inclusions = null; BitSet inclusions = null;
BitSet exclusions = null; BitSet exclusions = null;
boolean omitStart = false; boolean omitStart = false;
...@@ -544,26 +548,26 @@ class DTDParser implements DTDConstants { ...@@ -544,26 +548,26 @@ class DTDParser implements DTDConstants {
if ((type == MODEL) || (type == ANY)) { if ((type == MODEL) || (type == ANY)) {
if (ch == '-') { if (ch == '-') {
ch = in.read(); ch = in.read();
Vector v = parseIdentifierList(true); Vector<String> v = parseIdentifierList(true);
exclusions = new BitSet(); exclusions = new BitSet();
for (Enumeration e = v.elements() ; e.hasMoreElements() ;) { for (Enumeration<String> e = v.elements() ; e.hasMoreElements() ;) {
exclusions.set(dtd.getElement((String)e.nextElement()).getIndex()); exclusions.set(dtd.getElement(e.nextElement()).getIndex());
} }
} }
if (ch == '+') { if (ch == '+') {
ch = in.read(); ch = in.read();
Vector v = parseIdentifierList(true); Vector<String> v = parseIdentifierList(true);
inclusions = new BitSet(); inclusions = new BitSet();
for (Enumeration e = v.elements() ; e.hasMoreElements() ;) { for (Enumeration<String> e = v.elements() ; e.hasMoreElements() ;) {
inclusions.set(dtd.getElement((String)e.nextElement()).getIndex()); inclusions.set(dtd.getElement(e.nextElement()).getIndex());
} }
} }
} }
expect('>'); expect('>');
if (in.replace == 0) { if (in.replace == 0) {
for (Enumeration e = elems.elements() ; e.hasMoreElements() ;) { for (Enumeration<String> e = elems.elements() ; e.hasMoreElements() ;) {
dtd.defineElement((String)e.nextElement(), type, omitStart, omitEnd, content, exclusions, inclusions, null); dtd.defineElement(e.nextElement(), type, omitStart, omitEnd, content, exclusions, inclusions, null);
} }
} }
} }
...@@ -582,7 +586,7 @@ class DTDParser implements DTDConstants { ...@@ -582,7 +586,7 @@ class DTDParser implements DTDConstants {
error("invalid", "attribute value"); error("invalid", "attribute value");
return; return;
} }
atts.type = atts.name2type(getString(0)); atts.type = AttributeList.name2type(getString(0));
skipParameterSpace(); skipParameterSpace();
if (atts.type == NOTATION) { if (atts.type == NOTATION) {
atts.values = parseIdentifierList(true); atts.values = parseIdentifierList(true);
...@@ -593,6 +597,7 @@ class DTDParser implements DTDConstants { ...@@ -593,6 +597,7 @@ class DTDParser implements DTDConstants {
* Parse an attribute value specification. * Parse an attribute value specification.
* [33] 331:1 * [33] 331:1
*/ */
@SuppressWarnings("fallthrough")
String parseAttributeValueSpecification() throws IOException { String parseAttributeValueSpecification() throws IOException {
int delim = -1; int delim = -1;
switch (ch) { switch (ch) {
...@@ -627,6 +632,7 @@ class DTDParser implements DTDConstants { ...@@ -627,6 +632,7 @@ class DTDParser implements DTDConstants {
ch = in.read(); ch = in.read();
return getString(0); return getString(0);
} }
/* fall through */
default: default:
addString(ch & 0xFF); addString(ch & 0xFF);
...@@ -648,7 +654,7 @@ class DTDParser implements DTDConstants { ...@@ -648,7 +654,7 @@ class DTDParser implements DTDConstants {
return; return;
} }
skipParameterSpace(); skipParameterSpace();
atts.modifier = atts.name2type(getString(0)); atts.modifier = AttributeList.name2type(getString(0));
if (atts.modifier != FIXED) { if (atts.modifier != FIXED) {
return; return;
} }
...@@ -663,7 +669,7 @@ class DTDParser implements DTDConstants { ...@@ -663,7 +669,7 @@ class DTDParser implements DTDConstants {
* REMIND: associated notation name * REMIND: associated notation name
*/ */
void parseAttlistDeclaration() throws IOException { void parseAttlistDeclaration() throws IOException {
Vector elems = parseIdentifierList(true); Vector<String> elems = parseIdentifierList(true);
AttributeList attlist = null, atts = null; AttributeList attlist = null, atts = null;
while (parseIdentifier(true)) { while (parseIdentifier(true)) {
...@@ -685,8 +691,8 @@ class DTDParser implements DTDConstants { ...@@ -685,8 +691,8 @@ class DTDParser implements DTDConstants {
expect('>'); expect('>');
if (in.replace == 0) { if (in.replace == 0) {
for (Enumeration e = elems.elements() ; e.hasMoreElements() ;) { for (Enumeration<String> e = elems.elements() ; e.hasMoreElements() ;) {
dtd.defineAttributes((String)e.nextElement(), attlist); dtd.defineAttributes(e.nextElement(), attlist);
} }
} }
} }
...@@ -810,6 +816,7 @@ class DTDParser implements DTDConstants { ...@@ -810,6 +816,7 @@ class DTDParser implements DTDConstants {
/** /**
* Parse a section of the input upto EOF or ']'. * Parse a section of the input upto EOF or ']'.
*/ */
@SuppressWarnings("fallthrough")
void parseSection() throws IOException { void parseSection() throws IOException {
while (true) { while (true) {
switch (ch) { switch (ch) {
...@@ -883,6 +890,7 @@ class DTDParser implements DTDConstants { ...@@ -883,6 +890,7 @@ class DTDParser implements DTDConstants {
default: default:
char str[] = {(char)ch}; char str[] = {(char)ch};
error("invalid.arg", "character", "'" + new String(str) + "' / " + ch); error("invalid.arg", "character", "'" + new String(str) + "' / " + ch);
/* fall through */
case ' ': case ' ':
case '\t': case '\t':
......
/* /*
* Copyright (c) 1998, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -44,7 +44,7 @@ import java.util.Hashtable; ...@@ -44,7 +44,7 @@ import java.util.Hashtable;
final class PublicMapping { final class PublicMapping {
String baseStr; String baseStr;
Hashtable tab = new Hashtable(); Hashtable<String, String> tab = new Hashtable<>();
/** /**
* Create a mapping. * Create a mapping.
...@@ -103,6 +103,6 @@ final class PublicMapping { ...@@ -103,6 +103,6 @@ final class PublicMapping {
*/ */
public String get(String id) { public String get(String id) {
// System.err.println(" id = "+id); // System.err.println(" id = "+id);
return (String) tab.get(id); return tab.get(id);
} }
} }
/* /*
* Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -66,7 +66,7 @@ class CharSet { ...@@ -66,7 +66,7 @@ class CharSet {
* A cache which is used to speed up parseString() whenever it is * A cache which is used to speed up parseString() whenever it is
* used to parse a description that has been parsed before * used to parse a description that has been parsed before
*/ */
private static Hashtable expressionCache = null; private static Hashtable<String, CharSet> expressionCache = null;
/** /**
* Builds a CharSet based on a textual description. For the syntax of * Builds a CharSet based on a textual description. For the syntax of
...@@ -79,7 +79,7 @@ class CharSet { ...@@ -79,7 +79,7 @@ class CharSet {
// if "s" is in the expression cache, pull the result out // if "s" is in the expression cache, pull the result out
// of the expresison cache // of the expresison cache
if (expressionCache != null) { if (expressionCache != null) {
result = (CharSet)expressionCache.get(s); result = expressionCache.get(s);
} }
// otherwise, use doParseString() to actually parse the string, // otherwise, use doParseString() to actually parse the string,
...@@ -87,7 +87,7 @@ class CharSet { ...@@ -87,7 +87,7 @@ class CharSet {
if (result == null) { if (result == null) {
result = doParseString(s); result = doParseString(s);
if (expressionCache == null) { if (expressionCache == null) {
expressionCache = new Hashtable(); expressionCache = new Hashtable<>();
} }
expressionCache.put(s, result); expressionCache.put(s, result);
} }
...@@ -336,8 +336,8 @@ class CharSet { ...@@ -336,8 +336,8 @@ class CharSet {
* Returns a copy of CharSet's expression cache and sets CharSet's * Returns a copy of CharSet's expression cache and sets CharSet's
* expression cache to empty. * expression cache to empty.
*/ */
public static Hashtable releaseExpressionCache() { public static Hashtable<String, CharSet> releaseExpressionCache() {
Hashtable result = expressionCache; Hashtable<String, CharSet> result = expressionCache;
expressionCache = null; expressionCache = null;
return result; return result;
} }
...@@ -778,7 +778,7 @@ class CharSet { ...@@ -778,7 +778,7 @@ class CharSet {
* An Enumeration that can be used to extract the character ranges * An Enumeration that can be used to extract the character ranges
* from a CharSet one at a time * from a CharSet one at a time
*/ */
public class Enumeration implements java.util.Enumeration { public class Enumeration implements java.util.Enumeration<int[]> {
/** /**
* Initializes a CharSet.Enumeration * Initializes a CharSet.Enumeration
*/ */
...@@ -798,7 +798,7 @@ class CharSet { ...@@ -798,7 +798,7 @@ class CharSet {
/** /**
* Returns the next range in the CarSet * Returns the next range in the CarSet
*/ */
public Object nextElement() { public int[] nextElement() {
int[] result = new int[2]; int[] result = new int[2];
result[0] = chars[p++]; result[0] = chars[p++];
result[1] = chars[p++]; result[1] = chars[p++];
......
/* /*
* Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -78,12 +78,12 @@ class DictionaryBasedBreakIteratorBuilder extends RuleBasedBreakIteratorBuilder ...@@ -78,12 +78,12 @@ class DictionaryBasedBreakIteratorBuilder extends RuleBasedBreakIteratorBuilder
* contains "true" for every character category that includes a dictionary * contains "true" for every character category that includes a dictionary
* character. * character.
*/ */
protected void buildCharCategories(Vector tempRuleList) { protected void buildCharCategories(Vector<String> tempRuleList) {
super.buildCharCategories(tempRuleList); super.buildCharCategories(tempRuleList);
categoryFlags = new boolean[categories.size()]; categoryFlags = new boolean[categories.size()];
for (int i = 0; i < categories.size(); i++) { for (int i = 0; i < categories.size(); i++) {
CharSet cs = (CharSet)categories.elementAt(i); CharSet cs = categories.elementAt(i);
if (!(cs.intersection(dictionaryChars).empty())) { if (!(cs.intersection(dictionaryChars).empty())) {
categoryFlags[i] = true; categoryFlags[i] = true;
} }
...@@ -95,7 +95,7 @@ class DictionaryBasedBreakIteratorBuilder extends RuleBasedBreakIteratorBuilder ...@@ -95,7 +95,7 @@ class DictionaryBasedBreakIteratorBuilder extends RuleBasedBreakIteratorBuilder
// the function above. This gives us a way to create a separate character // the function above. This gives us a way to create a separate character
// category for the dictionary characters even when // category for the dictionary characters even when
// RuleBasedBreakIteratorBuilder isn't making a distinction. // RuleBasedBreakIteratorBuilder isn't making a distinction.
protected void mungeExpressionList(Hashtable expressions) { protected void mungeExpressionList(Hashtable<String, Object> expressions) {
expressions.put(dictionaryExpression, dictionaryChars); expressions.put(dictionaryExpression, dictionaryChars);
} }
......
/* /*
* Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -91,9 +91,9 @@ public class GenerateBreakIteratorData { ...@@ -91,9 +91,9 @@ public class GenerateBreakIteratorData {
try { try {
info = (ResourceBundle)Class.forName("sun.text.resources.BreakIteratorInfo" + localeName).newInstance(); info = (ResourceBundle)Class.forName("sun.text.resources.BreakIteratorInfo" + localeName).newInstance();
Enumeration keys = info.getKeys(); Enumeration<String> keys = info.getKeys();
while (keys.hasMoreElements()) { while (keys.hasMoreElements()) {
String key = (String)keys.nextElement(); String key = keys.nextElement();
if (key.equals("CharacterData")) { if (key.equals("CharacterData")) {
generateDataFile(info.getString(key), generateDataFile(info.getString(key),
......
/* /*
* Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -110,13 +110,13 @@ class RuleBasedBreakIteratorBuilder { ...@@ -110,13 +110,13 @@ class RuleBasedBreakIteratorBuilder {
* A temporary holding place used for calculating the character categories. * A temporary holding place used for calculating the character categories.
* This object contains CharSet objects. * This object contains CharSet objects.
*/ */
protected Vector categories = null; protected Vector<CharSet> categories = null;
/** /**
* A table used to map parts of regexp text to lists of character * A table used to map parts of regexp text to lists of character
* categories, rather than having to figure them out from scratch each time * categories, rather than having to figure them out from scratch each time
*/ */
protected Hashtable expressions = null; protected Hashtable<String, Object> expressions = null;
/** /**
* A temporary holding place for the list of ignore characters * A temporary holding place for the list of ignore characters
...@@ -126,32 +126,32 @@ class RuleBasedBreakIteratorBuilder { ...@@ -126,32 +126,32 @@ class RuleBasedBreakIteratorBuilder {
/** /**
* A temporary holding place where the forward state table is built * A temporary holding place where the forward state table is built
*/ */
protected Vector tempStateTable = null; protected Vector<short[]> tempStateTable = null;
/** /**
* A list of all the states that have to be filled in with transitions to * A list of all the states that have to be filled in with transitions to
* the next state that is created. Used when building the state table from * the next state that is created. Used when building the state table from
* the regular expressions. * the regular expressions.
*/ */
protected Vector decisionPointList = null; protected Vector<Integer> decisionPointList = null;
/** /**
* A stack for holding decision point lists. This is used to handle nested * A stack for holding decision point lists. This is used to handle nested
* parentheses and braces in regexps. * parentheses and braces in regexps.
*/ */
protected Stack decisionPointStack = null; protected Stack<Vector<Integer>> decisionPointStack = null;
/** /**
* A list of states that loop back on themselves. Used to handle .*? * A list of states that loop back on themselves. Used to handle .*?
*/ */
protected Vector loopingStates = null; protected Vector<Integer> loopingStates = null;
/** /**
* Looping states actually have to be backfilled later in the process * Looping states actually have to be backfilled later in the process
* than everything else. This is where a the list of states to backfill * than everything else. This is where a the list of states to backfill
* is accumulated. This is also used to handle .*? * is accumulated. This is also used to handle .*?
*/ */
protected Vector statesToBackfill = null; protected Vector<Integer> statesToBackfill = null;
/** /**
* A list mapping pairs of state numbers for states that are to be combined * A list mapping pairs of state numbers for states that are to be combined
...@@ -159,7 +159,7 @@ class RuleBasedBreakIteratorBuilder { ...@@ -159,7 +159,7 @@ class RuleBasedBreakIteratorBuilder {
* in the process of making the state table deterministic to prevent * in the process of making the state table deterministic to prevent
* infinite recursion. * infinite recursion.
*/ */
protected Vector mergeList = null; protected Vector<int[]> mergeList = null;
/** /**
* A flag that is used to indicate when the list of looping states can * A flag that is used to indicate when the list of looping states can
...@@ -198,7 +198,7 @@ class RuleBasedBreakIteratorBuilder { ...@@ -198,7 +198,7 @@ class RuleBasedBreakIteratorBuilder {
* just vectors different parts of the job off to other functions. * just vectors different parts of the job off to other functions.
*/ */
public RuleBasedBreakIteratorBuilder(String description) { public RuleBasedBreakIteratorBuilder(String description) {
Vector tempRuleList = buildRuleList(description); Vector<String> tempRuleList = buildRuleList(description);
buildCharCategories(tempRuleList); buildCharCategories(tempRuleList);
buildStateTable(tempRuleList); buildStateTable(tempRuleList);
buildBackwardsStateTable(tempRuleList); buildBackwardsStateTable(tempRuleList);
...@@ -213,7 +213,7 @@ class RuleBasedBreakIteratorBuilder { ...@@ -213,7 +213,7 @@ class RuleBasedBreakIteratorBuilder {
* variable names) * variable names)
* </ul> * </ul>
*/ */
private Vector buildRuleList(String description) { private Vector<String> buildRuleList(String description) {
// invariants: // invariants:
// - parentheses must be balanced: ()[]{}<> // - parentheses must be balanced: ()[]{}<>
// - nothing can be nested inside <> // - nothing can be nested inside <>
...@@ -240,8 +240,8 @@ class RuleBasedBreakIteratorBuilder { ...@@ -240,8 +240,8 @@ class RuleBasedBreakIteratorBuilder {
// set up a vector to contain the broken-up description (each entry in the // set up a vector to contain the broken-up description (each entry in the
// vector is a separate rule) and a stack for keeping track of opening // vector is a separate rule) and a stack for keeping track of opening
// punctuation // punctuation
Vector tempRuleList = new Vector(); Vector<String> tempRuleList = new Vector<>();
Stack parenStack = new Stack(); Stack<Character> parenStack = new Stack<>();
int p = 0; int p = 0;
int ruleStart = 0; int ruleStart = 0;
...@@ -326,7 +326,7 @@ class RuleBasedBreakIteratorBuilder { ...@@ -326,7 +326,7 @@ class RuleBasedBreakIteratorBuilder {
} }
parenStack.pop(); parenStack.pop();
if (!parenStack.empty()) { if (!parenStack.empty()) {
lastOpen = ((Character)(parenStack.peek())).charValue(); lastOpen = parenStack.peek().charValue();
} }
else { else {
lastOpen = '\u0000'; lastOpen = '\u0000';
...@@ -552,7 +552,8 @@ class RuleBasedBreakIteratorBuilder { ...@@ -552,7 +552,8 @@ class RuleBasedBreakIteratorBuilder {
* character category numbers everywhere a literal character or a [] expression * character category numbers everywhere a literal character or a [] expression
* originally occurred. * originally occurred.
*/ */
protected void buildCharCategories(Vector tempRuleList) { @SuppressWarnings("fallthrough")
protected void buildCharCategories(Vector<String> tempRuleList) {
int bracketLevel = 0; int bracketLevel = 0;
int p = 0; int p = 0;
int lineNum = 0; int lineNum = 0;
...@@ -560,9 +561,9 @@ class RuleBasedBreakIteratorBuilder { ...@@ -560,9 +561,9 @@ class RuleBasedBreakIteratorBuilder {
// build hash table of every literal character or [] expression in the rule list // build hash table of every literal character or [] expression in the rule list
// and use CharSet.parseString() to derive a CharSet object representing the // and use CharSet.parseString() to derive a CharSet object representing the
// characters each refers to // characters each refers to
expressions = new Hashtable(); expressions = new Hashtable<>();
while (lineNum < tempRuleList.size()) { while (lineNum < tempRuleList.size()) {
String line = (String)(tempRuleList.elementAt(lineNum)); String line = tempRuleList.elementAt(lineNum);
p = 0; p = 0;
while (p < line.length()) { while (p < line.length()) {
int c = line.codePointAt(p); int c = line.codePointAt(p);
...@@ -618,7 +619,7 @@ class RuleBasedBreakIteratorBuilder { ...@@ -618,7 +619,7 @@ class RuleBasedBreakIteratorBuilder {
CharSet.releaseExpressionCache(); CharSet.releaseExpressionCache();
// create the temporary category table (which is a vector of CharSet objects) // create the temporary category table (which is a vector of CharSet objects)
categories = new Vector(); categories = new Vector<>();
if (ignoreChars != null) { if (ignoreChars != null) {
categories.addElement(ignoreChars); categories.addElement(ignoreChars);
} }
...@@ -643,8 +644,7 @@ class RuleBasedBreakIteratorBuilder { ...@@ -643,8 +644,7 @@ class RuleBasedBreakIteratorBuilder {
// At no time should a character ever occur in more than one character category. // At no time should a character ever occur in more than one character category.
// for each expression in the expressions list, do... // for each expression in the expressions list, do...
Enumeration iter = expressions.elements(); for (Enumeration<Object> iter = expressions.elements(); iter.hasMoreElements(); ) {
while (iter.hasMoreElements()) {
// initialize the working char set to the chars in the current expression // initialize the working char set to the chars in the current expression
CharSet e = (CharSet)iter.nextElement(); CharSet e = (CharSet)iter.nextElement();
...@@ -653,7 +653,7 @@ class RuleBasedBreakIteratorBuilder { ...@@ -653,7 +653,7 @@ class RuleBasedBreakIteratorBuilder {
// if there's overlap between the current working set of chars // if there's overlap between the current working set of chars
// and the current category... // and the current category...
CharSet that = (CharSet)(categories.elementAt(j)); CharSet that = categories.elementAt(j);
if (!that.intersection(e).empty()) { if (!that.intersection(e).empty()) {
// add a new category for the characters that were in the // add a new category for the characters that were in the
...@@ -686,9 +686,9 @@ class RuleBasedBreakIteratorBuilder { ...@@ -686,9 +686,9 @@ class RuleBasedBreakIteratorBuilder {
// up in some other category // up in some other category
CharSet allChars = new CharSet(); CharSet allChars = new CharSet();
for (int i = 1; i < categories.size(); i++) { for (int i = 1; i < categories.size(); i++) {
allChars = allChars.union((CharSet)(categories.elementAt(i))); allChars = allChars.union(categories.elementAt(i));
} }
CharSet ignoreChars = (CharSet)(categories.elementAt(0)); CharSet ignoreChars = categories.elementAt(0);
ignoreChars = ignoreChars.difference(allChars); ignoreChars = ignoreChars.difference(allChars);
categories.setElementAt(ignoreChars, 0); categories.setElementAt(ignoreChars, 0);
...@@ -697,9 +697,9 @@ class RuleBasedBreakIteratorBuilder { ...@@ -697,9 +697,9 @@ class RuleBasedBreakIteratorBuilder {
// character categories that expression refers to. The String is encoded: each // character categories that expression refers to. The String is encoded: each
// character is a character category number (plus 0x100 to avoid confusing them // character is a character category number (plus 0x100 to avoid confusing them
// with syntax characters in the rule grammar) // with syntax characters in the rule grammar)
iter = expressions.keys();
while (iter.hasMoreElements()) { for (Enumeration<String> iter = expressions.keys(); iter.hasMoreElements(); ) {
String key = (String)iter.nextElement(); String key = iter.nextElement();
CharSet cs = (CharSet)expressions.get(key); CharSet cs = (CharSet)expressions.get(key);
StringBuffer cats = new StringBuffer(); StringBuffer cats = new StringBuffer();
...@@ -707,7 +707,7 @@ class RuleBasedBreakIteratorBuilder { ...@@ -707,7 +707,7 @@ class RuleBasedBreakIteratorBuilder {
for (int j = 0; j < categories.size(); j++) { for (int j = 0; j < categories.size(); j++) {
// if the current expression contains characters in that category... // if the current expression contains characters in that category...
CharSet temp = cs.intersection((CharSet)(categories.elementAt(j))); CharSet temp = cs.intersection(categories.elementAt(j));
if (!temp.empty()) { if (!temp.empty()) {
// then add the encoded category number to the String for this // then add the encoded category number to the String for this
...@@ -732,12 +732,12 @@ class RuleBasedBreakIteratorBuilder { ...@@ -732,12 +732,12 @@ class RuleBasedBreakIteratorBuilder {
// for each category... // for each category...
for (int i = 0; i < categories.size(); i++) { for (int i = 0; i < categories.size(); i++) {
CharSet chars = (CharSet)(categories.elementAt(i)); CharSet chars = categories.elementAt(i);
// go through the character ranges in the category one by one... // go through the character ranges in the category one by one...
Enumeration enum_ = chars.getChars(); Enumeration<int[]> enum_ = chars.getChars();
while (enum_.hasMoreElements()) { while (enum_.hasMoreElements()) {
int[] range = (int[])(enum_.nextElement()); int[] range = enum_.nextElement();
// and set the corresponding elements in the CompactArray accordingly // and set the corresponding elements in the CompactArray accordingly
if (i != 0) { if (i != 0) {
...@@ -782,7 +782,7 @@ class RuleBasedBreakIteratorBuilder { ...@@ -782,7 +782,7 @@ class RuleBasedBreakIteratorBuilder {
numCategories = categories.size(); numCategories = categories.size();
} }
protected void mungeExpressionList(Hashtable expressions) { protected void mungeExpressionList(Hashtable<String, Object> expressions) {
// empty in the parent class. This function provides a hook for subclasses // empty in the parent class. This function provides a hook for subclasses
// to mess with the character category table. // to mess with the character category table.
} }
...@@ -792,19 +792,19 @@ class RuleBasedBreakIteratorBuilder { ...@@ -792,19 +792,19 @@ class RuleBasedBreakIteratorBuilder {
* work is done in parseRule(), which is called once for each rule in the * work is done in parseRule(), which is called once for each rule in the
* description. * description.
*/ */
private void buildStateTable(Vector tempRuleList) { private void buildStateTable(Vector<String> tempRuleList) {
// initialize our temporary state table, and fill it with two states: // initialize our temporary state table, and fill it with two states:
// state 0 is a dummy state that allows state 1 to be the starting state // state 0 is a dummy state that allows state 1 to be the starting state
// and 0 to represent "stop". State 1 is added here to seed things // and 0 to represent "stop". State 1 is added here to seed things
// before we start parsing // before we start parsing
tempStateTable = new Vector(); tempStateTable = new Vector<>();
tempStateTable.addElement(new short[numCategories + 1]); tempStateTable.addElement(new short[numCategories + 1]);
tempStateTable.addElement(new short[numCategories + 1]); tempStateTable.addElement(new short[numCategories + 1]);
// call parseRule() for every rule in the rule list (except those which // call parseRule() for every rule in the rule list (except those which
// start with !, which are actually backwards-iteration rules) // start with !, which are actually backwards-iteration rules)
for (int i = 0; i < tempRuleList.size(); i++) { for (int i = 0; i < tempRuleList.size(); i++) {
String rule = (String)tempRuleList.elementAt(i); String rule = tempRuleList.elementAt(i);
if (rule.charAt(0) != '!') { if (rule.charAt(0) != '!') {
parseRule(rule, true); parseRule(rule, true);
} }
...@@ -891,10 +891,10 @@ class RuleBasedBreakIteratorBuilder { ...@@ -891,10 +891,10 @@ class RuleBasedBreakIteratorBuilder {
int lastState = currentState; int lastState = currentState;
String pendingChars = ""; String pendingChars = "";
decisionPointStack = new Stack(); decisionPointStack = new Stack<>();
decisionPointList = new Vector(); decisionPointList = new Vector<>();
loopingStates = new Vector(); loopingStates = new Vector<>();
statesToBackfill = new Vector(); statesToBackfill = new Vector<>();
short[] state; short[] state;
boolean sawEarlyBreak = false; boolean sawEarlyBreak = false;
...@@ -972,8 +972,8 @@ class RuleBasedBreakIteratorBuilder { ...@@ -972,8 +972,8 @@ class RuleBasedBreakIteratorBuilder {
// if the character we're on is a period, we end up down here // if the character we're on is a period, we end up down here
else { else {
int rowNum = ((Integer)decisionPointList.lastElement()).intValue(); int rowNum = decisionPointList.lastElement().intValue();
state = (short[])tempStateTable.elementAt(rowNum); state = tempStateTable.elementAt(rowNum);
// if the period is followed by an asterisk, then just set the current // if the period is followed by an asterisk, then just set the current
// state to loop back on itself // state to loop back on itself
...@@ -1001,7 +1001,9 @@ class RuleBasedBreakIteratorBuilder { ...@@ -1001,7 +1001,9 @@ class RuleBasedBreakIteratorBuilder {
// of the current desicion point list onto the stack (this is // of the current desicion point list onto the stack (this is
// the same thing we do on an opening brace) // the same thing we do on an opening brace)
if (p + 1 < rule.length() && rule.charAt(p + 1) == '*') { if (p + 1 < rule.length() && rule.charAt(p + 1) == '*') {
decisionPointStack.push(decisionPointList.clone()); @SuppressWarnings("unchecked")
Vector<Integer> clone = (Vector<Integer>)decisionPointList.clone();
decisionPointStack.push(clone);
} }
// create a new state, add it to the list of states to backfill // create a new state, add it to the list of states to backfill
...@@ -1040,7 +1042,9 @@ class RuleBasedBreakIteratorBuilder { ...@@ -1040,7 +1042,9 @@ class RuleBasedBreakIteratorBuilder {
// it, preventing it from being affected by whatever's inside the parentheses. // it, preventing it from being affected by whatever's inside the parentheses.
// This decision point list is restored when a } is encountered. // This decision point list is restored when a } is encountered.
else if (c == '{') { else if (c == '{') {
decisionPointStack.push(decisionPointList.clone()); @SuppressWarnings("unchecked")
Vector<Integer> clone = (Vector<Integer>)decisionPointList.clone();
decisionPointStack.push(clone);
} }
// a } marks the end of an optional run of characters. Pop the last decision // a } marks the end of an optional run of characters. Pop the last decision
...@@ -1053,7 +1057,7 @@ class RuleBasedBreakIteratorBuilder { ...@@ -1053,7 +1057,7 @@ class RuleBasedBreakIteratorBuilder {
// on the character categories that caused us to enter this state // on the character categories that caused us to enter this state
if (c == '*') { if (c == '*') {
for (int i = lastState + 1; i < tempStateTable.size(); i++) { for (int i = lastState + 1; i < tempStateTable.size(); i++) {
Vector temp = new Vector(); Vector<Integer> temp = new Vector<>();
temp.addElement(new Integer(i)); temp.addElement(new Integer(i));
updateStateTable(temp, pendingChars, (short)(lastState + 1)); updateStateTable(temp, pendingChars, (short)(lastState + 1));
} }
...@@ -1063,7 +1067,7 @@ class RuleBasedBreakIteratorBuilder { ...@@ -1063,7 +1067,7 @@ class RuleBasedBreakIteratorBuilder {
// it with the current decision point list (this causes the divergent // it with the current decision point list (this causes the divergent
// paths through the state table to come together again on the next // paths through the state table to come together again on the next
// new state) // new state)
Vector temp = (Vector)decisionPointStack.pop(); Vector<Integer> temp = decisionPointStack.pop();
for (int i = 0; i < decisionPointList.size(); i++) for (int i = 0; i < decisionPointList.size(); i++)
temp.addElement(decisionPointList.elementAt(i)); temp.addElement(decisionPointList.elementAt(i));
decisionPointList = temp; decisionPointList = temp;
...@@ -1123,8 +1127,10 @@ class RuleBasedBreakIteratorBuilder { ...@@ -1123,8 +1127,10 @@ class RuleBasedBreakIteratorBuilder {
// stack (this keeps track of the active decision point list before // stack (this keeps track of the active decision point list before
// the () expression), followed by an empty decision point list // the () expression), followed by an empty decision point list
// (this will hold the exit points) // (this will hold the exit points)
decisionPointStack.push(decisionPointList.clone()); @SuppressWarnings("unchecked")
decisionPointStack.push(new Vector()); Vector<Integer> clone = (Vector<Integer>)decisionPointList.clone();
decisionPointStack.push(clone);
decisionPointStack.push(new Vector<Integer>());
} }
// a | separates alternative character sequences in a () expression. When // a | separates alternative character sequences in a () expression. When
...@@ -1133,8 +1139,8 @@ class RuleBasedBreakIteratorBuilder { ...@@ -1133,8 +1139,8 @@ class RuleBasedBreakIteratorBuilder {
else if (c == '|') { else if (c == '|') {
// pick out the top two decision point lists on the stack // pick out the top two decision point lists on the stack
Vector oneDown = (Vector)decisionPointStack.pop(); Vector<Integer> oneDown = decisionPointStack.pop();
Vector twoDown = (Vector)decisionPointStack.peek(); Vector<Integer> twoDown = decisionPointStack.peek();
decisionPointStack.push(oneDown); decisionPointStack.push(oneDown);
// append the current decision point list to the list below it // append the current decision point list to the list below it
...@@ -1142,7 +1148,9 @@ class RuleBasedBreakIteratorBuilder { ...@@ -1142,7 +1148,9 @@ class RuleBasedBreakIteratorBuilder {
// current decision point list to its state before the () expression // current decision point list to its state before the () expression
for (int i = 0; i < decisionPointList.size(); i++) for (int i = 0; i < decisionPointList.size(); i++)
oneDown.addElement(decisionPointList.elementAt(i)); oneDown.addElement(decisionPointList.elementAt(i));
decisionPointList = (Vector)twoDown.clone(); @SuppressWarnings("unchecked")
Vector<Integer> clone = (Vector<Integer>)twoDown.clone();
decisionPointList = clone;
} }
// a ) marks the end of a sequence of characters. We do one of two things // a ) marks the end of a sequence of characters. We do one of two things
...@@ -1160,7 +1168,7 @@ class RuleBasedBreakIteratorBuilder { ...@@ -1160,7 +1168,7 @@ class RuleBasedBreakIteratorBuilder {
// pull the exit point list off the stack, merge it with the current // pull the exit point list off the stack, merge it with the current
// decision point list, and make the merged version the current // decision point list, and make the merged version the current
// decision point list // decision point list
Vector exitPoints = (Vector)decisionPointStack.pop(); Vector<Integer> exitPoints = decisionPointStack.pop();
for (int i = 0; i < decisionPointList.size(); i++) for (int i = 0; i < decisionPointList.size(); i++)
exitPoints.addElement(decisionPointList.elementAt(i)); exitPoints.addElement(decisionPointList.elementAt(i));
decisionPointList = exitPoints; decisionPointList = exitPoints;
...@@ -1176,16 +1184,18 @@ class RuleBasedBreakIteratorBuilder { ...@@ -1176,16 +1184,18 @@ class RuleBasedBreakIteratorBuilder {
// now exitPoints and decisionPointList have to point to equivalent // now exitPoints and decisionPointList have to point to equivalent
// vectors, but not the SAME vector // vectors, but not the SAME vector
exitPoints = (Vector)decisionPointList.clone(); @SuppressWarnings("unchecked")
Vector<Integer> clone = (Vector<Integer>)decisionPointList.clone();
exitPoints = clone;
// pop the original decision point list off the stack // pop the original decision point list off the stack
Vector temp = (Vector)decisionPointStack.pop(); Vector<Integer> temp = decisionPointStack.pop();
// we squirreled away the row number of our entry point list // we squirreled away the row number of our entry point list
// at the beginning of the original decision point list. Fish // at the beginning of the original decision point list. Fish
// that state number out and retrieve the entry point list // that state number out and retrieve the entry point list
int tempStateNum = ((Integer)temp.firstElement()).intValue(); int tempStateNum = temp.firstElement().intValue();
short[] tempState = (short[])tempStateTable.elementAt(tempStateNum); short[] tempState = tempStateTable.elementAt(tempStateNum);
// merge the original decision point list with the current // merge the original decision point list with the current
// decision point list // decision point list
...@@ -1217,8 +1227,8 @@ class RuleBasedBreakIteratorBuilder { ...@@ -1217,8 +1227,8 @@ class RuleBasedBreakIteratorBuilder {
else if (c == '/') { else if (c == '/') {
sawEarlyBreak = true; sawEarlyBreak = true;
for (int i = 0; i < decisionPointList.size(); i++) { for (int i = 0; i < decisionPointList.size(); i++) {
state = (short[])tempStateTable.elementAt(((Integer)decisionPointList. state = tempStateTable.elementAt(decisionPointList.
elementAt(i)).intValue()); elementAt(i).intValue());
state[numCategories] |= LOOKAHEAD_STATE_FLAG; state[numCategories] |= LOOKAHEAD_STATE_FLAG;
} }
} }
...@@ -1261,8 +1271,8 @@ class RuleBasedBreakIteratorBuilder { ...@@ -1261,8 +1271,8 @@ class RuleBasedBreakIteratorBuilder {
// signals that these states cause the break position to be updated to the // signals that these states cause the break position to be updated to the
// position of the slash rather than the current break position. // position of the slash rather than the current break position.
for (int i = 0; i < decisionPointList.size(); i++) { for (int i = 0; i < decisionPointList.size(); i++) {
int rowNum = ((Integer)decisionPointList.elementAt(i)).intValue(); int rowNum = decisionPointList.elementAt(i).intValue();
state = (short[])tempStateTable.elementAt(rowNum); state = tempStateTable.elementAt(rowNum);
state[numCategories] |= END_STATE_FLAG; state[numCategories] |= END_STATE_FLAG;
if (sawEarlyBreak) { if (sawEarlyBreak) {
state[numCategories] |= LOOKAHEAD_STATE_FLAG; state[numCategories] |= LOOKAHEAD_STATE_FLAG;
...@@ -1279,7 +1289,7 @@ class RuleBasedBreakIteratorBuilder { ...@@ -1279,7 +1289,7 @@ class RuleBasedBreakIteratorBuilder {
* list of the columns that need updating. * list of the columns that need updating.
* @param newValue Update the cells specfied above to contain this value * @param newValue Update the cells specfied above to contain this value
*/ */
private void updateStateTable(Vector rows, private void updateStateTable(Vector<Integer> rows,
String pendingChars, String pendingChars,
short newValue) { short newValue) {
// create a dummy state that has the specified row number (newValue) in // create a dummy state that has the specified row number (newValue) in
...@@ -1292,7 +1302,7 @@ class RuleBasedBreakIteratorBuilder { ...@@ -1292,7 +1302,7 @@ class RuleBasedBreakIteratorBuilder {
// go through the list of rows to update, and update them by calling // go through the list of rows to update, and update them by calling
// mergeStates() to merge them the the dummy state we created // mergeStates() to merge them the the dummy state we created
for (int i = 0; i < rows.size(); i++) { for (int i = 0; i < rows.size(); i++) {
mergeStates(((Integer)rows.elementAt(i)).intValue(), newValues, rows); mergeStates(rows.elementAt(i).intValue(), newValues, rows);
} }
} }
...@@ -1318,8 +1328,8 @@ class RuleBasedBreakIteratorBuilder { ...@@ -1318,8 +1328,8 @@ class RuleBasedBreakIteratorBuilder {
*/ */
private void mergeStates(int rowNum, private void mergeStates(int rowNum,
short[] newValues, short[] newValues,
Vector rowsBeingUpdated) { Vector<Integer> rowsBeingUpdated) {
short[] oldValues = (short[])(tempStateTable.elementAt(rowNum)); short[] oldValues = tempStateTable.elementAt(rowNum);
boolean isLoopingState = loopingStates.contains(new Integer(rowNum)); boolean isLoopingState = loopingStates.contains(new Integer(rowNum));
// for each of the cells in the rows we're reconciling, do... // for each of the cells in the rows we're reconciling, do...
...@@ -1375,7 +1385,7 @@ class RuleBasedBreakIteratorBuilder { ...@@ -1375,7 +1385,7 @@ class RuleBasedBreakIteratorBuilder {
// add this pair of row numbers to the merge list (create it first // add this pair of row numbers to the merge list (create it first
// if we haven't created the merge list yet) // if we haven't created the merge list yet)
if (mergeList == null) { if (mergeList == null) {
mergeList = new Vector(); mergeList = new Vector<>();
} }
mergeList.addElement(new int[] { oldRowNum, newRowNum, combinedRowNum }); mergeList.addElement(new int[] { oldRowNum, newRowNum, combinedRowNum });
...@@ -1384,7 +1394,7 @@ class RuleBasedBreakIteratorBuilder { ...@@ -1384,7 +1394,7 @@ class RuleBasedBreakIteratorBuilder {
// state table and update the original row (oldValues) to point // state table and update the original row (oldValues) to point
// to the new, merged, state // to the new, merged, state
short[] newRow = new short[numCategories + 1]; short[] newRow = new short[numCategories + 1];
short[] oldRow = (short[])(tempStateTable.elementAt(oldRowNum)); short[] oldRow = tempStateTable.elementAt(oldRowNum);
System.arraycopy(oldRow, 0, newRow, 0, numCategories + 1); System.arraycopy(oldRow, 0, newRow, 0, numCategories + 1);
tempStateTable.addElement(newRow); tempStateTable.addElement(newRow);
oldValues[i] = (short)combinedRowNum; oldValues[i] = (short)combinedRowNum;
...@@ -1408,7 +1418,7 @@ class RuleBasedBreakIteratorBuilder { ...@@ -1408,7 +1418,7 @@ class RuleBasedBreakIteratorBuilder {
// now (groan) do the same thing for all the entries on the // now (groan) do the same thing for all the entries on the
// decision point stack // decision point stack
for (int k = 0; k < decisionPointStack.size(); k++) { for (int k = 0; k < decisionPointStack.size(); k++) {
Vector dpl = (Vector)decisionPointStack.elementAt(k); Vector<Integer> dpl = decisionPointStack.elementAt(k);
if ((dpl.contains(new Integer(oldRowNum)) if ((dpl.contains(new Integer(oldRowNum))
|| dpl.contains(new Integer(newRowNum))) || dpl.contains(new Integer(newRowNum)))
&& !dpl.contains(new Integer(combinedRowNum)) && !dpl.contains(new Integer(combinedRowNum))
...@@ -1420,8 +1430,8 @@ class RuleBasedBreakIteratorBuilder { ...@@ -1420,8 +1430,8 @@ class RuleBasedBreakIteratorBuilder {
// FINALLY (puff puff puff), call mergeStates() recursively to copy // FINALLY (puff puff puff), call mergeStates() recursively to copy
// the row referred to by newValues into the new row and resolve any // the row referred to by newValues into the new row and resolve any
// conflicts that come up at that level // conflicts that come up at that level
mergeStates(combinedRowNum, (short[])(tempStateTable.elementAt( mergeStates(combinedRowNum, tempStateTable.elementAt(
newValues[i])), rowsBeingUpdated); newValues[i]), rowsBeingUpdated);
} }
} }
} }
...@@ -1445,7 +1455,7 @@ class RuleBasedBreakIteratorBuilder { ...@@ -1445,7 +1455,7 @@ class RuleBasedBreakIteratorBuilder {
else { else {
int[] entry; int[] entry;
for (int i = 0; i < mergeList.size(); i++) { for (int i = 0; i < mergeList.size(); i++) {
entry = (int[])(mergeList.elementAt(i)); entry = mergeList.elementAt(i);
// we have a hit if the two row numbers match the two row numbers // we have a hit if the two row numbers match the two row numbers
// in the beginning of the entry (the two that combine), in either // in the beginning of the entry (the two that combine), in either
...@@ -1477,20 +1487,21 @@ class RuleBasedBreakIteratorBuilder { ...@@ -1477,20 +1487,21 @@ class RuleBasedBreakIteratorBuilder {
* @param endStates The list of states to treat as end states (states that * @param endStates The list of states to treat as end states (states that
* can exit the loop). * can exit the loop).
*/ */
private void setLoopingStates(Vector newLoopingStates, Vector endStates) { private void setLoopingStates(Vector<Integer> newLoopingStates,
Vector<Integer> endStates) {
// if the current list of looping states isn't empty, we have to backfill // if the current list of looping states isn't empty, we have to backfill
// values from the looping states into the states that are waiting to be // values from the looping states into the states that are waiting to be
// backfilled // backfilled
if (!loopingStates.isEmpty()) { if (!loopingStates.isEmpty()) {
int loopingState = ((Integer)loopingStates.lastElement()).intValue(); int loopingState = loopingStates.lastElement().intValue();
int rowNum; int rowNum;
// don't backfill into an end state OR any state reachable from an end state // don't backfill into an end state OR any state reachable from an end state
// (since the search for reachable states is recursive, it's split out into // (since the search for reachable states is recursive, it's split out into
// a separate function, eliminateBackfillStates(), below) // a separate function, eliminateBackfillStates(), below)
for (int i = 0; i < endStates.size(); i++) { for (int i = 0; i < endStates.size(); i++) {
eliminateBackfillStates(((Integer)endStates.elementAt(i)).intValue()); eliminateBackfillStates(endStates.elementAt(i).intValue());
} }
// we DON'T actually backfill the states that need to be backfilled here. // we DON'T actually backfill the states that need to be backfilled here.
...@@ -1501,8 +1512,8 @@ class RuleBasedBreakIteratorBuilder { ...@@ -1501,8 +1512,8 @@ class RuleBasedBreakIteratorBuilder {
// for backfilling by putting the row number of the state to copy from // for backfilling by putting the row number of the state to copy from
// into the flag cell at the end of the row // into the flag cell at the end of the row
for (int i = 0; i < statesToBackfill.size(); i++) { for (int i = 0; i < statesToBackfill.size(); i++) {
rowNum = ((Integer)statesToBackfill.elementAt(i)).intValue(); rowNum = statesToBackfill.elementAt(i).intValue();
short[] state = (short[])tempStateTable.elementAt(rowNum); short[] state = tempStateTable.elementAt(rowNum);
state[numCategories] = state[numCategories] =
(short)((state[numCategories] & ALL_FLAGS) | loopingState); (short)((state[numCategories] & ALL_FLAGS) | loopingState);
} }
...@@ -1511,7 +1522,9 @@ class RuleBasedBreakIteratorBuilder { ...@@ -1511,7 +1522,9 @@ class RuleBasedBreakIteratorBuilder {
} }
if (newLoopingStates != null) { if (newLoopingStates != null) {
loopingStates = (Vector)newLoopingStates.clone(); @SuppressWarnings("unchecked")
Vector<Integer> clone = (Vector<Integer>)newLoopingStates.clone();
loopingStates = clone;
} }
} }
...@@ -1530,7 +1543,7 @@ class RuleBasedBreakIteratorBuilder { ...@@ -1530,7 +1543,7 @@ class RuleBasedBreakIteratorBuilder {
// then go through and recursively call this function for every // then go through and recursively call this function for every
// state that the base state points to // state that the base state points to
short[] state = (short[])tempStateTable.elementAt(baseState); short[] state = tempStateTable.elementAt(baseState);
for (int i = 0; i < numCategories; i++) { for (int i = 0; i < numCategories; i++) {
if (state[i] != 0) { if (state[i] != 0) {
eliminateBackfillStates(state[i]); eliminateBackfillStates(state[i]);
...@@ -1551,7 +1564,7 @@ class RuleBasedBreakIteratorBuilder { ...@@ -1551,7 +1564,7 @@ class RuleBasedBreakIteratorBuilder {
// for each state in the state table... // for each state in the state table...
for (int i = 0; i < tempStateTable.size(); i++) { for (int i = 0; i < tempStateTable.size(); i++) {
state = (short[])tempStateTable.elementAt(i); state = tempStateTable.elementAt(i);
// check the state's flag word to see if it's marked for backfilling // check the state's flag word to see if it's marked for backfilling
// (it's marked for backfilling if any bits other than the two high-order // (it's marked for backfilling if any bits other than the two high-order
...@@ -1563,7 +1576,7 @@ class RuleBasedBreakIteratorBuilder { ...@@ -1563,7 +1576,7 @@ class RuleBasedBreakIteratorBuilder {
// load up the state to copy from (if we haven't already) // load up the state to copy from (if we haven't already)
if (fromState != loopingStateRowNum) { if (fromState != loopingStateRowNum) {
loopingStateRowNum = fromState; loopingStateRowNum = fromState;
loopingState = (short[])tempStateTable.elementAt(loopingStateRowNum); loopingState = tempStateTable.elementAt(loopingStateRowNum);
} }
// clear out the backfill part of the flag word // clear out the backfill part of the flag word
...@@ -1594,7 +1607,7 @@ class RuleBasedBreakIteratorBuilder { ...@@ -1594,7 +1607,7 @@ class RuleBasedBreakIteratorBuilder {
backfillLoopingStates(); backfillLoopingStates();
int[] rowNumMap = new int[tempStateTable.size()]; int[] rowNumMap = new int[tempStateTable.size()];
Stack rowsToFollow = new Stack(); Stack<Integer> rowsToFollow = new Stack<>();
rowsToFollow.push(new Integer(1)); rowsToFollow.push(new Integer(1));
rowNumMap[1] = 1; rowNumMap[1] = 1;
...@@ -1602,8 +1615,8 @@ class RuleBasedBreakIteratorBuilder { ...@@ -1602,8 +1615,8 @@ class RuleBasedBreakIteratorBuilder {
// (the reachable states will have their row numbers in the row number // (the reachable states will have their row numbers in the row number
// map, and the nonreachable states will have zero in the row number map) // map, and the nonreachable states will have zero in the row number map)
while (rowsToFollow.size() != 0) { while (rowsToFollow.size() != 0) {
int rowNum = ((Integer)rowsToFollow.pop()).intValue(); int rowNum = rowsToFollow.pop().intValue();
short[] row = (short[])(tempStateTable.elementAt(rowNum)); short[] row = tempStateTable.elementAt(rowNum);
for (int i = 0; i < numCategories; i++) { for (int i = 0; i < numCategories; i++) {
if (row[i] != 0) { if (row[i] != 0) {
...@@ -1632,7 +1645,7 @@ class RuleBasedBreakIteratorBuilder { ...@@ -1632,7 +1645,7 @@ class RuleBasedBreakIteratorBuilder {
if (rowNumMap[i] == 0) { if (rowNumMap[i] == 0) {
continue; continue;
} }
state1 = (short[])tempStateTable.elementAt(i); state1 = tempStateTable.elementAt(i);
for (int j = 0; j < numCategories; j++) { for (int j = 0; j < numCategories; j++) {
if (state1[j] != 0) { if (state1[j] != 0) {
++stateClasses[i]; ++stateClasses[i];
...@@ -1663,10 +1676,10 @@ class RuleBasedBreakIteratorBuilder { ...@@ -1663,10 +1676,10 @@ class RuleBasedBreakIteratorBuilder {
for (int i = 0; i < stateClasses.length; i++) { for (int i = 0; i < stateClasses.length; i++) {
if (stateClasses[i] == currentClass) { if (stateClasses[i] == currentClass) {
if (state1 == null) { if (state1 == null) {
state1 = (short[])tempStateTable.elementAt(i); state1 = tempStateTable.elementAt(i);
} }
else { else {
state2 = (short[])tempStateTable.elementAt(i); state2 = tempStateTable.elementAt(i);
for (int j = 0; j < state2.length; j++) { for (int j = 0; j < state2.length; j++) {
if ((j == numCategories && state1[j] != state2[j] && forward) if ((j == numCategories && state1[j] != state2[j] && forward)
|| (j != numCategories && stateClasses[state1[j]] || (j != numCategories && stateClasses[state1[j]]
...@@ -1733,7 +1746,7 @@ class RuleBasedBreakIteratorBuilder { ...@@ -1733,7 +1746,7 @@ class RuleBasedBreakIteratorBuilder {
int p = 0; int p = 0;
int p2 = 0; int p2 = 0;
for (int i = 0; i < tempStateTable.size(); i++) { for (int i = 0; i < tempStateTable.size(); i++) {
short[] row = (short[])(tempStateTable.elementAt(i)); short[] row = tempStateTable.elementAt(i);
if (row == null) { if (row == null) {
continue; continue;
} }
...@@ -1752,7 +1765,7 @@ class RuleBasedBreakIteratorBuilder { ...@@ -1752,7 +1765,7 @@ class RuleBasedBreakIteratorBuilder {
backwardsStateTable = new short[newRowNum * numCategories]; backwardsStateTable = new short[newRowNum * numCategories];
int p = 0; int p = 0;
for (int i = 0; i < tempStateTable.size(); i++) { for (int i = 0; i < tempStateTable.size(); i++) {
short[] row = (short[])(tempStateTable.elementAt(i)); short[] row = tempStateTable.elementAt(i);
if (row == null) { if (row == null) {
continue; continue;
} }
...@@ -1769,12 +1782,12 @@ class RuleBasedBreakIteratorBuilder { ...@@ -1769,12 +1782,12 @@ class RuleBasedBreakIteratorBuilder {
* table and any additional rules (identified by the ! on the front) * table and any additional rules (identified by the ! on the front)
* supplied in the description * supplied in the description
*/ */
private void buildBackwardsStateTable(Vector tempRuleList) { private void buildBackwardsStateTable(Vector<String> tempRuleList) {
// create the temporary state table and seed it with two rows (row 0 // create the temporary state table and seed it with two rows (row 0
// isn't used for anything, and we have to create row 1 (the initial // isn't used for anything, and we have to create row 1 (the initial
// state) before we can do anything else // state) before we can do anything else
tempStateTable = new Vector(); tempStateTable = new Vector<>();
tempStateTable.addElement(new short[numCategories + 1]); tempStateTable.addElement(new short[numCategories + 1]);
tempStateTable.addElement(new short[numCategories + 1]); tempStateTable.addElement(new short[numCategories + 1]);
...@@ -1786,7 +1799,7 @@ class RuleBasedBreakIteratorBuilder { ...@@ -1786,7 +1799,7 @@ class RuleBasedBreakIteratorBuilder {
// the same syntax as the normal break rules, but begin with '!' to distinguish // the same syntax as the normal break rules, but begin with '!' to distinguish
// them from normal break rules // them from normal break rules
for (int i = 0; i < tempRuleList.size(); i++) { for (int i = 0; i < tempRuleList.size(); i++) {
String rule = (String)tempRuleList.elementAt(i); String rule = tempRuleList.elementAt(i);
if (rule.charAt(0) == '!') { if (rule.charAt(0) == '!') {
parseRule(rule.substring(1), false); parseRule(rule.substring(1), false);
} }
...@@ -1831,7 +1844,7 @@ class RuleBasedBreakIteratorBuilder { ...@@ -1831,7 +1844,7 @@ class RuleBasedBreakIteratorBuilder {
for (int i = 0; i < numCategories + 1; i++) for (int i = 0; i < numCategories + 1; i++)
tempStateTable.addElement(new short[numCategories + 1]); tempStateTable.addElement(new short[numCategories + 1]);
short[] state = (short[])tempStateTable.elementAt(backTableOffset - 1); short[] state = tempStateTable.elementAt(backTableOffset - 1);
for (int i = 0; i < numCategories; i++) for (int i = 0; i < numCategories; i++)
state[i] = (short)(i + backTableOffset); state[i] = (short)(i + backTableOffset);
...@@ -1855,7 +1868,7 @@ class RuleBasedBreakIteratorBuilder { ...@@ -1855,7 +1868,7 @@ class RuleBasedBreakIteratorBuilder {
for (int nextColumn = 0; nextColumn < numCategories; nextColumn++) { for (int nextColumn = 0; nextColumn < numCategories; nextColumn++) {
int cellValue = lookupState(nextRow, nextColumn); int cellValue = lookupState(nextRow, nextColumn);
if (cellValue != 0) { if (cellValue != 0) {
state = (short[])tempStateTable.elementAt(nextColumn + state = tempStateTable.elementAt(nextColumn +
backTableOffset); backTableOffset);
state[column] = (short)(column + backTableOffset); state[column] = (short)(column + backTableOffset);
} }
...@@ -1876,9 +1889,9 @@ class RuleBasedBreakIteratorBuilder { ...@@ -1876,9 +1889,9 @@ class RuleBasedBreakIteratorBuilder {
// populated that is also populated in row 1 of the rule-based // populated that is also populated in row 1 of the rule-based
// sub-table, copy the value from row 1 over the value in the // sub-table, copy the value from row 1 over the value in the
// auto-generated sub-table // auto-generated sub-table
state = (short[])tempStateTable.elementAt(1); state = tempStateTable.elementAt(1);
for (int i = backTableOffset - 1; i < tempStateTable.size(); i++) { for (int i = backTableOffset - 1; i < tempStateTable.size(); i++) {
short[] state2 = (short[])tempStateTable.elementAt(i); short[] state2 = tempStateTable.elementAt(i);
for (int j = 0; j < numCategories; j++) { for (int j = 0; j < numCategories; j++) {
if (state[j] != 0 && state2[j] != 0) { if (state[j] != 0 && state2[j] != 0) {
state2[j] = state[j]; state2[j] = state[j];
...@@ -1890,9 +1903,9 @@ class RuleBasedBreakIteratorBuilder { ...@@ -1890,9 +1903,9 @@ class RuleBasedBreakIteratorBuilder {
// an end state, fill in all unpopulated cells with the values // an end state, fill in all unpopulated cells with the values
// of the corresponding cells in the first row of the auto- // of the corresponding cells in the first row of the auto-
// generated sub-table. // generated sub-table.
state = (short[])tempStateTable.elementAt(backTableOffset - 1); state = tempStateTable.elementAt(backTableOffset - 1);
for (int i = 1; i < backTableOffset - 1; i++) { for (int i = 1; i < backTableOffset - 1; i++) {
short[] state2 = (short[])tempStateTable.elementAt(i); short[] state2 = tempStateTable.elementAt(i);
if ((state2[numCategories] & END_STATE_FLAG) == 0) { if ((state2[numCategories] & END_STATE_FLAG) == 0) {
for (int j = 0; j < numCategories; j++) { for (int j = 0; j < numCategories; j++) {
if (state2[j] == 0) { if (state2[j] == 0) {
......
/* /*
* Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -128,7 +128,7 @@ final class SupplementaryCharacterData { ...@@ -128,7 +128,7 @@ final class SupplementaryCharacterData {
int new_index = 0; int new_index = 0;
int loop_count = dataCount - 1; int loop_count = dataCount - 1;
long data = tempTable[old_index]; long data = tempTable[old_index];
int start = (int)((long)(data>>32)) & CODEPOINT_MASK; int start = (int)(data>>32) & CODEPOINT_MASK;
int end = (int)(data>>8) & CODEPOINT_MASK; int end = (int)(data>>8) & CODEPOINT_MASK;
/* /*
...@@ -142,7 +142,7 @@ final class SupplementaryCharacterData { ...@@ -142,7 +142,7 @@ final class SupplementaryCharacterData {
newTempTable[new_index++] = composeEntry(start, (int)data); newTempTable[new_index++] = composeEntry(start, (int)data);
for (int i = 0; i < loop_count; i++) { for (int i = 0; i < loop_count; i++) {
data = tempTable[++old_index]; data = tempTable[++old_index];
int nextStart = (int)((long)(data>>32)) & CODEPOINT_MASK; int nextStart = (int)(data>>32) & CODEPOINT_MASK;
/* /*
* If the previous end code point is not equal to the previous start * If the previous end code point is not equal to the previous start
......
/* /*
* Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -1290,7 +1290,7 @@ OUTER: for (int i = 0; i < n; i += m) { ...@@ -1290,7 +1290,7 @@ OUTER: for (int i = 0; i < n; i += m) {
else if (bits == 32 || bits < 8) else if (bits == 32 || bits < 8)
result.append(hex8((int)val)); result.append(hex8((int)val));
else { else {
result.append(hex16((long)val)); result.append(hex16(val));
if (!Csyntax) if (!Csyntax)
result.append("L"); result.append("L");
} }
......
/* /*
* Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -39,7 +39,7 @@ import java.lang.*; ...@@ -39,7 +39,7 @@ import java.lang.*;
* <p> * <p>
* @author John O'Conner * @author John O'Conner
*/ */
public class SpecialCaseMap implements Comparable { public class SpecialCaseMap implements Comparable<SpecialCaseMap> {
SpecialCaseMap() { SpecialCaseMap() {
chSource = 0xFFFF; chSource = 0xFFFF;
...@@ -55,7 +55,7 @@ public class SpecialCaseMap implements Comparable { ...@@ -55,7 +55,7 @@ public class SpecialCaseMap implements Comparable {
*/ */
public static SpecialCaseMap[] readSpecFile(File file, int plane) throws FileNotFoundException { public static SpecialCaseMap[] readSpecFile(File file, int plane) throws FileNotFoundException {
ArrayList caseMaps = new ArrayList(150); ArrayList<SpecialCaseMap> caseMaps = new ArrayList<>(150);
int count = 0; int count = 0;
BufferedReader f = new BufferedReader(new FileReader(file)); BufferedReader f = new BufferedReader(new FileReader(file));
String line = null; String line = null;
...@@ -69,7 +69,7 @@ public class SpecialCaseMap implements Comparable { ...@@ -69,7 +69,7 @@ public class SpecialCaseMap implements Comparable {
SpecialCaseMap item = parse(line.trim()); SpecialCaseMap item = parse(line.trim());
if (item != null) { if (item != null) {
if(item.getCharSource() >> 16 < plane) continue; if(item.getCharSource() >> 16 < plane) continue;
if((int)(item.getCharSource() >> 16) > plane) break; if(item.getCharSource() >> 16 > plane) break;
caseMaps.add(item); caseMaps.add(item);
++count; ++count;
} }
...@@ -83,7 +83,7 @@ public class SpecialCaseMap implements Comparable { ...@@ -83,7 +83,7 @@ public class SpecialCaseMap implements Comparable {
} }
/** /**
* Given one line of a Unicode special casing data file as a String, parse the line * Given one line of a Unicode special casing data file as a String, parse the line
* and return a SpecialCaseMap object that contains the case mapping. * and return a SpecialCaseMap object that contains the case mapping.
* *
...@@ -177,25 +177,25 @@ public class SpecialCaseMap implements Comparable { ...@@ -177,25 +177,25 @@ public class SpecialCaseMap implements Comparable {
else return -1; else return -1;
} }
/* /*
* Extracts and returns the high surrogate value from a UTF-32 code point. * Extracts and returns the high surrogate value from a UTF-32 code point.
* If argument is a BMP character, then it is converted to a char and returned; * If argument is a BMP character, then it is converted to a char and returned;
* otherwise the high surrogate value is extracted. * otherwise the high surrogate value is extracted.
* @param codePoint a UTF-32 codePoint with value greater than 0xFFFF. * @param codePoint a UTF-32 codePoint with value greater than 0xFFFF.
* @return the high surrogate value that helps create <code>codePoint</code>; else * @return the high surrogate value that helps create <code>codePoint</code>; else
* the char representation of <code>codePoint</code> if it is a BMP character. * the char representation of <code>codePoint</code> if it is a BMP character.
* @since 1.5 * @since 1.5
*/ */
static char getHighSurrogate(int codePoint) { static char getHighSurrogate(int codePoint) {
char high = (char)codePoint; char high = (char)codePoint;
if (codePoint > 0xFFFF) { if (codePoint > 0xFFFF) {
high = (char)((codePoint - 0x10000)/0x0400 + 0xD800); high = (char)((codePoint - 0x10000)/0x0400 + 0xD800);
}
return high;
} }
return high;
}
/* /*
* Extracts and returns the low surrogate value from a UTF-32 code point. * Extracts and returns the low surrogate value from a UTF-32 code point.
* If argument is a BMP character, then it is converted to a char and returned; * If argument is a BMP character, then it is converted to a char and returned;
* otherwise the high surrogate value is extracted. * otherwise the high surrogate value is extracted.
...@@ -204,29 +204,28 @@ public class SpecialCaseMap implements Comparable { ...@@ -204,29 +204,28 @@ public class SpecialCaseMap implements Comparable {
* the char representation of <code>codePoint</code> if it is a BMP character. * the char representation of <code>codePoint</code> if it is a BMP character.
* @since 1.5 * @since 1.5
*/ */
static char getLowSurrogate(int codePoint) { static char getLowSurrogate(int codePoint) {
char low = (char)codePoint; char low = (char)codePoint;
if(codePoint > 0xFFFF) { if(codePoint > 0xFFFF) {
low = (char)((codePoint - 0x10000)%0x0400 + 0xDC00); low = (char)((codePoint - 0x10000)%0x0400 + 0xDC00);
}
return low;
} }
return low;
}
static String hex6(int n) { static String hex6(int n) {
String str = Integer.toHexString(n & 0xFFFFFF).toUpperCase(); String str = Integer.toHexString(n & 0xFFFFFF).toUpperCase();
return "000000".substring(Math.min(6, str.length())) + str; return "000000".substring(Math.min(6, str.length())) + str;
}
}
static String hex6(char[] map){ static String hex6(char[] map){
StringBuffer buff = new StringBuffer(); StringBuffer buff = new StringBuffer();
int x=0; int x=0;
buff.append(hex6(map[x++])); buff.append(hex6(map[x++]));
while(x<map.length) { while(x<map.length) {
buff.append(" " + hex6(map[x++])); buff.append(" " + hex6(map[x++]));
}
return buff.toString();
} }
return buff.toString();
}
void setCharSource(int ch) { void setCharSource(int ch) {
chSource = ch; chSource = ch;
...@@ -302,56 +301,62 @@ public class SpecialCaseMap implements Comparable { ...@@ -302,56 +301,62 @@ public class SpecialCaseMap implements Comparable {
static String CONTEXT_MODERN = "MODERN"; static String CONTEXT_MODERN = "MODERN";
static String CONTEXT_NONMODERN = "NON_MODERN"; static String CONTEXT_NONMODERN = "NON_MODERN";
public int compareTo(Object otherObject) { public int compareTo(SpecialCaseMap otherObject) {
SpecialCaseMap other = (SpecialCaseMap)otherObject; if (chSource < otherObject.chSource) {
if (chSource < other.chSource) {
return -1; return -1;
} }
else if (chSource > other.chSource) { else if (chSource > otherObject.chSource) {
return 1; return 1;
} }
else return 0; else return 0;
} }
public boolean equals(Object o1) { public boolean equals(Object o1) {
boolean bEqual = false; if (this == o1) {
if (0 == compareTo(o1)) { return true;
bEqual = true; }
} if (o1 == null || !(o1 instanceof SpecialCaseMap)) {
return false;
}
SpecialCaseMap other = (SpecialCaseMap)o1;
boolean bEqual = false;
if (0 == compareTo(other)) {
bEqual = true;
}
return bEqual; return bEqual;
} }
public String toString() { public String toString() {
StringBuffer buff = new StringBuffer(); StringBuffer buff = new StringBuffer();
buff.append(hex6(getCharSource())); buff.append(hex6(getCharSource()));
buff.append("|" + hex6(lowerCaseMap)); buff.append("|" + hex6(lowerCaseMap));
buff.append("|" + hex6(upperCaseMap)); buff.append("|" + hex6(upperCaseMap));
buff.append("|" + hex6(titleCaseMap)); buff.append("|" + hex6(titleCaseMap));
buff.append("|" + context); buff.append("|" + context);
return buff.toString(); return buff.toString();
} }
public int hashCode() { public int hashCode() {
return (int)chSource; return chSource;
} }
public static void main(String[] args) { public static void main(String[] args) {
SpecialCaseMap[] spec = null; SpecialCaseMap[] spec = null;
if (args.length == 2 ) { if (args.length == 2 ) {
try { try {
File file = new File(args[0]); File file = new File(args[0]);
int plane = Integer.parseInt(args[1]); int plane = Integer.parseInt(args[1]);
spec = SpecialCaseMap.readSpecFile(file, plane); spec = SpecialCaseMap.readSpecFile(file, plane);
System.out.println("SpecialCaseMap[" + spec.length + "]:"); System.out.println("SpecialCaseMap[" + spec.length + "]:");
for (int x=0; x<spec.length; x++) { for (int x=0; x<spec.length; x++) {
System.out.println(spec[x].toString()); System.out.println(spec[x].toString());
}
}
catch(Exception e) {
e.printStackTrace();
}
} }
}
catch(Exception e) {
e.printStackTrace();
}
} }
}
} }
/* /*
* Copyright (c) 2002, 2004, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -391,31 +391,31 @@ public class UnicodeSpec { ...@@ -391,31 +391,31 @@ public class UnicodeSpec {
*/ */
public static UnicodeSpec[] readSpecFile(File file, int plane) throws FileNotFoundException { public static UnicodeSpec[] readSpecFile(File file, int plane) throws FileNotFoundException {
ArrayList list = new ArrayList(3000); ArrayList<UnicodeSpec> list = new ArrayList<>(3000);
UnicodeSpec[] result = null; UnicodeSpec[] result = null;
int count = 0; int count = 0;
BufferedReader f = new BufferedReader(new FileReader(file)); BufferedReader f = new BufferedReader(new FileReader(file));
String line = null; String line = null;
loop: loop:
while(true) { while(true) {
try { try {
line = f.readLine(); line = f.readLine();
} }
catch (IOException e) { catch (IOException e) {
break loop; break loop;
} }
if (line == null) break loop; if (line == null) break loop;
UnicodeSpec item = parse(line.trim()); UnicodeSpec item = parse(line.trim());
int specPlane = (int)(item.getCodePoint() >>> 16); int specPlane = item.getCodePoint() >>> 16;
if (specPlane < plane) continue; if (specPlane < plane) continue;
if (specPlane > plane) break; if (specPlane > plane) break;
if (item != null) { if (item != null) {
list.add(item); list.add(item);
} }
} }
result = new UnicodeSpec[list.size()]; result = new UnicodeSpec[list.size()];
list.toArray(result); list.toArray(result);
return result; return result;
} }
......
/* /*
* Copyright (c) 2001, 2006, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -250,10 +250,10 @@ public class GenerateCurrencyData { ...@@ -250,10 +250,10 @@ public class GenerateCurrencyData {
return Integer.parseInt(numericCode); return Integer.parseInt(numericCode);
} }
static HashMap specialCaseMap = new HashMap(); static HashMap<String, Integer> specialCaseMap = new HashMap<>();
private static int makeSpecialCaseEntry(String currencyInfo) throws Exception { private static int makeSpecialCaseEntry(String currencyInfo) throws Exception {
Integer oldEntry = (Integer) specialCaseMap.get(currencyInfo); Integer oldEntry = specialCaseMap.get(currencyInfo);
if (oldEntry != null) { if (oldEntry != null) {
return oldEntry.intValue(); return oldEntry.intValue();
} }
......
/* /*
* Copyright (c) 2004, 2005, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -51,15 +51,15 @@ public class Hasher { ...@@ -51,15 +51,15 @@ public class Hasher {
boolean verbose = false; boolean verbose = false;
List keys = new ArrayList(); // Key strings List<String> keys = new ArrayList<>(); // Key strings
List values = new ArrayList(); // Value expressions List<String> values = new ArrayList<>(); // Value expressions
String pkg = null; // Package prefix for generated class String pkg = null; // Package prefix for generated class
String cln = null; // Name of generated class String cln = null; // Name of generated class
String vtype = "String"; // Value type String vtype = "String"; // Value type
int maxBits = 11; // lg table size int maxBits = 11; // lg table size
int maxDepth = 3; // Max chain depth int maxDepth = 3; // Max chain depth
boolean inner = false; // Generating an inner class? boolean inner = false; // Generating an inner class?
boolean empty = false; // Generating an empty table? boolean empty = false; // Generating an empty table?
void usage() { void usage() {
err.println("usage: java Hasher [options] [[pkgName.]ClassName]"); err.println("usage: java Hasher [options] [[pkgName.]ClassName]");
...@@ -76,9 +76,9 @@ public class Hasher { ...@@ -76,9 +76,9 @@ public class Hasher {
} }
Hasher(String[] args) { Hasher(String[] args) {
List as = Arrays.asList(args); List<String> as = Arrays.asList(args);
for (Iterator i = as.iterator(); i.hasNext();) { for (Iterator<String> i = as.iterator(); i.hasNext();) {
String a = (String)i.next(); String a = i.next();
if (a.equals("-e")) { if (a.equals("-e")) {
empty = true; empty = true;
} else if (a.equals("-i")) { } else if (a.equals("-i")) {
...@@ -88,15 +88,15 @@ public class Hasher { ...@@ -88,15 +88,15 @@ public class Hasher {
} else if (a.equals("-md")) { } else if (a.equals("-md")) {
if (!i.hasNext()) if (!i.hasNext())
usage(); usage();
maxDepth = Integer.parseInt((String)i.next()); maxDepth = Integer.parseInt(i.next());
} else if (a.equals("-mb")) { } else if (a.equals("-mb")) {
if (!i.hasNext()) if (!i.hasNext())
usage(); usage();
maxBits = Integer.parseInt((String)i.next()); maxBits = Integer.parseInt(i.next());
} else if (a.equals("-t")) { } else if (a.equals("-t")) {
if (!i.hasNext()) if (!i.hasNext())
usage(); usage();
vtype = (String)i.next(); vtype = i.next();
} else if (a.startsWith("-")) { } else if (a.startsWith("-")) {
usage(); usage();
} else { } else {
...@@ -153,8 +153,8 @@ public class Hasher { ...@@ -153,8 +153,8 @@ public class Hasher {
int nw = keys.size(); int nw = keys.size();
for (int i = 0; i < nw; i++) { for (int i = 0; i < nw; i++) {
String w = (String)keys.get(i); String w = keys.get(i);
String v = (String)values.get(i); String v = values.get(i);
int h = hash(w); int h = hash(w);
if (ht[h] == null) if (ht[h] == null)
ht[h] = new Object[] { w, v }; ht[h] = new Object[] { w, v };
...@@ -217,7 +217,7 @@ public class Hasher { ...@@ -217,7 +217,7 @@ public class Hasher {
if (verbose) if (verbose)
err.println(); err.println();
for (int i = 0, n = keys.size(); i < n; i++) { for (int i = 0, n = keys.size(); i < n; i++) {
String w = (String)keys.get(i); String w = keys.get(i);
String v = get(w); String v = get(w);
if (verbose) if (verbose)
err.println(hash(w) + "\t" + w); err.println(hash(w) + "\t" + w);
......
/* /*
* Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -43,7 +43,8 @@ public class JarSplit { ...@@ -43,7 +43,8 @@ public class JarSplit {
/* classlist[0] contains class file list /* classlist[0] contains class file list
* classlist[1] contains non-class file list * classlist[1] contains non-class file list
*/ */
private static Vector<String>[] classlist = (Vector<String>[])(new Vector[2]); @SuppressWarnings("unchecked")
private static Vector<String>[] classlist = new Vector<>[2];
/* The 2 class list name passed as arguments. */ /* The 2 class list name passed as arguments. */
private static String[] fileNamelist = new String[2]; private static String[] fileNamelist = new String[2];
......
/* /*
* Copyright (c) 2000, 2005, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -30,14 +30,9 @@ import java.io.File; ...@@ -30,14 +30,9 @@ import java.io.File;
import java.io.FileOutputStream; import java.io.FileOutputStream;
import java.io.DataOutputStream; import java.io.DataOutputStream;
import java.io.RandomAccessFile; import java.io.RandomAccessFile;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import java.util.TreeMap;
import java.util.TreeSet;
import sun.util.calendar.ZoneInfoFile; import sun.util.calendar.ZoneInfoFile;
/** /**
...@@ -105,14 +100,13 @@ class Gen extends BackEnd { ...@@ -105,14 +100,13 @@ class Gen extends BackEnd {
/* if DST offset is 0, this means DST isn't used. /* if DST offset is 0, this means DST isn't used.
* (NOT: offset's index is 0.) * (NOT: offset's index is 0.)
*/ */
if ((dstoffset = if ((dstoffset = dstOffsets.get(i).intValue()) == -1) {
((Integer)dstOffsets.get(i)).intValue()) == -1) {
dstoffset = 0; dstoffset = 0;
} }
dos.writeLong((((Long)transitions.get(i)).longValue() << 12) dos.writeLong((transitions.get(i).longValue() << 12)
| (dstoffset << 4) | (dstoffset << 4)
| ((Integer)offsets.get(i)).intValue()); | offsets.get(i).intValue());
} }
......
/* /*
* Copyright (c) 2001, 2006, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -31,12 +31,8 @@ import java.io.File; ...@@ -31,12 +31,8 @@ import java.io.File;
import java.io.FileReader; import java.io.FileReader;
import java.io.FileWriter; import java.io.FileWriter;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
...@@ -189,7 +185,7 @@ class GenDoc extends BackEnd { ...@@ -189,7 +185,7 @@ class GenDoc extends BackEnd {
out.write(header1 + new Date() + header3 + zonename + header4); out.write(header1 + new Date() + header3 + zonename + header4);
out.write(body1 + "<FONT size=\"+2\"><B>" + zonename + "</B></FONT>"); out.write(body1 + "<FONT size=\"+2\"><B>" + zonename + "</B></FONT>");
LatitudeAndLongitude location = (LatitudeAndLongitude)mapList.get(zonename); LatitudeAndLongitude location = mapList.get(zonename);
if (location != null) { if (location != null) {
int deg, min, sec; int deg, min, sec;
...@@ -608,12 +604,12 @@ class GenDoc extends BackEnd { ...@@ -608,12 +604,12 @@ class GenDoc extends BackEnd {
"<BR>\n\n" + "<TABLE BORDER=\"0\" WIDTH=\"100%\">\n" + "<BR>\n\n" + "<TABLE BORDER=\"0\" WIDTH=\"100%\">\n" +
"<TR>\n<TD NOWRAP>\n"); "<TR>\n<TD NOWRAP>\n");
Set aliasSet = a.keySet(); Set<String> aliasSet = a.keySet();
len = aliasSet.size(); len = aliasSet.size();
Object aliasNames[] = aliasSet.toArray(); String aliasNames[] = aliasSet.toArray(new String[0]);
for (int i = 0; i < len; i++) { for (int i = 0; i < len; i++) {
displayNameList.put(transform((String)aliasNames[i]), displayNameList.put(transform(aliasNames[i]),
(String)aliasNames[i]); aliasNames[i]);
} }
o = displayNameList.keySet().toArray(); o = displayNameList.keySet().toArray();
......
/* /*
* Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
package build.tools.javazic; package build.tools.javazic;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Iterator;
import java.util.List; import java.util.List;
/** /**
......
/* /*
* Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -26,9 +26,6 @@ ...@@ -26,9 +26,6 @@
package build.tools.javazic; package build.tools.javazic;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
......
/* /*
* Copyright (c) 2000, 2006, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -29,10 +29,7 @@ import java.io.BufferedWriter; ...@@ -29,10 +29,7 @@ import java.io.BufferedWriter;
import java.io.File; import java.io.File;
import java.io.FileWriter; import java.io.FileWriter;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
...@@ -51,22 +48,19 @@ class Simple extends BackEnd { ...@@ -51,22 +48,19 @@ class Simple extends BackEnd {
/** /**
* Zone records which are applied for given year. * Zone records which are applied for given year.
*/ */
private static Map<String,ZoneRec> lastZoneRecs private static Map<String,ZoneRec> lastZoneRecs = new HashMap<>();
= new HashMap<String,ZoneRec>();
/** /**
* Rule records which are applied for given year. * Rule records which are applied for given year.
*/ */
private static Map<String,List<RuleRec>> lastRules private static Map<String,List<RuleRec>> lastRules = new TreeMap<>();
= new TreeMap<String,List<RuleRec>>();
/** /**
* zone IDs sorted by their GMT offsets. If zone's GMT * zone IDs sorted by their GMT offsets. If zone's GMT
* offset will change in the future, its last known offset is * offset will change in the future, its last known offset is
* used. * used.
*/ */
private SortedMap<Integer, Set<String>> zonesByOffset private SortedMap<Integer, Set<String>> zonesByOffset = new TreeMap<>();
= new TreeMap<Integer, Set<String>>();
/** /**
* Sets last Rule records and Zone records for given timezone to * Sets last Rule records and Zone records for given timezone to
...@@ -86,7 +80,7 @@ class Simple extends BackEnd { ...@@ -86,7 +80,7 @@ class Simple extends BackEnd {
int lastKnownOffset = tz.getRawOffset(); int lastKnownOffset = tz.getRawOffset();
Set<String> set = zonesByOffset.get(lastKnownOffset); Set<String> set = zonesByOffset.get(lastKnownOffset);
if (set == null) { if (set == null) {
set = new TreeSet<String>(); set = new TreeSet<>();
zonesByOffset.put(lastKnownOffset, set); zonesByOffset.put(lastKnownOffset, set);
} }
set.add(zonename); set.add(zonename);
...@@ -101,16 +95,11 @@ class Simple extends BackEnd { ...@@ -101,16 +95,11 @@ class Simple extends BackEnd {
*/ */
int generateSrc(Mappings map) { int generateSrc(Mappings map) {
try { try {
String outputDir = Main.getOutputDir(); File outD = new File(Main.getOutputDir());
File outD = new File(outputDir);
if (!outputDir.endsWith(File.separator)) {
outputDir += outD.separator;
}
outD.mkdirs(); outD.mkdirs();
FileWriter fw = FileWriter fw =
new FileWriter(outputDir + "TimeZoneData.java", false); new FileWriter(new File(outD, "TimeZoneData.java"), false);
BufferedWriter out = new BufferedWriter(fw); BufferedWriter out = new BufferedWriter(fw);
out.write("import java.util.SimpleTimeZone;\n\n"); out.write("import java.util.SimpleTimeZone;\n\n");
......
/* /*
* Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -268,16 +268,16 @@ class Time { ...@@ -268,16 +268,16 @@ class Time {
if (index < time.length()) { if (index < time.length()) {
char c = time.charAt(index++); char c = time.charAt(index++);
if (c == 's') { if (c == 's') {
tm.setType(tm.STD); tm.setType(Time.STD);
} else if (c == 'u' || c == 'g' || c == 'z') { } else if (c == 'u' || c == 'g' || c == 'z') {
tm.setType(tm.UTC); tm.setType(Time.UTC);
} else if (c == 'w') { } else if (c == 'w') {
tm.setType(tm.WALL); tm.setType(Time.WALL);
} else { } else {
Main.panic("unknown time mode: "+c); Main.panic("unknown time mode: "+c);
} }
} else { } else {
tm.setType(tm.WALL); tm.setType(Time.WALL);
} }
return tm; return tm;
} }
......
/* /*
* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -29,9 +29,7 @@ import java.io.BufferedReader; ...@@ -29,9 +29,7 @@ import java.io.BufferedReader;
import java.io.FileReader; import java.io.FileReader;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.StringTokenizer; import java.util.StringTokenizer;
...@@ -407,9 +405,9 @@ class Zoneinfo { ...@@ -407,9 +405,9 @@ class Zoneinfo {
if (!zrec.hasUntil()) { if (!zrec.hasUntil()) {
if (tz.getNTransitions() > 0) { if (tz.getNTransitions() > 0) {
if (stdOffset == 0) { if (stdOffset == 0) {
tz.setDSTType(tz.X_DST); tz.setDSTType(Timezone.X_DST);
} else { } else {
tz.setDSTType(tz.LAST_DST); tz.setDSTType(Timezone.LAST_DST);
} }
long time = Time.getLocalTime(maxYear, long time = Time.getLocalTime(maxYear,
Month.JANUARY, 1, 0); Month.JANUARY, 1, 0);
...@@ -419,7 +417,7 @@ class Zoneinfo { ...@@ -419,7 +417,7 @@ class Zoneinfo {
tz.getDstOffsetIndex(stdOffset)); tz.getDstOffsetIndex(stdOffset));
tz.addUsedRec(zrec); tz.addUsedRec(zrec);
} else { } else {
tz.setDSTType(tz.NO_DST); tz.setDSTType(Timezone.NO_DST);
} }
break; break;
} }
...@@ -527,7 +525,7 @@ class Zoneinfo { ...@@ -527,7 +525,7 @@ class Zoneinfo {
if (year == endYear && !zrec.hasUntil()) { if (year == endYear && !zrec.hasUntil()) {
if (tz.getNTransitions() > 0) { if (tz.getNTransitions() > 0) {
// Assume that this Zone stopped DST // Assume that this Zone stopped DST
tz.setDSTType(tz.X_DST); tz.setDSTType(Timezone.X_DST);
long time = Time.getLocalTime(maxYear, Month.JANUARY, long time = Time.getLocalTime(maxYear, Month.JANUARY,
1, 0); 1, 0);
time -= zrec.getGmtOffset(); time -= zrec.getGmtOffset();
...@@ -536,7 +534,7 @@ class Zoneinfo { ...@@ -536,7 +534,7 @@ class Zoneinfo {
tz.getDstOffsetIndex(0)); tz.getDstOffsetIndex(0));
usedZone = true; usedZone = true;
} else { } else {
tz.setDSTType(tz.NO_DST); tz.setDSTType(Timezone.NO_DST);
} }
} }
} }
...@@ -552,8 +550,8 @@ class Zoneinfo { ...@@ -552,8 +550,8 @@ class Zoneinfo {
} }
} }
if (tz.getDSTType() == tz.UNDEF_DST) { if (tz.getDSTType() == Timezone.UNDEF_DST) {
tz.setDSTType(tz.DST); tz.setDSTType(Timezone.DST);
} }
tz.optimize(); tz.optimize();
tz.checksum(); tz.checksum();
......
/* /*
* Copyright (c) 1998, 1999, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -25,7 +25,6 @@ ...@@ -25,7 +25,6 @@
package build.tools.jdwpgen; package build.tools.jdwpgen;
import java.util.*;
import java.io.*; import java.io.*;
class AbstractCommandNode extends AbstractNamedNode { class AbstractCommandNode extends AbstractNamedNode {
...@@ -35,8 +34,8 @@ class AbstractCommandNode extends AbstractNamedNode { ...@@ -35,8 +34,8 @@ class AbstractCommandNode extends AbstractNamedNode {
" Command</a> (" + nameNode.value() + ")</h5>"); " Command</a> (" + nameNode.value() + ")</h5>");
writer.println(comment()); writer.println(comment());
writer.println("<dl>"); writer.println("<dl>");
for (Iterator it = components.iterator(); it.hasNext();) { for (Node node : components) {
((Node)it.next()).document(writer); node.document(writer);
} }
writer.println("</dl>"); writer.println("</dl>");
} }
......
/* /*
* Copyright (c) 1998, 1999, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -25,14 +25,13 @@ ...@@ -25,14 +25,13 @@
package build.tools.jdwpgen; package build.tools.jdwpgen;
import java.util.*;
import java.io.*; import java.io.*;
abstract class AbstractGroupNode extends AbstractTypeListNode { abstract class AbstractGroupNode extends AbstractTypeListNode {
void document(PrintWriter writer) { void document(PrintWriter writer) {
for (Iterator it = components.iterator(); it.hasNext();) { for (Node node : components) {
((Node)it.next()).document(writer); node.document(writer);
} }
} }
......
/* /*
* Copyright (c) 1998, 1999, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -38,10 +38,10 @@ abstract class AbstractNamedNode extends Node { ...@@ -38,10 +38,10 @@ abstract class AbstractNamedNode extends Node {
} }
void prune() { void prune() {
Iterator it = components.iterator(); Iterator<Node> it = components.iterator();
if (it.hasNext()) { if (it.hasNext()) {
Node nameNode = (Node)it.next(); Node nameNode = it.next();
if (nameNode instanceof NameNode) { if (nameNode instanceof NameNode) {
this.nameNode = (NameNode)nameNode; this.nameNode = (NameNode)nameNode;
...@@ -64,8 +64,8 @@ abstract class AbstractNamedNode extends Node { ...@@ -64,8 +64,8 @@ abstract class AbstractNamedNode extends Node {
void document(PrintWriter writer) { void document(PrintWriter writer) {
writer.println("<h4><a name=" + name + ">" + name + writer.println("<h4><a name=" + name + ">" + name +
" Command Set</a></h4>"); " Command Set</a></h4>");
for (Iterator it = components.iterator(); it.hasNext();) { for (Node node : components) {
((Node)it.next()).document(writer); node.document(writer);
} }
} }
...@@ -90,8 +90,8 @@ abstract class AbstractNamedNode extends Node { ...@@ -90,8 +90,8 @@ abstract class AbstractNamedNode extends Node {
writer.print("class " + javaClassName()); writer.print("class " + javaClassName());
writer.println(javaClassImplements() + " {"); writer.println(javaClassImplements() + " {");
genJavaClassSpecifics(writer, depth+1); genJavaClassSpecifics(writer, depth+1);
for (Iterator it = components.iterator(); it.hasNext();) { for (Node node : components) {
((Node)it.next()).genJava(writer, depth+1); node.genJava(writer, depth+1);
} }
indent(writer, depth); indent(writer, depth);
writer.println("}"); writer.println("}");
......
/* /*
* Copyright (c) 1998, 2002, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -40,7 +40,7 @@ abstract class AbstractTypeListNode extends AbstractNamedNode { ...@@ -40,7 +40,7 @@ abstract class AbstractTypeListNode extends AbstractNamedNode {
void document(PrintWriter writer) { void document(PrintWriter writer) {
writer.println("<dt>" + name() + " Data"); writer.println("<dt>" + name() + " Data");
if (components.size() == 0) { if (components.isEmpty()) {
writer.println("<dd>(None)"); writer.println("<dd>(None)");
} else { } else {
writer.println("<dd><table border=1 cellpadding=3 cellspacing=0 width=\"90%\" summary=\"\"><tr>"); writer.println("<dd><table border=1 cellpadding=3 cellspacing=0 width=\"90%\" summary=\"\"><tr>");
...@@ -49,24 +49,24 @@ abstract class AbstractTypeListNode extends AbstractNamedNode { ...@@ -49,24 +49,24 @@ abstract class AbstractTypeListNode extends AbstractNamedNode {
} }
writer.println("<th width=\"15%\"><th width=\"65%\">"); writer.println("<th width=\"15%\"><th width=\"65%\">");
writer.println(""); writer.println("");
for (Iterator it = components.iterator(); it.hasNext();) { for (Node node : components) {
((Node)it.next()).document(writer); node.document(writer);
} }
writer.println("</table>"); writer.println("</table>");
} }
} }
void genJavaClassBodyComponents(PrintWriter writer, int depth) { void genJavaClassBodyComponents(PrintWriter writer, int depth) {
for (Iterator it = components.iterator(); it.hasNext();) { for (Node node : components) {
TypeNode tn = (TypeNode)it.next(); TypeNode tn = (TypeNode)node;
tn.genJavaDeclaration(writer, depth); tn.genJavaDeclaration(writer, depth);
} }
} }
void genJavaReads(PrintWriter writer, int depth) { void genJavaReads(PrintWriter writer, int depth) {
for (Iterator it = components.iterator(); it.hasNext();) { for (Node node : components) {
TypeNode tn = (TypeNode)it.next(); TypeNode tn = (TypeNode)node;
tn.genJavaRead(writer, depth, tn.name()); tn.genJavaRead(writer, depth, tn.name());
} }
} }
...@@ -88,7 +88,7 @@ abstract class AbstractTypeListNode extends AbstractNamedNode { ...@@ -88,7 +88,7 @@ abstract class AbstractTypeListNode extends AbstractNamedNode {
String javaParams() { String javaParams() {
StringBuffer sb = new StringBuffer(); StringBuffer sb = new StringBuffer();
for (Iterator it = components.iterator(); it.hasNext();) { for (Iterator<Node> it = components.iterator(); it.hasNext();) {
TypeNode tn = (TypeNode)it.next(); TypeNode tn = (TypeNode)it.next();
sb.append(tn.javaParam()); sb.append(tn.javaParam());
if (it.hasNext()) { if (it.hasNext()) {
...@@ -99,8 +99,8 @@ abstract class AbstractTypeListNode extends AbstractNamedNode { ...@@ -99,8 +99,8 @@ abstract class AbstractTypeListNode extends AbstractNamedNode {
} }
void genJavaWrites(PrintWriter writer, int depth) { void genJavaWrites(PrintWriter writer, int depth) {
for (Iterator it = components.iterator(); it.hasNext();) { for (Node node : components) {
TypeNode tn = (TypeNode)it.next(); TypeNode tn = (TypeNode)node;
tn.genJavaWrite(writer, depth, tn.name()); tn.genJavaWrite(writer, depth, tn.name());
} }
} }
...@@ -111,8 +111,8 @@ abstract class AbstractTypeListNode extends AbstractNamedNode { ...@@ -111,8 +111,8 @@ abstract class AbstractTypeListNode extends AbstractNamedNode {
writer.println(); writer.println();
indent(writer, depth); indent(writer, depth);
writer.println(className + "(" + javaParams() + ") {"); writer.println(className + "(" + javaParams() + ") {");
for (Iterator it = components.iterator(); it.hasNext();) { for (Node node : components) {
TypeNode tn = (TypeNode)it.next(); TypeNode tn = (TypeNode)node;
indent(writer, depth+1); indent(writer, depth+1);
writer.println("this." + tn.name() + " = " + tn.name() + ";"); writer.println("this." + tn.name() + " = " + tn.name() + ";");
} }
......
/* /*
* Copyright (c) 1998, 1999, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -100,7 +100,7 @@ class AltNode extends AbstractGroupNode implements TypeNode { ...@@ -100,7 +100,7 @@ class AltNode extends AbstractGroupNode implements TypeNode {
indent(writer, depth+1); indent(writer, depth+1);
writer.print("return new " + select.name() + "("); writer.print("return new " + select.name() + "(");
writer.print("ALT_ID, new " + javaClassName() + "("); writer.print("ALT_ID, new " + javaClassName() + "(");
for (Iterator it = components.iterator(); it.hasNext();) { for (Iterator<Node> it = components.iterator(); it.hasNext();) {
TypeNode tn = (TypeNode)it.next(); TypeNode tn = (TypeNode)it.next();
writer.print(tn.name()); writer.print(tn.name());
if (it.hasNext()) { if (it.hasNext()) {
......
/* /*
* Copyright (c) 1998, 1999, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -25,7 +25,6 @@ ...@@ -25,7 +25,6 @@
package build.tools.jdwpgen; package build.tools.jdwpgen;
import java.util.*;
import java.io.*; import java.io.*;
class CommandSetNode extends AbstractNamedNode { class CommandSetNode extends AbstractNamedNode {
...@@ -43,8 +42,8 @@ class CommandSetNode extends AbstractNamedNode { ...@@ -43,8 +42,8 @@ class CommandSetNode extends AbstractNamedNode {
" Command Set</a> (" + " Command Set</a> (" +
nameNode.value() + ")</h4>"); nameNode.value() + ")</h4>");
writer.println(comment()); writer.println(comment());
for (Iterator it = components.iterator(); it.hasNext();) { for (Node node : components) {
((Node)it.next()).document(writer); node.document(writer);
} }
} }
...@@ -53,8 +52,8 @@ class CommandSetNode extends AbstractNamedNode { ...@@ -53,8 +52,8 @@ class CommandSetNode extends AbstractNamedNode {
writer.println(name() + "</a> Command Set (" + writer.println(name() + "</a> Command Set (" +
nameNode.value() + ")"); nameNode.value() + ")");
writer.println("<ul>"); writer.println("<ul>");
for (Iterator it = components.iterator(); it.hasNext();) { for (Node node : components) {
((Node)it.next()).documentIndex(writer); node.documentIndex(writer);
} }
writer.println("</ul>"); writer.println("</ul>");
} }
......
/* /*
* Copyright (c) 1998, 2008, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -33,14 +33,11 @@ class ConstantSetNode extends AbstractNamedNode { ...@@ -33,14 +33,11 @@ class ConstantSetNode extends AbstractNamedNode {
/** /**
* The mapping between a constant and its value. * The mapping between a constant and its value.
*/ */
protected static final Map<String, String> constantMap = new HashMap<String, String>(); protected static final Map<String, String> constantMap = new HashMap<>();
void prune() { void prune() {
List<Node> addons = new ArrayList<Node>(); List<Node> addons = new ArrayList<>();
for (Iterator it = components.iterator(); it.hasNext(); ) {
Node node = (Node)it.next();
}
if (!addons.isEmpty()) { if (!addons.isEmpty()) {
components.addAll(addons); components.addAll(addons);
} }
...@@ -63,8 +60,8 @@ class ConstantSetNode extends AbstractNamedNode { ...@@ -63,8 +60,8 @@ class ConstantSetNode extends AbstractNamedNode {
writer.println("<dd><table border=1 cellpadding=3 cellspacing=0 width=\"90%\" summary=\"\"><tr>"); writer.println("<dd><table border=1 cellpadding=3 cellspacing=0 width=\"90%\" summary=\"\"><tr>");
writer.println("<th width=\"20%\"><th width=\"5%\"><th width=\"65%\">"); writer.println("<th width=\"20%\"><th width=\"5%\"><th width=\"65%\">");
ConstantNode n; ConstantNode n;
for (Iterator it = components.iterator(); it.hasNext();) { for (Node node : components) {
n = ((ConstantNode)it.next()); n = (ConstantNode)node;
writer.println("<a NAME=\"" + name + "_" + n.name + "\"></a>"); writer.println("<a NAME=\"" + name + "_" + n.name + "\"></a>");
n.document(writer); n.document(writer);
} }
......
/* /*
* Copyright (c) 2001, 2002, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -25,7 +25,6 @@ ...@@ -25,7 +25,6 @@
package build.tools.jdwpgen; package build.tools.jdwpgen;
import java.util.*;
import java.io.*; import java.io.*;
class ErrorSetNode extends AbstractSimpleNode { class ErrorSetNode extends AbstractSimpleNode {
...@@ -41,12 +40,12 @@ class ErrorSetNode extends AbstractSimpleNode { ...@@ -41,12 +40,12 @@ class ErrorSetNode extends AbstractSimpleNode {
void document(PrintWriter writer) { void document(PrintWriter writer) {
writer.println("<dt>" + "Error Data"); writer.println("<dt>" + "Error Data");
if (components.size() == 0) { if (components.isEmpty()) {
writer.println("<dd>(None)"); writer.println("<dd>(None)");
} else { } else {
writer.println("<dd><table border=1 cellpadding=3 cellspacing=0 width=\"90%\" summary=\"\">"); writer.println("<dd><table border=1 cellpadding=3 cellspacing=0 width=\"90%\" summary=\"\">");
for (Iterator it = components.iterator(); it.hasNext();) { for (Node node : components) {
((Node)it.next()).document(writer); node.document(writer);
} }
writer.println("</table>"); writer.println("</table>");
} }
......
/* /*
* Copyright (c) 1998, 1999, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -34,7 +34,7 @@ abstract class Node { ...@@ -34,7 +34,7 @@ abstract class Node {
String kind; String kind;
List<Node> components; List<Node> components;
int lineno; int lineno;
List<String> commentList = new ArrayList<String>(); List<String> commentList = new ArrayList<>();
Node parent = null; Node parent = null;
Context context = null; Context context = null;
...@@ -50,8 +50,8 @@ abstract class Node { ...@@ -50,8 +50,8 @@ abstract class Node {
} }
void parentAndExtractComments() { void parentAndExtractComments() {
for (Iterator it = components.iterator(); it.hasNext();) { for (Iterator<Node> it = components.iterator(); it.hasNext();) {
Node node = (Node)it.next(); Node node = it.next();
if (node instanceof CommentNode) { if (node instanceof CommentNode) {
it.remove(); it.remove();
commentList.add(((CommentNode)node).text()); commentList.add(((CommentNode)node).text());
...@@ -63,16 +63,14 @@ abstract class Node { ...@@ -63,16 +63,14 @@ abstract class Node {
} }
void prune() { void prune() {
for (Iterator it = components.iterator(); it.hasNext();) { for (Node node : components) {
Node node = (Node)it.next();
node.prune(); node.prune();
} }
} }
void constrain(Context ctx) { void constrain(Context ctx) {
context = ctx; context = ctx;
for (Iterator it = components.iterator(); it.hasNext();) { for (Node node : components) {
Node node = (Node)it.next();
constrainComponent(ctx, node); constrainComponent(ctx, node);
} }
} }
...@@ -109,9 +107,9 @@ abstract class Node { ...@@ -109,9 +107,9 @@ abstract class Node {
if (commentList.size() > 0) { if (commentList.size() > 0) {
indent(writer, depth); indent(writer, depth);
writer.println("/**"); writer.println("/**");
for (Iterator it = commentList.iterator(); it.hasNext();) { for (String comment : commentList) {
indent(writer, depth); indent(writer, depth);
writer.println(" * " + (String)it.next()); writer.println(" * " + comment);
} }
indent(writer, depth); indent(writer, depth);
writer.println(" */"); writer.println(" */");
...@@ -123,15 +121,13 @@ abstract class Node { ...@@ -123,15 +121,13 @@ abstract class Node {
} }
void genJava(PrintWriter writer, int depth) { void genJava(PrintWriter writer, int depth) {
for (Iterator it = components.iterator(); it.hasNext();) { for (Node node : components) {
Node node = (Node)it.next();
node.genJava(writer, depth); node.genJava(writer, depth);
} }
} }
void genCInclude(PrintWriter writer) { void genCInclude(PrintWriter writer) {
for (Iterator it = components.iterator(); it.hasNext();) { for (Node node : components) {
Node node = (Node)it.next();
node.genCInclude(writer); node.genCInclude(writer);
} }
} }
...@@ -184,8 +180,7 @@ abstract class Node { ...@@ -184,8 +180,7 @@ abstract class Node {
} }
void genJavaPreDef(PrintWriter writer, int depth) { void genJavaPreDef(PrintWriter writer, int depth) {
for (Iterator it = components.iterator(); it.hasNext();) { for (Node node : components) {
Node node = (Node)it.next();
node.genJavaPreDef(writer, depth); node.genJavaPreDef(writer, depth);
} }
} }
......
/* /*
* Copyright (c) 1998, 1999, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -48,8 +48,8 @@ class OutNode extends AbstractTypeListNode { ...@@ -48,8 +48,8 @@ class OutNode extends AbstractTypeListNode {
indent(writer, depth); indent(writer, depth);
writer.print( writer.print(
"static " + cmdName + " process(VirtualMachineImpl vm"); "static " + cmdName + " process(VirtualMachineImpl vm");
for (Iterator it = components.iterator(); it.hasNext();) { for (Node node : components) {
TypeNode tn = (TypeNode)it.next(); TypeNode tn = (TypeNode)node;
writer.println(", "); writer.println(", ");
indent(writer, depth+5); indent(writer, depth+5);
writer.print(tn.javaParam()); writer.print(tn.javaParam());
...@@ -59,8 +59,8 @@ class OutNode extends AbstractTypeListNode { ...@@ -59,8 +59,8 @@ class OutNode extends AbstractTypeListNode {
writer.println("throws JDWPException {"); writer.println("throws JDWPException {");
indent(writer, depth+1); indent(writer, depth+1);
writer.print("PacketStream ps = enqueueCommand(vm"); writer.print("PacketStream ps = enqueueCommand(vm");
for (Iterator it = components.iterator(); it.hasNext();) { for (Node node : components) {
TypeNode tn = (TypeNode)it.next(); TypeNode tn = (TypeNode)node;
writer.print(", "); writer.print(", ");
writer.print(tn.name()); writer.print(tn.name());
} }
...@@ -76,8 +76,8 @@ class OutNode extends AbstractTypeListNode { ...@@ -76,8 +76,8 @@ class OutNode extends AbstractTypeListNode {
indent(writer, depth); indent(writer, depth);
writer.print( writer.print(
"static PacketStream enqueueCommand(VirtualMachineImpl vm"); "static PacketStream enqueueCommand(VirtualMachineImpl vm");
for (Iterator it = components.iterator(); it.hasNext();) { for (Node node : components) {
TypeNode tn = (TypeNode)it.next(); TypeNode tn = (TypeNode)node;
writer.println(", "); writer.println(", ");
indent(writer, depth+5); indent(writer, depth+5);
writer.print(tn.javaParam()); writer.print(tn.javaParam());
......
/* /*
* Copyright (c) 1998, 1999, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -42,11 +42,11 @@ class RootNode extends AbstractNamedNode { ...@@ -42,11 +42,11 @@ class RootNode extends AbstractNamedNode {
void document(PrintWriter writer) { void document(PrintWriter writer) {
writer.println("<html><head><title>" + comment() + "</title></head>"); writer.println("<html><head><title>" + comment() + "</title></head>");
writer.println("<body bgcolor=\"white\">"); writer.println("<body bgcolor=\"white\">");
for (Iterator it = components.iterator(); it.hasNext();) { for (Node node : components) {
((Node)it.next()).documentIndex(writer); node.documentIndex(writer);
} }
for (Iterator it = components.iterator(); it.hasNext();) { for (Node node : components) {
((Node)it.next()).document(writer); node.document(writer);
} }
writer.println("</body></html>"); writer.println("</body></html>");
} }
......
/* /*
* Copyright (c) 1998, 1999, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -34,10 +34,10 @@ class SelectNode extends AbstractGroupNode implements TypeNode { ...@@ -34,10 +34,10 @@ class SelectNode extends AbstractGroupNode implements TypeNode {
void prune() { void prune() {
super.prune(); super.prune();
Iterator it = components.iterator(); Iterator<Node> it = components.iterator();
if (it.hasNext()) { if (it.hasNext()) {
Node typeNode = (Node)it.next(); Node typeNode = it.next();
if (typeNode instanceof ByteTypeNode || if (typeNode instanceof ByteTypeNode ||
typeNode instanceof IntTypeNode) { typeNode instanceof IntTypeNode) {
...@@ -131,8 +131,8 @@ class SelectNode extends AbstractGroupNode implements TypeNode { ...@@ -131,8 +131,8 @@ class SelectNode extends AbstractGroupNode implements TypeNode {
typeNode.genJavaRead(writer, depth, typeNode.name()); typeNode.genJavaRead(writer, depth, typeNode.name());
indent(writer, depth); indent(writer, depth);
writer.println("switch (" + typeNode.name() + ") {"); writer.println("switch (" + typeNode.name() + ") {");
for (Iterator it = components.iterator(); it.hasNext();) { for (Node node : components) {
AltNode alt = (AltNode)it.next(); AltNode alt = (AltNode)node;
alt.genJavaReadsSelectCase(writer, depth+1, commonVar()); alt.genJavaReadsSelectCase(writer, depth+1, commonVar());
} }
indent(writer, depth); indent(writer, depth);
......
/* /*
* Copyright (c) 2003, 2006, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -38,7 +38,7 @@ import java.util.jar.*; ...@@ -38,7 +38,7 @@ import java.util.jar.*;
public class MakeClasslist { public class MakeClasslist {
public static void main(String[] args) throws IOException { public static void main(String[] args) throws IOException {
List/*<String>*/ classes = new ArrayList(); List<String> classes = new ArrayList<>();
String origJavaHome = System.getProperty("java.home"); String origJavaHome = System.getProperty("java.home");
String javaHome = origJavaHome.toLowerCase(); String javaHome = origJavaHome.toLowerCase();
if (javaHome.endsWith("jre")) { if (javaHome.endsWith("jre")) {
...@@ -84,10 +84,9 @@ public class MakeClasslist { ...@@ -84,10 +84,9 @@ public class MakeClasslist {
} }
} }
Set/*<String>*/ seenClasses = new HashSet(); Set<String> seenClasses = new HashSet<>();
for (Iterator iter = classes.iterator(); iter.hasNext(); ) { for (String str : seenClasses) {
String str = (String) iter.next();
if (seenClasses.add(str)) { if (seenClasses.add(str)) {
System.out.println(str); System.out.println(str);
} }
...@@ -109,13 +108,13 @@ public class MakeClasslist { ...@@ -109,13 +108,13 @@ public class MakeClasslist {
// completePackage(seenClasses, rtJar, "java/lang"); // completePackage(seenClasses, rtJar, "java/lang");
} }
private static void completePackage(Set seenClasses, private static void completePackage(Set<String> seenClasses,
JarFile jar, JarFile jar,
String packageName) { String packageName) {
int len = packageName.length(); int len = packageName.length();
Enumeration entries = jar.entries(); Enumeration<JarEntry> entries = jar.entries();
while (entries.hasMoreElements()) { while (entries.hasMoreElements()) {
JarEntry entry = (JarEntry) entries.nextElement(); JarEntry entry = entries.nextElement();
String name = entry.getName(); String name = entry.getName();
if (name.startsWith(packageName) && if (name.startsWith(packageName) &&
name.endsWith(".class") && name.endsWith(".class") &&
......
/* /*
* Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -246,7 +246,7 @@ public class StripProperties { ...@@ -246,7 +246,7 @@ public class StripProperties {
throws IOException { throws IOException {
BufferedWriter awriter; BufferedWriter awriter;
awriter = new BufferedWriter(new OutputStreamWriter(out, "8859_1")); awriter = new BufferedWriter(new OutputStreamWriter(out, "8859_1"));
for (Enumeration e = properties.keys(); e.hasMoreElements();) { for (Enumeration<Object> e = properties.keys(); e.hasMoreElements();) {
String key = (String)e.nextElement(); String key = (String)e.nextElement();
String val = (String)properties.get(key); String val = (String)properties.get(key);
key = saveConvert(key, true); key = saveConvert(key, true);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册