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

Merge

......@@ -218,9 +218,7 @@ ifeq ($(JAVAC_WARNINGS_FATAL), true)
BOOT_JAVACFLAGS += -Werror
endif
BOOT_SOURCE_LANGUAGE_VERSION = 6
BOOT_TARGET_CLASS_VERSION = 6
BOOT_JAVACFLAGS += -encoding ascii -source $(BOOT_SOURCE_LANGUAGE_VERSION) -target $(BOOT_TARGET_CLASS_VERSION)
BOOT_JAVACFLAGS += -encoding ascii
BOOT_JAR_JFLAGS += $(JAR_JFLAGS)
BOOT_JAVACFLAGS += $(NO_PROPRIETARY_API_WARNINGS)
......
......@@ -191,7 +191,7 @@ endif
# Generic
REQUIRED_ANT_VER = 1.7.1
REQUIRED_BOOT_VER = 1.6
REQUIRED_BOOT_VER = 1.7
REQUIRED_FREETYPE_VERSION = 2.3.0
REQUIRED_MAKE_VER = 3.81
REQUIRED_UNZIP_VER = 5.12
......
......@@ -28,6 +28,8 @@
#
BUILDDIR = ..
SUBDIRS_MAKEFLAGS += JAVAC_MAX_WARNINGS=true JAVAC_WARNINGS_FATAL=true
include $(BUILDDIR)/common/Defs.gmk
# 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.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -114,8 +114,8 @@ public class BuildMetaIndex {
*/
out.println(jmi.getJarFileKind().getMarkerChar() + " " + filename);
for (Iterator<String> iter = index.iterator(); iter.hasNext(); ) {
out.println(iter.next());
for (String entry : index) {
out.println(entry);
}
}
......@@ -171,8 +171,7 @@ class JarMetaIndex {
* A hashmap contains a mapping from the prefix string to
* a hashset which contains a set of the second level of prefix string.
*/
private HashMap<String, HashSet<String>> knownPrefixMap = new
HashMap<String, HashSet<String>>();
private HashMap<String, HashSet<String>> knownPrefixMap = new HashMap<>();
/*
* We add maximum 5 second level entries to "sun", "java" and
......@@ -195,12 +194,12 @@ class JarMetaIndex {
if (indexSet == null) {
synchronized(this) {
if (indexSet == null) {
indexSet = new HashSet<String>();
Enumeration entries = jar.entries();
indexSet = new HashSet<>();
Enumeration<JarEntry> entries = jar.entries();
boolean containsOnlyClass = true;
boolean containsOnlyResource = true;
while (entries.hasMoreElements()) {
JarEntry entry = (JarEntry) entries.nextElement();
JarEntry entry = entries.nextElement();
String name = entry.getName();
/* We only look at the non-directory entry.
MANIFEST file is also skipped. */
......@@ -338,9 +337,7 @@ class JarMetaIndex {
/* Iterate through the hash map, add the second level package names
* to the indexSet if has any.
*/
for (Iterator<String> keysIterator = knownPrefixMap.keySet().iterator();
keysIterator.hasNext();) {
String key = keysIterator.next();
for (String key : knownPrefixMap.keySet()) {
HashSet<String> pkgSetStartsWithKey = knownPrefixMap.get(key);
int setSize = pkgSetStartsWithKey.size();
......@@ -353,9 +350,8 @@ class JarMetaIndex {
/* If the set contains less than MAX_PKGS_WITH_KNOWN_PREFIX, add
* them to the indexSet of the MetaIndex object.
*/
for (Iterator<String> secondPkgElements = pkgSetStartsWithKey.iterator();
secondPkgElements.hasNext();) {
indexSet.add(key + "/" + secondPkgElements.next());
for (String secondPkgElement : pkgSetStartsWithKey) {
indexSet.add(key + "/" + secondPkgElement);
}
}
} // 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.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -36,7 +36,6 @@ import java.io.Writer;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Properties;
......@@ -223,18 +222,16 @@ public class CompileProperties {
if ( ok ) {
String packageName = inferPackageName(propertiesPath, outputPath);
System.out.println("inferred package name: " + packageName);
List<String> sortedKeys = new ArrayList<String>();
List<String> sortedKeys = new ArrayList<>();
for ( Object key : p.keySet() ) {
sortedKeys.add((String)key);
}
Collections.sort(sortedKeys);
Iterator keys = sortedKeys.iterator();
StringBuffer data = new StringBuffer();
while (keys.hasNext()) {
Object key = keys.next();
data.append(" { \"" + escape((String)key) + "\", \"" +
for (String key : sortedKeys) {
data.append(" { \"" + escape(key) + "\", \"" +
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.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -164,7 +164,7 @@ public class DirDiff implements Runnable {
}
File[] currentGoldenDirs = null;
TreeSet goldDirSet = new TreeSet();
TreeSet<String> goldDirSet = new TreeSet<>();
if (goldenDir != null) {
currentGoldenDirs = goldenDir.listFiles();
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.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -63,9 +63,9 @@ class DTDBuilder extends DTD {
static PublicMapping mapping = null;
// Hash from name to Integer
private Hashtable namesHash = new Hashtable();
private Hashtable<String, Integer> namesHash = new Hashtable<>();
// Vector of all names
private Vector namesVector = new Vector();
private Vector<String> namesVector = new Vector<>();
/**
* Create a new DTD.
......@@ -87,15 +87,15 @@ class DTDBuilder extends DTD {
int numNames = namesVector.size();
out.writeShort((short) (namesVector.size()));
for (int i = 0; i < namesVector.size(); i++) {
String nm = (String) namesVector.elementAt(i);
String nm = namesVector.elementAt(i);
out.writeUTF(nm);
}
saveEntities(out);
out.writeShort((short) (elements.size()));
for (Enumeration e = elements.elements() ; e.hasMoreElements() ; ) {
saveElement(out, (Element)e.nextElement());
for (Enumeration<Element> e = elements.elements() ; e.hasMoreElements() ; ) {
saveElement(out, e.nextElement());
}
if (namesVector.size() != numNames) {
......@@ -106,21 +106,21 @@ class DTDBuilder extends DTD {
}
private void buildNamesTable() {
for (Enumeration e = entityHash.elements() ; e.hasMoreElements() ; ) {
Entity ent = (Entity) e.nextElement();
for (Enumeration<Entity> e = entityHash.elements() ; e.hasMoreElements() ; ) {
Entity ent = e.nextElement();
// Do even if not isGeneral(). That way, exclusions and inclusions
// will definitely have their element.
getNameId(ent.getName());
}
for (Enumeration e = elements.elements() ; e.hasMoreElements() ; ) {
Element el = (Element) e.nextElement();
for (Enumeration<Element> e = elements.elements() ; e.hasMoreElements() ; ) {
Element el = e.nextElement();
getNameId(el.getName());
for (AttributeList atts = el.getAttributes() ; atts != null ; atts = atts.getNext()) {
getNameId(atts.getName());
if (atts.getValue() != null) {
getNameId(atts.getValue());
}
Enumeration vals = atts.getValues();
Enumeration<?> vals = atts.getValues();
while (vals != null && vals.hasMoreElements()) {
String s = (String) vals.nextElement();
getNameId(s);
......@@ -133,9 +133,9 @@ class DTDBuilder extends DTD {
// The the id of a name from the list of names
//
private short getNameId(String name) {
Object o = namesHash.get(name);
Integer o = namesHash.get(name);
if (o != null) {
return (short) ((Integer) o).intValue();
return (short) o.intValue();
}
int i = namesVector.size();
namesVector.addElement(name);
......@@ -149,16 +149,16 @@ class DTDBuilder extends DTD {
*/
void saveEntities(DataOutputStream out) throws IOException {
int num = 0;
for (Enumeration e = entityHash.elements() ; e.hasMoreElements() ; ) {
Entity ent = (Entity) e.nextElement();
for (Enumeration<Entity> e = entityHash.elements() ; e.hasMoreElements() ; ) {
Entity ent = e.nextElement();
if (ent.isGeneral()) {
num++;
}
}
out.writeShort((short) num);
for (Enumeration e = entityHash.elements() ; e.hasMoreElements() ; ) {
Entity ent = (Entity) e.nextElement();
for (Enumeration<Entity> e = entityHash.elements() ; e.hasMoreElements() ; ) {
Entity ent = e.nextElement();
if (ent.isGeneral()) {
out.writeShort(getNameId(ent.getName()));
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.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -48,7 +48,7 @@ import java.net.URL;
public final
class DTDInputStream extends FilterReader implements DTDConstants {
public DTD dtd;
public Stack stack = new Stack();
public Stack<Object> stack = new Stack<>();
public char str[] = new char[64];
public int replace = 0;
public int ln = 1;
......@@ -105,6 +105,7 @@ class DTDInputStream extends FilterReader implements DTDConstants {
* parameter entities.
* [60] 350:22
*/
@SuppressWarnings("fallthrough")
public int read() throws IOException {
switch (ch) {
case '%': {
......@@ -134,6 +135,7 @@ class DTDInputStream extends FilterReader implements DTDConstants {
switch (ch) {
case '\r':
ln++;
/* fall through */
case ';':
ch = in.read();
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.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -87,7 +87,7 @@ class DTDParser implements DTDConstants {
return null;
}
return MessageFormat.format(prop, args);
return MessageFormat.format(prop, (Object[])args);
}
/**
......@@ -201,6 +201,7 @@ class DTDParser implements DTDConstants {
* Parse identifier. Uppercase characters are automatically
* folded to lowercase. Returns falsed if no identifier is found.
*/
@SuppressWarnings("fallthrough")
boolean parseIdentifier(boolean lower) throws IOException {
switch (ch) {
case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':
......@@ -211,6 +212,7 @@ class DTDParser implements DTDConstants {
if (lower) {
ch = 'a' + (ch - 'A');
}
/* fall through */
case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
case 'g': case 'h': case 'i': case 'j': case 'k': case 'l':
......@@ -233,6 +235,7 @@ class DTDParser implements DTDConstants {
* Parses name token. If <code>lower</code> is true, upper case letters
* are folded to lower case. Returns falsed if no token is found.
*/
@SuppressWarnings("fallthrough")
boolean parseNameToken(boolean lower) throws IOException {
boolean first = true;
......@@ -246,6 +249,7 @@ class DTDParser implements DTDConstants {
if (lower) {
ch = 'a' + (ch - 'A');
}
/* fall through */
case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
case 'g': case 'h': case 'i': case 'j': case 'k': case 'l':
......@@ -271,8 +275,8 @@ class DTDParser implements DTDConstants {
/**
* Parse a list of identifiers.
*/
Vector parseIdentifierList(boolean lower) throws IOException {
Vector elems = new Vector();
Vector<String> parseIdentifierList(boolean lower) throws IOException {
Vector<String> elems = new Vector<>();
skipSpace();
switch (ch) {
case '(':
......@@ -507,7 +511,7 @@ class DTDParser implements DTDConstants {
* [116] 405:6
*/
void parseElementDeclaration() throws IOException {
Vector elems = parseIdentifierList(true);
Vector<String> elems = parseIdentifierList(true);
BitSet inclusions = null;
BitSet exclusions = null;
boolean omitStart = false;
......@@ -544,26 +548,26 @@ class DTDParser implements DTDConstants {
if ((type == MODEL) || (type == ANY)) {
if (ch == '-') {
ch = in.read();
Vector v = parseIdentifierList(true);
Vector<String> v = parseIdentifierList(true);
exclusions = new BitSet();
for (Enumeration e = v.elements() ; e.hasMoreElements() ;) {
exclusions.set(dtd.getElement((String)e.nextElement()).getIndex());
for (Enumeration<String> e = v.elements() ; e.hasMoreElements() ;) {
exclusions.set(dtd.getElement(e.nextElement()).getIndex());
}
}
if (ch == '+') {
ch = in.read();
Vector v = parseIdentifierList(true);
Vector<String> v = parseIdentifierList(true);
inclusions = new BitSet();
for (Enumeration e = v.elements() ; e.hasMoreElements() ;) {
inclusions.set(dtd.getElement((String)e.nextElement()).getIndex());
for (Enumeration<String> e = v.elements() ; e.hasMoreElements() ;) {
inclusions.set(dtd.getElement(e.nextElement()).getIndex());
}
}
}
expect('>');
if (in.replace == 0) {
for (Enumeration e = elems.elements() ; e.hasMoreElements() ;) {
dtd.defineElement((String)e.nextElement(), type, omitStart, omitEnd, content, exclusions, inclusions, null);
for (Enumeration<String> e = elems.elements() ; e.hasMoreElements() ;) {
dtd.defineElement(e.nextElement(), type, omitStart, omitEnd, content, exclusions, inclusions, null);
}
}
}
......@@ -582,7 +586,7 @@ class DTDParser implements DTDConstants {
error("invalid", "attribute value");
return;
}
atts.type = atts.name2type(getString(0));
atts.type = AttributeList.name2type(getString(0));
skipParameterSpace();
if (atts.type == NOTATION) {
atts.values = parseIdentifierList(true);
......@@ -593,6 +597,7 @@ class DTDParser implements DTDConstants {
* Parse an attribute value specification.
* [33] 331:1
*/
@SuppressWarnings("fallthrough")
String parseAttributeValueSpecification() throws IOException {
int delim = -1;
switch (ch) {
......@@ -627,6 +632,7 @@ class DTDParser implements DTDConstants {
ch = in.read();
return getString(0);
}
/* fall through */
default:
addString(ch & 0xFF);
......@@ -648,7 +654,7 @@ class DTDParser implements DTDConstants {
return;
}
skipParameterSpace();
atts.modifier = atts.name2type(getString(0));
atts.modifier = AttributeList.name2type(getString(0));
if (atts.modifier != FIXED) {
return;
}
......@@ -663,7 +669,7 @@ class DTDParser implements DTDConstants {
* REMIND: associated notation name
*/
void parseAttlistDeclaration() throws IOException {
Vector elems = parseIdentifierList(true);
Vector<String> elems = parseIdentifierList(true);
AttributeList attlist = null, atts = null;
while (parseIdentifier(true)) {
......@@ -685,8 +691,8 @@ class DTDParser implements DTDConstants {
expect('>');
if (in.replace == 0) {
for (Enumeration e = elems.elements() ; e.hasMoreElements() ;) {
dtd.defineAttributes((String)e.nextElement(), attlist);
for (Enumeration<String> e = elems.elements() ; e.hasMoreElements() ;) {
dtd.defineAttributes(e.nextElement(), attlist);
}
}
}
......@@ -810,6 +816,7 @@ class DTDParser implements DTDConstants {
/**
* Parse a section of the input upto EOF or ']'.
*/
@SuppressWarnings("fallthrough")
void parseSection() throws IOException {
while (true) {
switch (ch) {
......@@ -883,6 +890,7 @@ class DTDParser implements DTDConstants {
default:
char str[] = {(char)ch};
error("invalid.arg", "character", "'" + new String(str) + "' / " + ch);
/* fall through */
case ' ':
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.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -44,7 +44,7 @@ import java.util.Hashtable;
final class PublicMapping {
String baseStr;
Hashtable tab = new Hashtable();
Hashtable<String, String> tab = new Hashtable<>();
/**
* Create a mapping.
......@@ -103,6 +103,6 @@ final class PublicMapping {
*/
public String get(String 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.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -66,7 +66,7 @@ class CharSet {
* A cache which is used to speed up parseString() whenever it is
* 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
......@@ -79,7 +79,7 @@ class CharSet {
// if "s" is in the expression cache, pull the result out
// of the expresison cache
if (expressionCache != null) {
result = (CharSet)expressionCache.get(s);
result = expressionCache.get(s);
}
// otherwise, use doParseString() to actually parse the string,
......@@ -87,7 +87,7 @@ class CharSet {
if (result == null) {
result = doParseString(s);
if (expressionCache == null) {
expressionCache = new Hashtable();
expressionCache = new Hashtable<>();
}
expressionCache.put(s, result);
}
......@@ -336,8 +336,8 @@ class CharSet {
* Returns a copy of CharSet's expression cache and sets CharSet's
* expression cache to empty.
*/
public static Hashtable releaseExpressionCache() {
Hashtable result = expressionCache;
public static Hashtable<String, CharSet> releaseExpressionCache() {
Hashtable<String, CharSet> result = expressionCache;
expressionCache = null;
return result;
}
......@@ -778,7 +778,7 @@ class CharSet {
* An Enumeration that can be used to extract the character ranges
* 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
*/
......@@ -798,7 +798,7 @@ class CharSet {
/**
* Returns the next range in the CarSet
*/
public Object nextElement() {
public int[] nextElement() {
int[] result = new int[2];
result[0] = 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.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -78,12 +78,12 @@ class DictionaryBasedBreakIteratorBuilder extends RuleBasedBreakIteratorBuilder
* contains "true" for every character category that includes a dictionary
* character.
*/
protected void buildCharCategories(Vector tempRuleList) {
protected void buildCharCategories(Vector<String> tempRuleList) {
super.buildCharCategories(tempRuleList);
categoryFlags = new boolean[categories.size()];
for (int i = 0; i < categories.size(); i++) {
CharSet cs = (CharSet)categories.elementAt(i);
CharSet cs = categories.elementAt(i);
if (!(cs.intersection(dictionaryChars).empty())) {
categoryFlags[i] = true;
}
......@@ -95,7 +95,7 @@ class DictionaryBasedBreakIteratorBuilder extends RuleBasedBreakIteratorBuilder
// the function above. This gives us a way to create a separate character
// category for the dictionary characters even when
// RuleBasedBreakIteratorBuilder isn't making a distinction.
protected void mungeExpressionList(Hashtable expressions) {
protected void mungeExpressionList(Hashtable<String, Object> expressions) {
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.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -91,9 +91,9 @@ public class GenerateBreakIteratorData {
try {
info = (ResourceBundle)Class.forName("sun.text.resources.BreakIteratorInfo" + localeName).newInstance();
Enumeration keys = info.getKeys();
Enumeration<String> keys = info.getKeys();
while (keys.hasMoreElements()) {
String key = (String)keys.nextElement();
String key = keys.nextElement();
if (key.equals("CharacterData")) {
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.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -128,7 +128,7 @@ final class SupplementaryCharacterData {
int new_index = 0;
int loop_count = dataCount - 1;
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;
/*
......@@ -142,7 +142,7 @@ final class SupplementaryCharacterData {
newTempTable[new_index++] = composeEntry(start, (int)data);
for (int i = 0; i < loop_count; i++) {
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
......
/*
* 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.
*
* 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) {
else if (bits == 32 || bits < 8)
result.append(hex8((int)val));
else {
result.append(hex16((long)val));
result.append(hex16(val));
if (!Csyntax)
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.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -39,7 +39,7 @@ import java.lang.*;
* <p>
* @author John O'Conner
*/
public class SpecialCaseMap implements Comparable {
public class SpecialCaseMap implements Comparable<SpecialCaseMap> {
SpecialCaseMap() {
chSource = 0xFFFF;
......@@ -55,7 +55,7 @@ public class SpecialCaseMap implements Comparable {
*/
public static SpecialCaseMap[] readSpecFile(File file, int plane) throws FileNotFoundException {
ArrayList caseMaps = new ArrayList(150);
ArrayList<SpecialCaseMap> caseMaps = new ArrayList<>(150);
int count = 0;
BufferedReader f = new BufferedReader(new FileReader(file));
String line = null;
......@@ -69,7 +69,7 @@ public class SpecialCaseMap implements Comparable {
SpecialCaseMap item = parse(line.trim());
if (item != null) {
if(item.getCharSource() >> 16 < plane) continue;
if((int)(item.getCharSource() >> 16) > plane) break;
if(item.getCharSource() >> 16 > plane) break;
caseMaps.add(item);
++count;
}
......@@ -215,7 +215,6 @@ public class SpecialCaseMap implements Comparable {
static String hex6(int n) {
String str = Integer.toHexString(n & 0xFFFFFF).toUpperCase();
return "000000".substring(Math.min(6, str.length())) + str;
}
static String hex6(char[] map){
......@@ -302,20 +301,26 @@ public class SpecialCaseMap implements Comparable {
static String CONTEXT_MODERN = "MODERN";
static String CONTEXT_NONMODERN = "NON_MODERN";
public int compareTo(Object otherObject) {
SpecialCaseMap other = (SpecialCaseMap)otherObject;
if (chSource < other.chSource) {
public int compareTo(SpecialCaseMap otherObject) {
if (chSource < otherObject.chSource) {
return -1;
}
else if (chSource > other.chSource) {
else if (chSource > otherObject.chSource) {
return 1;
}
else return 0;
}
public boolean equals(Object o1) {
if (this == o1) {
return true;
}
if (o1 == null || !(o1 instanceof SpecialCaseMap)) {
return false;
}
SpecialCaseMap other = (SpecialCaseMap)o1;
boolean bEqual = false;
if (0 == compareTo(o1)) {
if (0 == compareTo(other)) {
bEqual = true;
}
return bEqual;
......@@ -332,7 +337,7 @@ public class SpecialCaseMap implements Comparable {
}
public int hashCode() {
return (int)chSource;
return chSource;
}
public static void main(String[] args) {
......
/*
* 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.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -391,7 +391,7 @@ public class UnicodeSpec {
*/
public static UnicodeSpec[] readSpecFile(File file, int plane) throws FileNotFoundException {
ArrayList list = new ArrayList(3000);
ArrayList<UnicodeSpec> list = new ArrayList<>(3000);
UnicodeSpec[] result = null;
int count = 0;
BufferedReader f = new BufferedReader(new FileReader(file));
......@@ -406,7 +406,7 @@ public class UnicodeSpec {
}
if (line == null) break loop;
UnicodeSpec item = parse(line.trim());
int specPlane = (int)(item.getCodePoint() >>> 16);
int specPlane = item.getCodePoint() >>> 16;
if (specPlane < plane) continue;
if (specPlane > plane) break;
......
/*
* 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.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -250,10 +250,10 @@ public class GenerateCurrencyData {
return Integer.parseInt(numericCode);
}
static HashMap specialCaseMap = new HashMap();
static HashMap<String, Integer> specialCaseMap = new HashMap<>();
private static int makeSpecialCaseEntry(String currencyInfo) throws Exception {
Integer oldEntry = (Integer) specialCaseMap.get(currencyInfo);
Integer oldEntry = specialCaseMap.get(currencyInfo);
if (oldEntry != null) {
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.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -51,8 +51,8 @@ public class Hasher {
boolean verbose = false;
List keys = new ArrayList(); // Key strings
List values = new ArrayList(); // Value expressions
List<String> keys = new ArrayList<>(); // Key strings
List<String> values = new ArrayList<>(); // Value expressions
String pkg = null; // Package prefix for generated class
String cln = null; // Name of generated class
String vtype = "String"; // Value type
......@@ -76,9 +76,9 @@ public class Hasher {
}
Hasher(String[] args) {
List as = Arrays.asList(args);
for (Iterator i = as.iterator(); i.hasNext();) {
String a = (String)i.next();
List<String> as = Arrays.asList(args);
for (Iterator<String> i = as.iterator(); i.hasNext();) {
String a = i.next();
if (a.equals("-e")) {
empty = true;
} else if (a.equals("-i")) {
......@@ -88,15 +88,15 @@ public class Hasher {
} else if (a.equals("-md")) {
if (!i.hasNext())
usage();
maxDepth = Integer.parseInt((String)i.next());
maxDepth = Integer.parseInt(i.next());
} else if (a.equals("-mb")) {
if (!i.hasNext())
usage();
maxBits = Integer.parseInt((String)i.next());
maxBits = Integer.parseInt(i.next());
} else if (a.equals("-t")) {
if (!i.hasNext())
usage();
vtype = (String)i.next();
vtype = i.next();
} else if (a.startsWith("-")) {
usage();
} else {
......@@ -153,8 +153,8 @@ public class Hasher {
int nw = keys.size();
for (int i = 0; i < nw; i++) {
String w = (String)keys.get(i);
String v = (String)values.get(i);
String w = keys.get(i);
String v = values.get(i);
int h = hash(w);
if (ht[h] == null)
ht[h] = new Object[] { w, v };
......@@ -217,7 +217,7 @@ public class Hasher {
if (verbose)
err.println();
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);
if (verbose)
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.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -43,7 +43,8 @@ public class JarSplit {
/* classlist[0] contains 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. */
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.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -30,14 +30,9 @@ import java.io.File;
import java.io.FileOutputStream;
import java.io.DataOutputStream;
import java.io.RandomAccessFile;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.TreeMap;
import java.util.TreeSet;
import sun.util.calendar.ZoneInfoFile;
/**
......@@ -105,14 +100,13 @@ class Gen extends BackEnd {
/* if DST offset is 0, this means DST isn't used.
* (NOT: offset's index is 0.)
*/
if ((dstoffset =
((Integer)dstOffsets.get(i)).intValue()) == -1) {
if ((dstoffset = dstOffsets.get(i).intValue()) == -1) {
dstoffset = 0;
}
dos.writeLong((((Long)transitions.get(i)).longValue() << 12)
dos.writeLong((transitions.get(i).longValue() << 12)
| (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.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -31,12 +31,8 @@ import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;
......@@ -189,7 +185,7 @@ class GenDoc extends BackEnd {
out.write(header1 + new Date() + header3 + zonename + header4);
out.write(body1 + "<FONT size=\"+2\"><B>" + zonename + "</B></FONT>");
LatitudeAndLongitude location = (LatitudeAndLongitude)mapList.get(zonename);
LatitudeAndLongitude location = mapList.get(zonename);
if (location != null) {
int deg, min, sec;
......@@ -608,12 +604,12 @@ class GenDoc extends BackEnd {
"<BR>\n\n" + "<TABLE BORDER=\"0\" WIDTH=\"100%\">\n" +
"<TR>\n<TD NOWRAP>\n");
Set aliasSet = a.keySet();
Set<String> aliasSet = a.keySet();
len = aliasSet.size();
Object aliasNames[] = aliasSet.toArray();
String aliasNames[] = aliasSet.toArray(new String[0]);
for (int i = 0; i < len; i++) {
displayNameList.put(transform((String)aliasNames[i]),
(String)aliasNames[i]);
displayNameList.put(transform(aliasNames[i]),
aliasNames[i]);
}
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.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -26,7 +26,6 @@
package build.tools.javazic;
import java.util.ArrayList;
import java.util.Iterator;
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.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -26,9 +26,6 @@
package build.tools.javazic;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
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.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -29,10 +29,7 @@ import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;
......@@ -51,22 +48,19 @@ class Simple extends BackEnd {
/**
* Zone records which are applied for given year.
*/
private static Map<String,ZoneRec> lastZoneRecs
= new HashMap<String,ZoneRec>();
private static Map<String,ZoneRec> lastZoneRecs = new HashMap<>();
/**
* Rule records which are applied for given year.
*/
private static Map<String,List<RuleRec>> lastRules
= new TreeMap<String,List<RuleRec>>();
private static Map<String,List<RuleRec>> lastRules = new TreeMap<>();
/**
* zone IDs sorted by their GMT offsets. If zone's GMT
* offset will change in the future, its last known offset is
* used.
*/
private SortedMap<Integer, Set<String>> zonesByOffset
= new TreeMap<Integer, Set<String>>();
private SortedMap<Integer, Set<String>> zonesByOffset = new TreeMap<>();
/**
* Sets last Rule records and Zone records for given timezone to
......@@ -86,7 +80,7 @@ class Simple extends BackEnd {
int lastKnownOffset = tz.getRawOffset();
Set<String> set = zonesByOffset.get(lastKnownOffset);
if (set == null) {
set = new TreeSet<String>();
set = new TreeSet<>();
zonesByOffset.put(lastKnownOffset, set);
}
set.add(zonename);
......@@ -101,16 +95,11 @@ class Simple extends BackEnd {
*/
int generateSrc(Mappings map) {
try {
String outputDir = Main.getOutputDir();
File outD = new File(outputDir);
if (!outputDir.endsWith(File.separator)) {
outputDir += outD.separator;
}
File outD = new File(Main.getOutputDir());
outD.mkdirs();
FileWriter fw =
new FileWriter(outputDir + "TimeZoneData.java", false);
new FileWriter(new File(outD, "TimeZoneData.java"), false);
BufferedWriter out = new BufferedWriter(fw);
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.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -268,16 +268,16 @@ class Time {
if (index < time.length()) {
char c = time.charAt(index++);
if (c == 's') {
tm.setType(tm.STD);
tm.setType(Time.STD);
} else if (c == 'u' || c == 'g' || c == 'z') {
tm.setType(tm.UTC);
tm.setType(Time.UTC);
} else if (c == 'w') {
tm.setType(tm.WALL);
tm.setType(Time.WALL);
} else {
Main.panic("unknown time mode: "+c);
}
} else {
tm.setType(tm.WALL);
tm.setType(Time.WALL);
}
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.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -29,9 +29,7 @@ import java.io.BufferedReader;
import java.io.FileReader;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.StringTokenizer;
......@@ -407,9 +405,9 @@ class Zoneinfo {
if (!zrec.hasUntil()) {
if (tz.getNTransitions() > 0) {
if (stdOffset == 0) {
tz.setDSTType(tz.X_DST);
tz.setDSTType(Timezone.X_DST);
} else {
tz.setDSTType(tz.LAST_DST);
tz.setDSTType(Timezone.LAST_DST);
}
long time = Time.getLocalTime(maxYear,
Month.JANUARY, 1, 0);
......@@ -419,7 +417,7 @@ class Zoneinfo {
tz.getDstOffsetIndex(stdOffset));
tz.addUsedRec(zrec);
} else {
tz.setDSTType(tz.NO_DST);
tz.setDSTType(Timezone.NO_DST);
}
break;
}
......@@ -527,7 +525,7 @@ class Zoneinfo {
if (year == endYear && !zrec.hasUntil()) {
if (tz.getNTransitions() > 0) {
// Assume that this Zone stopped DST
tz.setDSTType(tz.X_DST);
tz.setDSTType(Timezone.X_DST);
long time = Time.getLocalTime(maxYear, Month.JANUARY,
1, 0);
time -= zrec.getGmtOffset();
......@@ -536,7 +534,7 @@ class Zoneinfo {
tz.getDstOffsetIndex(0));
usedZone = true;
} else {
tz.setDSTType(tz.NO_DST);
tz.setDSTType(Timezone.NO_DST);
}
}
}
......@@ -552,8 +550,8 @@ class Zoneinfo {
}
}
if (tz.getDSTType() == tz.UNDEF_DST) {
tz.setDSTType(tz.DST);
if (tz.getDSTType() == Timezone.UNDEF_DST) {
tz.setDSTType(Timezone.DST);
}
tz.optimize();
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.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -25,7 +25,6 @@
package build.tools.jdwpgen;
import java.util.*;
import java.io.*;
class AbstractCommandNode extends AbstractNamedNode {
......@@ -35,8 +34,8 @@ class AbstractCommandNode extends AbstractNamedNode {
" Command</a> (" + nameNode.value() + ")</h5>");
writer.println(comment());
writer.println("<dl>");
for (Iterator it = components.iterator(); it.hasNext();) {
((Node)it.next()).document(writer);
for (Node node : components) {
node.document(writer);
}
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.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -25,14 +25,13 @@
package build.tools.jdwpgen;
import java.util.*;
import java.io.*;
abstract class AbstractGroupNode extends AbstractTypeListNode {
void document(PrintWriter writer) {
for (Iterator it = components.iterator(); it.hasNext();) {
((Node)it.next()).document(writer);
for (Node node : components) {
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.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -38,10 +38,10 @@ abstract class AbstractNamedNode extends Node {
}
void prune() {
Iterator it = components.iterator();
Iterator<Node> it = components.iterator();
if (it.hasNext()) {
Node nameNode = (Node)it.next();
Node nameNode = it.next();
if (nameNode instanceof NameNode) {
this.nameNode = (NameNode)nameNode;
......@@ -64,8 +64,8 @@ abstract class AbstractNamedNode extends Node {
void document(PrintWriter writer) {
writer.println("<h4><a name=" + name + ">" + name +
" Command Set</a></h4>");
for (Iterator it = components.iterator(); it.hasNext();) {
((Node)it.next()).document(writer);
for (Node node : components) {
node.document(writer);
}
}
......@@ -90,8 +90,8 @@ abstract class AbstractNamedNode extends Node {
writer.print("class " + javaClassName());
writer.println(javaClassImplements() + " {");
genJavaClassSpecifics(writer, depth+1);
for (Iterator it = components.iterator(); it.hasNext();) {
((Node)it.next()).genJava(writer, depth+1);
for (Node node : components) {
node.genJava(writer, depth+1);
}
indent(writer, depth);
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.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -40,7 +40,7 @@ abstract class AbstractTypeListNode extends AbstractNamedNode {
void document(PrintWriter writer) {
writer.println("<dt>" + name() + " Data");
if (components.size() == 0) {
if (components.isEmpty()) {
writer.println("<dd>(None)");
} else {
writer.println("<dd><table border=1 cellpadding=3 cellspacing=0 width=\"90%\" summary=\"\"><tr>");
......@@ -49,24 +49,24 @@ abstract class AbstractTypeListNode extends AbstractNamedNode {
}
writer.println("<th width=\"15%\"><th width=\"65%\">");
writer.println("");
for (Iterator it = components.iterator(); it.hasNext();) {
((Node)it.next()).document(writer);
for (Node node : components) {
node.document(writer);
}
writer.println("</table>");
}
}
void genJavaClassBodyComponents(PrintWriter writer, int depth) {
for (Iterator it = components.iterator(); it.hasNext();) {
TypeNode tn = (TypeNode)it.next();
for (Node node : components) {
TypeNode tn = (TypeNode)node;
tn.genJavaDeclaration(writer, depth);
}
}
void genJavaReads(PrintWriter writer, int depth) {
for (Iterator it = components.iterator(); it.hasNext();) {
TypeNode tn = (TypeNode)it.next();
for (Node node : components) {
TypeNode tn = (TypeNode)node;
tn.genJavaRead(writer, depth, tn.name());
}
}
......@@ -88,7 +88,7 @@ abstract class AbstractTypeListNode extends AbstractNamedNode {
String javaParams() {
StringBuffer sb = new StringBuffer();
for (Iterator it = components.iterator(); it.hasNext();) {
for (Iterator<Node> it = components.iterator(); it.hasNext();) {
TypeNode tn = (TypeNode)it.next();
sb.append(tn.javaParam());
if (it.hasNext()) {
......@@ -99,8 +99,8 @@ abstract class AbstractTypeListNode extends AbstractNamedNode {
}
void genJavaWrites(PrintWriter writer, int depth) {
for (Iterator it = components.iterator(); it.hasNext();) {
TypeNode tn = (TypeNode)it.next();
for (Node node : components) {
TypeNode tn = (TypeNode)node;
tn.genJavaWrite(writer, depth, tn.name());
}
}
......@@ -111,8 +111,8 @@ abstract class AbstractTypeListNode extends AbstractNamedNode {
writer.println();
indent(writer, depth);
writer.println(className + "(" + javaParams() + ") {");
for (Iterator it = components.iterator(); it.hasNext();) {
TypeNode tn = (TypeNode)it.next();
for (Node node : components) {
TypeNode tn = (TypeNode)node;
indent(writer, depth+1);
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.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -100,7 +100,7 @@ class AltNode extends AbstractGroupNode implements TypeNode {
indent(writer, depth+1);
writer.print("return new " + select.name() + "(");
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();
writer.print(tn.name());
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.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -25,7 +25,6 @@
package build.tools.jdwpgen;
import java.util.*;
import java.io.*;
class CommandSetNode extends AbstractNamedNode {
......@@ -43,8 +42,8 @@ class CommandSetNode extends AbstractNamedNode {
" Command Set</a> (" +
nameNode.value() + ")</h4>");
writer.println(comment());
for (Iterator it = components.iterator(); it.hasNext();) {
((Node)it.next()).document(writer);
for (Node node : components) {
node.document(writer);
}
}
......@@ -53,8 +52,8 @@ class CommandSetNode extends AbstractNamedNode {
writer.println(name() + "</a> Command Set (" +
nameNode.value() + ")");
writer.println("<ul>");
for (Iterator it = components.iterator(); it.hasNext();) {
((Node)it.next()).documentIndex(writer);
for (Node node : components) {
node.documentIndex(writer);
}
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.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -33,14 +33,11 @@ class ConstantSetNode extends AbstractNamedNode {
/**
* 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() {
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()) {
components.addAll(addons);
}
......@@ -63,8 +60,8 @@ class ConstantSetNode extends AbstractNamedNode {
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%\">");
ConstantNode n;
for (Iterator it = components.iterator(); it.hasNext();) {
n = ((ConstantNode)it.next());
for (Node node : components) {
n = (ConstantNode)node;
writer.println("<a NAME=\"" + name + "_" + n.name + "\"></a>");
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.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -25,7 +25,6 @@
package build.tools.jdwpgen;
import java.util.*;
import java.io.*;
class ErrorSetNode extends AbstractSimpleNode {
......@@ -41,12 +40,12 @@ class ErrorSetNode extends AbstractSimpleNode {
void document(PrintWriter writer) {
writer.println("<dt>" + "Error Data");
if (components.size() == 0) {
if (components.isEmpty()) {
writer.println("<dd>(None)");
} else {
writer.println("<dd><table border=1 cellpadding=3 cellspacing=0 width=\"90%\" summary=\"\">");
for (Iterator it = components.iterator(); it.hasNext();) {
((Node)it.next()).document(writer);
for (Node node : components) {
node.document(writer);
}
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.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -34,7 +34,7 @@ abstract class Node {
String kind;
List<Node> components;
int lineno;
List<String> commentList = new ArrayList<String>();
List<String> commentList = new ArrayList<>();
Node parent = null;
Context context = null;
......@@ -50,8 +50,8 @@ abstract class Node {
}
void parentAndExtractComments() {
for (Iterator it = components.iterator(); it.hasNext();) {
Node node = (Node)it.next();
for (Iterator<Node> it = components.iterator(); it.hasNext();) {
Node node = it.next();
if (node instanceof CommentNode) {
it.remove();
commentList.add(((CommentNode)node).text());
......@@ -63,16 +63,14 @@ abstract class Node {
}
void prune() {
for (Iterator it = components.iterator(); it.hasNext();) {
Node node = (Node)it.next();
for (Node node : components) {
node.prune();
}
}
void constrain(Context ctx) {
context = ctx;
for (Iterator it = components.iterator(); it.hasNext();) {
Node node = (Node)it.next();
for (Node node : components) {
constrainComponent(ctx, node);
}
}
......@@ -109,9 +107,9 @@ abstract class Node {
if (commentList.size() > 0) {
indent(writer, depth);
writer.println("/**");
for (Iterator it = commentList.iterator(); it.hasNext();) {
for (String comment : commentList) {
indent(writer, depth);
writer.println(" * " + (String)it.next());
writer.println(" * " + comment);
}
indent(writer, depth);
writer.println(" */");
......@@ -123,15 +121,13 @@ abstract class Node {
}
void genJava(PrintWriter writer, int depth) {
for (Iterator it = components.iterator(); it.hasNext();) {
Node node = (Node)it.next();
for (Node node : components) {
node.genJava(writer, depth);
}
}
void genCInclude(PrintWriter writer) {
for (Iterator it = components.iterator(); it.hasNext();) {
Node node = (Node)it.next();
for (Node node : components) {
node.genCInclude(writer);
}
}
......@@ -184,8 +180,7 @@ abstract class Node {
}
void genJavaPreDef(PrintWriter writer, int depth) {
for (Iterator it = components.iterator(); it.hasNext();) {
Node node = (Node)it.next();
for (Node node : components) {
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.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -48,8 +48,8 @@ class OutNode extends AbstractTypeListNode {
indent(writer, depth);
writer.print(
"static " + cmdName + " process(VirtualMachineImpl vm");
for (Iterator it = components.iterator(); it.hasNext();) {
TypeNode tn = (TypeNode)it.next();
for (Node node : components) {
TypeNode tn = (TypeNode)node;
writer.println(", ");
indent(writer, depth+5);
writer.print(tn.javaParam());
......@@ -59,8 +59,8 @@ class OutNode extends AbstractTypeListNode {
writer.println("throws JDWPException {");
indent(writer, depth+1);
writer.print("PacketStream ps = enqueueCommand(vm");
for (Iterator it = components.iterator(); it.hasNext();) {
TypeNode tn = (TypeNode)it.next();
for (Node node : components) {
TypeNode tn = (TypeNode)node;
writer.print(", ");
writer.print(tn.name());
}
......@@ -76,8 +76,8 @@ class OutNode extends AbstractTypeListNode {
indent(writer, depth);
writer.print(
"static PacketStream enqueueCommand(VirtualMachineImpl vm");
for (Iterator it = components.iterator(); it.hasNext();) {
TypeNode tn = (TypeNode)it.next();
for (Node node : components) {
TypeNode tn = (TypeNode)node;
writer.println(", ");
indent(writer, depth+5);
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.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -42,11 +42,11 @@ class RootNode extends AbstractNamedNode {
void document(PrintWriter writer) {
writer.println("<html><head><title>" + comment() + "</title></head>");
writer.println("<body bgcolor=\"white\">");
for (Iterator it = components.iterator(); it.hasNext();) {
((Node)it.next()).documentIndex(writer);
for (Node node : components) {
node.documentIndex(writer);
}
for (Iterator it = components.iterator(); it.hasNext();) {
((Node)it.next()).document(writer);
for (Node node : components) {
node.document(writer);
}
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.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -34,10 +34,10 @@ class SelectNode extends AbstractGroupNode implements TypeNode {
void prune() {
super.prune();
Iterator it = components.iterator();
Iterator<Node> it = components.iterator();
if (it.hasNext()) {
Node typeNode = (Node)it.next();
Node typeNode = it.next();
if (typeNode instanceof ByteTypeNode ||
typeNode instanceof IntTypeNode) {
......@@ -131,8 +131,8 @@ class SelectNode extends AbstractGroupNode implements TypeNode {
typeNode.genJavaRead(writer, depth, typeNode.name());
indent(writer, depth);
writer.println("switch (" + typeNode.name() + ") {");
for (Iterator it = components.iterator(); it.hasNext();) {
AltNode alt = (AltNode)it.next();
for (Node node : components) {
AltNode alt = (AltNode)node;
alt.genJavaReadsSelectCase(writer, depth+1, commonVar());
}
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.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -38,7 +38,7 @@ import java.util.jar.*;
public class MakeClasslist {
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 javaHome = origJavaHome.toLowerCase();
if (javaHome.endsWith("jre")) {
......@@ -84,10 +84,9 @@ public class MakeClasslist {
}
}
Set/*<String>*/ seenClasses = new HashSet();
Set<String> seenClasses = new HashSet<>();
for (Iterator iter = classes.iterator(); iter.hasNext(); ) {
String str = (String) iter.next();
for (String str : seenClasses) {
if (seenClasses.add(str)) {
System.out.println(str);
}
......@@ -109,13 +108,13 @@ public class MakeClasslist {
// completePackage(seenClasses, rtJar, "java/lang");
}
private static void completePackage(Set seenClasses,
private static void completePackage(Set<String> seenClasses,
JarFile jar,
String packageName) {
int len = packageName.length();
Enumeration entries = jar.entries();
Enumeration<JarEntry> entries = jar.entries();
while (entries.hasMoreElements()) {
JarEntry entry = (JarEntry) entries.nextElement();
JarEntry entry = entries.nextElement();
String name = entry.getName();
if (name.startsWith(packageName) &&
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.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -246,7 +246,7 @@ public class StripProperties {
throws IOException {
BufferedWriter awriter;
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 val = (String)properties.get(key);
key = saveConvert(key, true);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册