Index: luni/src/main/java/java/net/InetAddress.java
===================================================================
--- luni/src/main/java/java/net/InetAddress.java (revision 489332)
+++ luni/src/main/java/java/net/InetAddress.java (working copy)
@@ -61,7 +61,7 @@
String hostName;
- private class WaitReachable {}
+ private static class WaitReachable {}
private transient Object waitReachable = new WaitReachable();
private boolean reached;
Index: luni/src/main/java/java/net/URLConnection.java
===================================================================
--- luni/src/main/java/java/net/URLConnection.java (revision 489332)
+++ luni/src/main/java/java/net/URLConnection.java (working copy)
@@ -1039,7 +1039,7 @@
return getClass().getName() + ":" + url.toString();
}
- class DefaultContentHandler extends java.net.ContentHandler {
+ static class DefaultContentHandler extends java.net.ContentHandler {
/**
* @param u
Index: luni/src/main/java/java/net/Socket.java
===================================================================
--- luni/src/main/java/java/net/Socket.java (revision 489332)
+++ luni/src/main/java/java/net/Socket.java (working copy)
@@ -51,7 +51,7 @@
private boolean isOutputShutdown = false;
- private class ConnectLock {}
+ private static class ConnectLock {}
private Object connectLock = new ConnectLock();
private Proxy proxy;
Index: luni/src/main/java/java/net/DatagramSocket.java
===================================================================
--- luni/src/main/java/java/net/DatagramSocket.java (revision 489332)
+++ luni/src/main/java/java/net/DatagramSocket.java (working copy)
@@ -46,7 +46,7 @@
private boolean isClosed = false;
- private class Lock {}
+ private static class Lock {}
private Object lock = new Lock();
/**
Index: luni/src/main/java/java/io/ObjectInputStream.java
===================================================================
--- luni/src/main/java/java/io/ObjectInputStream.java (revision 489332)
+++ luni/src/main/java/java/io/ObjectInputStream.java (working copy)
@@ -122,7 +122,7 @@
}
// Internal type used to keep track of validators & corresponding priority
- class InputValidationDesc {
+ static class InputValidationDesc {
ObjectInputValidation validator;
int priority;
Index: luni/src/main/java/java/io/RandomAccessFile.java
===================================================================
--- luni/src/main/java/java/io/RandomAccessFile.java (revision 489332)
+++ luni/src/main/java/java/io/RandomAccessFile.java (working copy)
@@ -48,7 +48,7 @@
private boolean isReadOnly;
- private class RepositionLock {
+ private static class RepositionLock {
}
private Object repositionLock = new RepositionLock();
Index: luni/src/main/java/java/io/PrintStream.java
===================================================================
--- luni/src/main/java/java/io/PrintStream.java (revision 489332)
+++ luni/src/main/java/java/io/PrintStream.java (working copy)
@@ -39,12 +39,6 @@
Closeable {
private static final String TOKEN_NULL = "null"; //$NON-NLS-1$
-
- /**
- * protect writes to the underlying stream.
- */
- private class Lock {}
- private Object lock = new Lock();
/**
* indicates whether or not this PrintStream has incurred an error.
@@ -244,16 +238,14 @@
*
*/
@Override
- public void close() {
- synchronized (lock) {
- flush();
- if (out != null) {
- try {
- out.close();
- out = null;
- } catch (IOException e) {
- setError();
- }
+ public synchronized void close() {
+ flush();
+ if (out != null) {
+ try {
+ out.close();
+ out = null;
+ } catch (IOException e) {
+ setError();
}
}
}
@@ -265,14 +257,12 @@
*
*/
@Override
- public void flush() {
- synchronized (lock) {
- if (out != null) {
- try {
- out.flush();
- return;
- } catch (IOException e) {
- }
+ public synchronized void flush() {
+ if (out != null) {
+ try {
+ out.flush();
+ return;
+ } catch (IOException e) {
}
}
setError();
@@ -472,26 +462,24 @@
* @param str
* the String to print on this PrintStream.
*/
- public void print(String str) {
- synchronized (lock) {
- if (out == null) {
- setError();
- return;
- }
- if (str == null) {
- print("null"); //$NON-NLS-1$
- return;
- }
+ public synchronized void print(String str) {
+ if (out == null) {
+ setError();
+ return;
+ }
+ if (str == null) {
+ print("null"); //$NON-NLS-1$
+ return;
+ }
- try {
- if (encoding == null) {
- write(str.getBytes());
- } else {
- write(str.getBytes(encoding));
- }
- } catch (IOException e) {
- setError();
- }
+ try {
+ if (encoding == null) {
+ write(str.getBytes());
+ } else {
+ write(str.getBytes(encoding));
+ }
+ } catch (IOException e) {
+ setError();
}
}
@@ -607,11 +595,9 @@
* @param str
* the String to print on this PrintStream.
*/
- public void println(String str) {
- synchronized (lock) {
- print(str);
- newline();
- }
+ public synchronized void println(String str) {
+ print(str);
+ newline();
}
/**
@@ -654,7 +640,7 @@
// avoid int overflow
if (0 <= offset && offset <= buffer.length && 0 <= count
&& count <= buffer.length - offset) {
- synchronized (lock) {
+ synchronized (this) {
if (out == null) {
setError();
return;
@@ -688,21 +674,19 @@
* the byte to be written
*/
@Override
- public void write(int oneByte) {
- synchronized (lock) {
- if (out == null) {
- setError();
- return;
- }
- try {
- out.write(oneByte);
- if (autoflush && (oneByte & 0xFF) == '\n') {
- flush();
- }
- } catch (IOException e) {
- setError();
- }
+ public synchronized void write(int oneByte) {
+ if (out == null) {
+ setError();
+ return;
}
+ try {
+ out.write(oneByte);
+ if (autoflush && (oneByte & 0xFF) == '\n') {
+ flush();
+ }
+ } catch (IOException e) {
+ setError();
+ }
}
/**
Index: luni/src/main/java/java/io/FileInputStream.java
===================================================================
--- luni/src/main/java/java/io/FileInputStream.java (revision 489332)
+++ luni/src/main/java/java/io/FileInputStream.java (working copy)
@@ -45,8 +45,8 @@
private IFileSystem fileSystem = Platform.getFileSystem();
- private class RepositioningLock {}
- private Object repositioningLock = new RepositioningLock();
+ private static class RepositioningLock {}
+ private Object repositioningLock = new Object();
/**
* Constructs a new FileInputStream on the File file. If the
Index: luni/src/main/java/org/apache/harmony/luni/platform/AbstractMemorySpy.java
===================================================================
--- luni/src/main/java/org/apache/harmony/luni/platform/AbstractMemorySpy.java (revision 486101)
+++ luni/src/main/java/org/apache/harmony/luni/platform/AbstractMemorySpy.java (working copy)
@@ -37,10 +37,7 @@
protected ReferenceQueue