checkstyle passed
git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@48 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/dev/core/src/com/google/gwt/dev/util/Messages.java b/dev/core/src/com/google/gwt/dev/util/Messages.java
index 0d63f0f..9827a6a 100644
--- a/dev/core/src/com/google/gwt/dev/util/Messages.java
+++ b/dev/core/src/com/google/gwt/dev/util/Messages.java
@@ -19,31 +19,33 @@
import com.google.gwt.dev.util.msg.Message0;
import com.google.gwt.dev.util.msg.Message1String;
-// Shared by anyone
+/**
+ * Static messages.
+ */
public class Messages {
public static final Message0 HINT_CHECK_CLASSPATH_SOURCE_ENTRIES = new Message0(
- TreeLogger.ERROR,
- "Hint: Check that your classpath includes all required source roots");
+ TreeLogger.ERROR,
+ "Hint: Check that your classpath includes all required source roots");
public static final Message0 HINT_CHECK_INHERIT_CORE = new Message0(
- TreeLogger.ERROR,
- "Hint: Check that your module inherits 'com.google.gwt.core.Core' either directly or indirectly (most often by inheriting module 'com.google.gwt.user.User')");
+ TreeLogger.ERROR,
+ "Hint: Check that your module inherits 'com.google.gwt.core.Core' either directly or indirectly (most often by inheriting module 'com.google.gwt.user.User')");
public static final Message0 HINT_CHECK_INHERIT_USER = new Message0(
- TreeLogger.ERROR,
- "Hint: Check that your module inherits 'com.google.gwt.user.User' either directly or indirectly");
+ TreeLogger.ERROR,
+ "Hint: Check that your module inherits 'com.google.gwt.user.User' either directly or indirectly");
public static final Message0 HINT_CHECK_MODULE_INHERITANCE = new Message0(
- TreeLogger.ERROR,
- "Hint: Check the inheritance chain from your module; it may not be inheriting a required module or a module may not be adding its source path entries properly");
+ TreeLogger.ERROR,
+ "Hint: Check the inheritance chain from your module; it may not be inheriting a required module or a module may not be adding its source path entries properly");
public static final Message0 HINT_CHECK_MODULE_NONCLIENT_SOURCE_DECL = new Message0(
- TreeLogger.ERROR,
- "Hint: Your source appears not to live underneath a subpackage called 'client'; no problem, but you'll need to use the <source> directive in your module to make it accessible");
+ TreeLogger.ERROR,
+ "Hint: Your source appears not to live underneath a subpackage called 'client'; no problem, but you'll need to use the <source> directive in your module to make it accessible");
public static final Message1String HINT_CHECK_TYPENAME = new Message1String(
- TreeLogger.ERROR,
- "Hint: Check that the type name '$0' is really what you meant");
+ TreeLogger.ERROR,
+ "Hint: Check that the type name '$0' is really what you meant");
public static final Message0 HINT_PRIOR_COMPILER_ERRORS = new Message0(
- TreeLogger.ERROR,
- "Hint: Previous compiler errors may have made this type unavailable");
+ TreeLogger.ERROR,
+ "Hint: Previous compiler errors may have made this type unavailable");
private Messages() {
}
diff --git a/dev/core/src/com/google/gwt/dev/util/NetProxy.java b/dev/core/src/com/google/gwt/dev/util/NetProxy.java
index 1d3332f..b332750 100644
--- a/dev/core/src/com/google/gwt/dev/util/NetProxy.java
+++ b/dev/core/src/com/google/gwt/dev/util/NetProxy.java
@@ -21,28 +21,85 @@
import java.net.ServerSocket;
import java.net.Socket;
+/**
+ * Protocol-blind byte-level proxy.
+ */
public class NetProxy {
+<<<<<<< .mine
+ private class ClientToServerProxyConnection extends ProxyConnection {
+ public ClientToServerProxyConnection(Socket clientSideSocket,
+ Socket serverSideSocket) {
+ super(clientSideSocket, serverSideSocket);
+ setName(fFromPort + " => " + fToPort + " #" + fConnections);
+ }
+=======
private class ClientToServerProxyConnection extends ProxyConnection {
public ClientToServerProxyConnection(Socket clientSideSocket,
Socket serverSideSocket) {
super(clientSideSocket, serverSideSocket);
setName(fromPort + " => " + toPort + " #" + connections);
}
+>>>>>>> .r47
protected void recordBytesTransferred(byte[] bytes, int avail) {
addBytesSent(avail, bytes);
}
}
+<<<<<<< .mine
+ private abstract class ProxyConnection extends Thread {
+ private Socket fFromSocket;
+ private Socket fToSocket;
+=======
private abstract class ProxyConnection extends Thread {
private Socket fromSocket;
private Socket toSocket;
+>>>>>>> .r47
+<<<<<<< .mine
+ public ProxyConnection(Socket fromSocket, Socket toSocket) {
+ fFromSocket = fromSocket;
+ fToSocket = toSocket;
+=======
public ProxyConnection(Socket fromSocket, Socket toSocket) {
this.fromSocket = fromSocket;
this.toSocket = toSocket;
+>>>>>>> .r47
}
+<<<<<<< .mine
+
+ public void run() {
+ try {
+ InputStream fromSideInput = fFromSocket.getInputStream();
+ OutputStream toSideOutput = fToSocket.getOutputStream();
+
+ /*
+ * Spin and pass data in one direction.
+ */
+ int avail;
+ byte[] bytes = new byte[32768];
+ while (true) {
+ // Read 'from' side
+ avail = fromSideInput.read(bytes);
+ if (avail > 0) {
+ // Forward to 'to' side
+ toSideOutput.write(bytes, 0, avail);
+ // Accumulate bytes received
+ recordBytesTransferred(bytes, avail);
+ } else if (avail == -1) {
+ break;
+ }
+ }
+ } catch (Throwable e) {
+ } finally {
+ try {
+ fFromSocket.close();
+ fToSocket.close();
+ } catch (Throwable e) {
+ }
+ }
+=======
public void run() {
try {
@@ -74,8 +131,18 @@
} catch (Throwable e) {
}
}
+>>>>>>> .r47
}
+<<<<<<< .mine
+ protected abstract void recordBytesTransferred(byte[] bytes, int avail);
+ }
+ private class ServerToClientProxyConnection extends ProxyConnection {
+ public ServerToClientProxyConnection(Socket clientSideSocket,
+ Socket serverSideSocket) {
+ super(serverSideSocket, clientSideSocket);
+ setName(fFromPort + " <= " + fToPort + " #" + fConnections);
+=======
protected abstract void recordBytesTransferred(byte[] bytes, int avail);
}
private class ServerToClientProxyConnection extends ProxyConnection {
@@ -83,6 +150,7 @@
Socket serverSideSocket) {
super(serverSideSocket, clientSideSocket);
setName(fromPort + " <= " + toPort + " #" + connections);
+>>>>>>> .r47
}
protected void recordBytesTransferred(byte[] bytes, int avail) {
@@ -96,6 +164,44 @@
return;
}
+<<<<<<< .mine
+ int localPort = Integer.parseInt(args[0]);
+ int remotePort = Integer.parseInt(args[1]);
+ String remoteHost = args.length < 3 ? "localhost" : args[2];
+ NetProxy netProxy = new NetProxy(localPort, remoteHost, remotePort, true);
+ netProxy.run();
+ }
+
+ private boolean fDumpChars;
+ private int fFromPort;
+ private String fToName;
+ private int fToPort;
+ private int fBytesSent;
+ private int fBytesReceived;
+
+ private int fConnections;
+
+ private boolean fEnd;
+
+ private long fStartTime = System.currentTimeMillis();
+
+ public NetProxy(int fromPort, String toName, int toPort, boolean dumpChars) {
+ fFromPort = fromPort;
+ fToName = toName;
+ fToPort = toPort;
+ fDumpChars = dumpChars;
+ }
+
+ public void end() {
+ fEnd = true;
+ }
+
+ public void run() {
+ try {
+ System.out.println("Time\tBytes Sent\tBytes Received\tTotal Bytes\tHTTP Data");
+ ServerSocket serverSocket = new ServerSocket(fFromPort);
+ while (!fEnd) {
+=======
int localPort = Integer.parseInt(args[0]);
int remotePort = Integer.parseInt(args[1]);
String remoteHost = args.length < 3 ? "localhost" : args[2];
@@ -132,8 +238,13 @@
System.out.println("Time\tBytes Sent\tBytes Received\tTotal Bytes\tHTTP Data");
ServerSocket serverSocket = new ServerSocket(fromPort);
while (!end) {
+>>>>>>> .r47
try {
+<<<<<<< .mine
+ ++fConnections;
+=======
++connections;
+>>>>>>> .r47
/*
* Listen for and accept the client-initiated connection. Connect to
@@ -143,8 +254,13 @@
Socket clientSideSocket = serverSocket.accept();
clientSideSocket.setTcpNoDelay(true);
+<<<<<<< .mine
+ Socket serverSideSocket = new Socket(fToName, fToPort);
+ serverSideSocket.setTcpNoDelay(true);
+=======
Socket serverSideSocket = new Socket(toName, toPort);
serverSideSocket.setTcpNoDelay(true);
+>>>>>>> .r47
new ClientToServerProxyConnection(clientSideSocket, serverSideSocket).start();
new ServerToClientProxyConnection(clientSideSocket, serverSideSocket).start();
@@ -158,14 +274,62 @@
}
}
+<<<<<<< .mine
+ protected int getBytesReceived() {
+ return fBytesReceived;
+ }
+=======
protected int getBytesReceived() {
return bytesReceived;
}
+>>>>>>> .r47
+<<<<<<< .mine
+ protected int getBytesSent() {
+ return fBytesSent;
+ }
+=======
protected int getBytesSent() {
return bytesSent;
}
+>>>>>>> .r47
+<<<<<<< .mine
+ private synchronized void addBytesReceived(int byteCount, byte[] bytes) {
+ fBytesReceived += byteCount;
+ log(0, byteCount, bytes);
+ }
+
+ private synchronized void addBytesSent(int byteCount, byte[] bytes) {
+ fBytesSent += byteCount;
+ log(byteCount, 0, bytes);
+ }
+
+ private synchronized void log(int bytesSent, int bytesReceived,
+ byte[] dataBuffer) {
+ System.out.print(System.currentTimeMillis() - fStartTime);
+ System.out.print("\t");
+ System.out.print(bytesSent);
+ System.out.print("\t");
+ System.out.print(bytesReceived);
+ System.out.print("\t");
+ System.out.print(fBytesSent + fBytesReceived);
+ System.out.print("\t");
+ char ch;
+ int avail = (bytesSent != 0 ? bytesSent : bytesReceived);
+ if (fDumpChars) {
+ int limit = (avail < 1024 ? avail : 1024);
+ for (int i = 0; i < limit; ++i) {
+ ch = (char) dataBuffer[i];
+ if (ch >= 32 && ch < 128) {
+ System.out.print(ch);
+ } else if (ch == '\n') {
+ System.out.print("\\n");
+ } else if (ch == '\r') {
+ System.out.print("\\r");
+ } else {
+ System.out.print('.');
+=======
private synchronized void addBytesReceived(int byteCount, byte[] bytes) {
bytesReceived += byteCount;
log(0, byteCount, bytes);
@@ -200,6 +364,7 @@
System.out.print("\\r");
} else {
System.out.print('.');
+>>>>>>> .r47
}
}
} else {
diff --git a/dev/core/src/com/google/gwt/dev/util/StringCopier.java b/dev/core/src/com/google/gwt/dev/util/StringCopier.java
index a73b8f0..2b3963c 100644
--- a/dev/core/src/com/google/gwt/dev/util/StringCopier.java
+++ b/dev/core/src/com/google/gwt/dev/util/StringCopier.java
@@ -19,6 +19,9 @@
import java.nio.BufferOverflowException;
import java.nio.BufferUnderflowException;
+/**
+ * Utility class for directly modifying a character array.
+ */
public class StringCopier {
private final CharArrayWriter out = new CharArrayWriter();
private final char[] in;
diff --git a/dev/core/src/com/google/gwt/dev/util/TextOutput.java b/dev/core/src/com/google/gwt/dev/util/TextOutput.java
index fc7dd8e..c298c15 100644
--- a/dev/core/src/com/google/gwt/dev/util/TextOutput.java
+++ b/dev/core/src/com/google/gwt/dev/util/TextOutput.java
@@ -15,6 +15,9 @@
*/
package com.google.gwt.dev.util;
+/**
+ * Interface used for printing text output.
+ */
public interface TextOutput {
void indentIn();
diff --git a/dev/core/src/com/google/gwt/dev/util/TextOutputOnCharArray.java b/dev/core/src/com/google/gwt/dev/util/TextOutputOnCharArray.java
index 3bc0317..d9fe856 100644
--- a/dev/core/src/com/google/gwt/dev/util/TextOutputOnCharArray.java
+++ b/dev/core/src/com/google/gwt/dev/util/TextOutputOnCharArray.java
@@ -19,8 +19,20 @@
import java.io.PrintWriter;
import java.util.Arrays;
+/**
+ * Adapts {@link TextOutput} to a character array.
+ */
public class TextOutputOnCharArray implements TextOutput {
+<<<<<<< .mine
+ private final CharArrayWriter fCharArrayWriter;
+ private final boolean fCompact;
+ private int fIndent = 0;
+ private int fIndentGranularity;
+ private char[][] fIndents = new char[][] {new char[0]};
+ private boolean fJustNewlined;
+ private final PrintWriter p;
+=======
private final CharArrayWriter charArrayWriter;
private final boolean compact;
private int indent = 0;
@@ -28,22 +40,57 @@
private char[][] indents = new char[][] {new char[0]};
private boolean justNewlined;
private final PrintWriter p;
+>>>>>>> .r47
+<<<<<<< .mine
+ public TextOutputOnCharArray(boolean compact) {
+ fIndentGranularity = 2;
+ fCharArrayWriter = new CharArrayWriter(50 * 1024);
+ p = new PrintWriter(fCharArrayWriter);
+ fCompact = compact;
+ }
+=======
public TextOutputOnCharArray(boolean compact) {
indentGranularity = 2;
charArrayWriter = new CharArrayWriter(50 * 1024);
p = new PrintWriter(charArrayWriter);
this.compact = compact;
}
+>>>>>>> .r47
+<<<<<<< .mine
+ public int getIndent() {
+ return fIndent;
+ }
+=======
public int getIndent() {
return indent;
}
+>>>>>>> .r47
+<<<<<<< .mine
+ public char[] getText() {
+ return fCharArrayWriter.toCharArray();
+ }
+=======
public char[] getText() {
return charArrayWriter.toCharArray();
}
+>>>>>>> .r47
+<<<<<<< .mine
+ public void indentIn() {
+ ++fIndent;
+ if (fIndent >= fIndents.length) {
+ // Cache a new level of indentation string.
+ //
+ char[] newIndentLevel = new char[fIndent * fIndentGranularity];
+ Arrays.fill(newIndentLevel, ' ');
+ char[][] newIndents = new char[fIndents.length + 1][];
+ System.arraycopy(fIndents, 0, newIndents, 0, fIndents.length);
+ newIndents[fIndent] = newIndentLevel;
+ fIndents = newIndents;
+=======
public void indentIn() {
++indent;
if (indent >= indents.length) {
@@ -55,29 +102,67 @@
System.arraycopy(indents, 0, newIndents, 0, indents.length);
newIndents[indent] = newIndentLevel;
indents = newIndents;
+>>>>>>> .r47
}
}
+<<<<<<< .mine
+ public void indentOut() {
+ --fIndent;
+ }
+=======
public void indentOut() {
--indent;
}
+>>>>>>> .r47
+<<<<<<< .mine
+ public void newline() {
+ p.print('\n');
+ // TODO: remove flush calls
+ p.flush();
+ fJustNewlined = true;
+ }
+=======
public void newline() {
p.print('\n');
// TODO: remove flush calls
p.flush();
justNewlined = true;
}
+>>>>>>> .r47
+<<<<<<< .mine
+ public void newlineOpt() {
+ if (!fCompact) {
+ p.print('\n');
+ // TODO: remove flush calls
+ p.flush();
+=======
public void newlineOpt() {
if (!compact) {
p.print('\n');
// TODO: remove flush calls
p.flush();
+>>>>>>> .r47
}
+<<<<<<< .mine
+ fJustNewlined = true;
+ }
+=======
justNewlined = true;
}
+>>>>>>> .r47
+<<<<<<< .mine
+ public void print(char c) {
+ maybeIndent();
+ p.print(c);
+ // TODO: remove flush calls
+ p.flush();
+ fJustNewlined = false;
+ }
+=======
public void print(char c) {
maybeIndent();
p.print(c);
@@ -85,7 +170,17 @@
p.flush();
justNewlined = false;
}
+>>>>>>> .r47
+<<<<<<< .mine
+ public void print(char[] s) {
+ maybeIndent();
+ p.print(s);
+ // TODO: remove flush calls
+ p.flush();
+ fJustNewlined = false;
+ }
+=======
public void print(char[] s) {
maybeIndent();
p.print(s);
@@ -93,7 +188,17 @@
p.flush();
justNewlined = false;
}
+>>>>>>> .r47
+<<<<<<< .mine
+ public void print(String s) {
+ maybeIndent();
+ p.print(s);
+ // TODO: remove flush calls
+ p.flush();
+ fJustNewlined = false;
+ }
+=======
public void print(String s) {
maybeIndent();
p.print(s);
@@ -101,44 +206,87 @@
p.flush();
justNewlined = false;
}
+>>>>>>> .r47
+<<<<<<< .mine
+ public void printOpt(char c) {
+ if (!fCompact) {
+ maybeIndent();
+ p.print(c);
+ // TODO: remove flush calls
+ p.flush();
+=======
public void printOpt(char c) {
if (!compact) {
maybeIndent();
p.print(c);
// TODO: remove flush calls
p.flush();
+>>>>>>> .r47
}
}
+<<<<<<< .mine
+ public void printOpt(char[] s) {
+ if (!fCompact) {
+ maybeIndent();
+ p.print(s);
+ // TODO: remove flush calls
+ p.flush();
+=======
public void printOpt(char[] s) {
if (!compact) {
maybeIndent();
p.print(s);
// TODO: remove flush calls
p.flush();
+>>>>>>> .r47
}
}
+<<<<<<< .mine
+ public void printOpt(String s) {
+ if (!fCompact) {
+ maybeIndent();
+ p.print(s);
+ // TODO: remove flush calls
+ p.flush();
+=======
public void printOpt(String s) {
if (!compact) {
maybeIndent();
p.print(s);
// TODO: remove flush calls
p.flush();
+>>>>>>> .r47
}
}
+<<<<<<< .mine
+ public void setIndent(int indent) {
+ fIndent = indent;
+ }
+=======
public void setIndent(int indent) {
this.indent = indent;
}
+>>>>>>> .r47
+<<<<<<< .mine
+ private void maybeIndent() {
+ if (fJustNewlined && !fCompact) {
+ p.print(fIndents[fIndent]);
+ // TODO: remove flush calls
+ p.flush();
+ fJustNewlined = false;
+=======
private void maybeIndent() {
if (justNewlined && !compact) {
p.print(indents[indent]);
// TODO: remove flush calls
p.flush();
justNewlined = false;
+>>>>>>> .r47
}
}
}
diff --git a/dev/core/src/com/google/gwt/dev/util/TextOutputOnPrintWriter.java b/dev/core/src/com/google/gwt/dev/util/TextOutputOnPrintWriter.java
index c28d649..14fb6df 100644
--- a/dev/core/src/com/google/gwt/dev/util/TextOutputOnPrintWriter.java
+++ b/dev/core/src/com/google/gwt/dev/util/TextOutputOnPrintWriter.java
@@ -18,6 +18,9 @@
import java.io.PrintWriter;
import java.util.Arrays;
+/**
+ * Adapts {@link TextOutput} to a print writer.
+ */
public final class TextOutputOnPrintWriter implements TextOutput {
private final boolean compact;
diff --git a/dev/core/src/com/google/gwt/dev/util/log/AbstractTreeLogger.java b/dev/core/src/com/google/gwt/dev/util/log/AbstractTreeLogger.java
index 99a69b4..cd12428 100644
--- a/dev/core/src/com/google/gwt/dev/util/log/AbstractTreeLogger.java
+++ b/dev/core/src/com/google/gwt/dev/util/log/AbstractTreeLogger.java
@@ -21,21 +21,22 @@
import java.util.HashSet;
/**
- * Abstract base class for TreeLoggers.
+ * Abstract base class for TreeLoggers.
*/
public abstract class AbstractTreeLogger implements TreeLogger {
private static class UncommittedBranchData {
+ public final Throwable caught;
+
+ public final String message;
+ public final TreeLogger.Type type;
+
public UncommittedBranchData(Type type, String message, Throwable exception) {
caught = exception;
this.message = message;
this.type = type;
}
-
- public final Throwable caught;
- public final String message;
- public final TreeLogger.Type type;
}
public static String getStackTraceAsString(Throwable e) {
@@ -76,7 +77,7 @@
if (elem.getLineNumber() > 0) {
goodElems.add(elem);
if (goodElems.size() < 10
- || prevElem.getClassName().equals(elem.getClassName())) {
+ || prevElem.getClassName().equals(elem.getClassName())) {
// Keep going.
prevElem = elem;
} else {
@@ -86,13 +87,24 @@
}
}
if (goodElems.size() > 0) {
- return (StackTraceElement[]) goodElems
- .toArray(new StackTraceElement[goodElems.size()]);
+ return (StackTraceElement[]) goodElems.toArray(new StackTraceElement[goodElems.size()]);
} else {
return null;
}
}
+ public int indexWithinMyParent;
+
+ private UncommittedBranchData uncommitted;
+
+ private TreeLogger.Type logLevel = TreeLogger.ALL;
+
+ private int nextChildIndex;
+
+ private final Object nextChildIndexLock = new Object();
+
+ private AbstractTreeLogger parent;
+
/**
* The constructor used when creating a top-level logger.
*/
@@ -109,7 +121,7 @@
if (msg == null) {
msg = "(Null branch message)";
}
-
+
// Compute at which index the new child will be placed.
//
int childIndex = allocateNextChildIndex();
@@ -146,29 +158,8 @@
return childLogger;
}
- /**
- * Commits the branch after ensuring that the parent logger (if there is one)
- * has been committed first.
- */
- private synchronized void commitMyBranchEntryInMyParentLogger() {
- // (Only the root logger doesn't have a parent.)
- //
- if (parent != null) {
- if (uncommitted != null) {
- // Commit the parent first.
- //
- parent.commitMyBranchEntryInMyParentLogger();
-
- // Let the subclass do its thing to commit this branch.
- //
- parent.doCommitBranch(this, uncommitted.type, uncommitted.message,
- uncommitted.caught);
-
- // Release the uncommitted state.
- //
- uncommitted = null;
- }
- }
+ public final int getBranchedIndex() {
+ return indexWithinMyParent;
}
public final AbstractTreeLogger getParentLogger() {
@@ -194,7 +185,7 @@
if (msg == null) {
msg = "(Null log message)";
}
-
+
int childIndex = allocateNextChildIndex();
if (isLoggable(type)) {
commitMyBranchEntryInMyParentLogger();
@@ -239,6 +230,38 @@
protected abstract void doLog(int indexOfLogEntryWithinParentLogger,
TreeLogger.Type type, String msg, Throwable caught);
+ private int allocateNextChildIndex() {
+ synchronized (nextChildIndexLock) {
+ // postincrement because we want indices to start at 0
+ return nextChildIndex++;
+ }
+ }
+
+ /**
+ * Commits the branch after ensuring that the parent logger (if there is one)
+ * has been committed first.
+ */
+ private synchronized void commitMyBranchEntryInMyParentLogger() {
+ // (Only the root logger doesn't have a parent.)
+ //
+ if (parent != null) {
+ if (uncommitted != null) {
+ // Commit the parent first.
+ //
+ parent.commitMyBranchEntryInMyParentLogger();
+
+ // Let the subclass do its thing to commit this branch.
+ //
+ parent.doCommitBranch(this, uncommitted.type, uncommitted.message,
+ uncommitted.caught);
+
+ // Release the uncommitted state.
+ //
+ uncommitted = null;
+ }
+ }
+ }
+
private String getLoggerId() {
if (parent != null) {
if (parent.parent == null) {
@@ -253,22 +276,4 @@
return "#";
}
}
-
- private int allocateNextChildIndex() {
- synchronized (nextChildIndexLock) {
- // postincrement because we want indices to start at 0
- return nextChildIndex++;
- }
- }
-
- public final int getBranchedIndex() {
- return indexWithinMyParent;
- }
-
- private UncommittedBranchData uncommitted;
- private TreeLogger.Type logLevel = TreeLogger.ALL;
- public int indexWithinMyParent;
- private int nextChildIndex;
- private final Object nextChildIndexLock = new Object();
- private AbstractTreeLogger parent;
}
diff --git a/dev/core/src/com/google/gwt/dev/util/log/Loggers.java b/dev/core/src/com/google/gwt/dev/util/log/Loggers.java
index edd0003..ddedbe6 100644
--- a/dev/core/src/com/google/gwt/dev/util/log/Loggers.java
+++ b/dev/core/src/com/google/gwt/dev/util/log/Loggers.java
@@ -23,19 +23,27 @@
/**
* Produces either a null logger or, if the property
- * <code>gwt.useGuiLogger</code> is set, a graphical tree logger. This method
- * is useful for unit tests, where most of the time you don't want to log.
+ * <code>gwt.useGuiLogger</code> is set, a graphical tree logger. This
+ * method is useful for unit tests, where most of the time you don't want to
+ * log.
*/
public static TreeLogger createOptionalGuiTreeLogger() {
if (System.getProperty("gwt.useGuiLogger") != null) {
AbstractTreeLogger atl = TreeLoggerWidget.getAsDetachedWindow(
- "CompilationServiceTest", 800, 600, true);
+ "CompilationServiceTest", 800, 600, true);
return maybeSetDetailLevel(atl);
} else {
return TreeLogger.NULL;
}
}
+ public static void logURLs(TreeLogger logger, TreeLogger.Type type, URL[] urls) {
+ for (int i = 0; i < urls.length; i++) {
+ URL url = urls[i];
+ logger.log(type, url.toExternalForm(), null);
+ }
+ }
+
public static TreeLogger maybeSetDetailLevel(AbstractTreeLogger atl) {
String s = System.getProperty("gwt.logLevel");
if (s != null) {
@@ -46,11 +54,4 @@
}
return atl;
}
-
- public static void logURLs(TreeLogger logger, TreeLogger.Type type, URL[] urls) {
- for (int i = 0; i < urls.length; i++) {
- URL url = urls[i];
- logger.log(type, url.toExternalForm(), null);
- }
- }
}
diff --git a/dev/core/src/com/google/gwt/dev/util/log/PrintWriterTreeLogger.java b/dev/core/src/com/google/gwt/dev/util/log/PrintWriterTreeLogger.java
index be6b353..6460745 100644
--- a/dev/core/src/com/google/gwt/dev/util/log/PrintWriterTreeLogger.java
+++ b/dev/core/src/com/google/gwt/dev/util/log/PrintWriterTreeLogger.java
@@ -17,8 +17,15 @@
import java.io.PrintWriter;
+/**
+ * Tree logger that logs to a print writer.
+ */
public final class PrintWriterTreeLogger extends AbstractTreeLogger {
+ private final PrintWriter out;
+
+ private final String indent;
+
public PrintWriterTreeLogger() {
this(new PrintWriter(System.out, true));
}
@@ -55,7 +62,4 @@
caught.printStackTrace(out);
}
}
-
- private final PrintWriter out;
- private final String indent;
}
diff --git a/dev/core/src/com/google/gwt/dev/util/log/ServletContextTreeLogger.java b/dev/core/src/com/google/gwt/dev/util/log/ServletContextTreeLogger.java
index 72a3bfb..c41eaeb 100644
--- a/dev/core/src/com/google/gwt/dev/util/log/ServletContextTreeLogger.java
+++ b/dev/core/src/com/google/gwt/dev/util/log/ServletContextTreeLogger.java
@@ -17,8 +17,13 @@
import javax.servlet.ServletContext;
+/**
+ * Tree logger that logs servlet context information.
+ */
public class ServletContextTreeLogger extends AbstractTreeLogger {
+ private final ServletContext ctx;
+
public ServletContextTreeLogger(ServletContext ctx) {
this.ctx = ctx;
}
@@ -40,6 +45,4 @@
ctx.log(msg);
}
}
-
- private final ServletContext ctx;
}
diff --git a/dev/core/src/com/google/gwt/dev/util/log/ThreadLocalTreeLoggerProxy.java b/dev/core/src/com/google/gwt/dev/util/log/ThreadLocalTreeLoggerProxy.java
index 016e897..de6dd19 100644
--- a/dev/core/src/com/google/gwt/dev/util/log/ThreadLocalTreeLoggerProxy.java
+++ b/dev/core/src/com/google/gwt/dev/util/log/ThreadLocalTreeLoggerProxy.java
@@ -37,10 +37,15 @@
}
/**
- * Sets the logger to which calls are redirected for the current thread.
+ * Delegates the branch to the thread-local logger if one is present.
+ * Otherwise, the log entry is discarded and <code>this</code> is returned.
*/
- public void set(TreeLogger logger) {
- perThreadLogger.set(logger);
+ public TreeLogger branch(Type type, String msg, Throwable caught) {
+ TreeLogger logger = (TreeLogger) perThreadLogger.get();
+ if (logger != null)
+ return logger.branch(type, msg, caught);
+ else
+ return this;
}
/**
@@ -68,14 +73,9 @@
}
/**
- * Delegates the branch to the thread-local logger if one is present.
- * Otherwise, the log entry is discarded and <code>this</code> is returned.
+ * Sets the logger to which calls are redirected for the current thread.
*/
- public TreeLogger branch(Type type, String msg, Throwable caught) {
- TreeLogger logger = (TreeLogger) perThreadLogger.get();
- if (logger != null)
- return logger.branch(type, msg, caught);
- else
- return this;
+ public void set(TreeLogger logger) {
+ perThreadLogger.set(logger);
}
}
diff --git a/dev/core/src/com/google/gwt/dev/util/log/TreeItemLogger.java b/dev/core/src/com/google/gwt/dev/util/log/TreeItemLogger.java
index e581226..9bfce42 100644
--- a/dev/core/src/com/google/gwt/dev/util/log/TreeItemLogger.java
+++ b/dev/core/src/com/google/gwt/dev/util/log/TreeItemLogger.java
@@ -30,9 +30,24 @@
import java.util.LinkedList;
import java.util.List;
+/**
+ * Tree logger built on an SWT tree item.
+ */
public final class TreeItemLogger extends AbstractTreeLogger {
public static class LogEvent {
+ public final Throwable caught;
+
+ public final int index;
+
+ public final boolean isBranchCommit;
+
+ public final TreeItemLogger logger;
+
+ public final String message;
+
+ public final TreeLogger.Type type;
+
public LogEvent(TreeItemLogger logger, boolean isBranchCommit, int index,
Type type, String message, Throwable caught) {
this.logger = logger;
@@ -202,13 +217,6 @@
}
}
}
-
- public final Throwable caught;
- public final int index;
- public final boolean isBranchCommit;
- public final TreeItemLogger logger;
- public final String message;
- public final TreeLogger.Type type;
}
/**
* One object that is shared across all logger instances in the same tree.
@@ -217,6 +225,10 @@
* provides tree-wide shared objects such as log item images.
*/
private static class PendingUpdates {
+ private List updates = new LinkedList();
+
+ private final Object updatesLock = new Object();
+
public void add(LogEvent update) {
synchronized (updatesLock) {
updates.add(update);
@@ -255,9 +267,6 @@
return true;
}
-
- private List updates = new LinkedList();
- private final Object updatesLock = new Object();
}
// These don't get disposed, but they do last for the entire process, so
@@ -289,6 +298,12 @@
}
}
+ private boolean dead;
+
+ private TreeItem lazyTreeItem;
+
+ private final PendingUpdates sharedPendingUpdates;
+
/**
* Constructs the top-level TreeItemLogger.
*/
@@ -332,8 +347,8 @@
}
TreeItemLogger commitChild = (TreeItemLogger) childBeingCommitted;
- sharedPendingUpdates.add(new LogEvent(commitChild, true, commitChild
- .getBranchedIndex(), type, msg, caught));
+ sharedPendingUpdates.add(new LogEvent(commitChild, true,
+ commitChild.getBranchedIndex(), type, msg, caught));
}
protected void doLog(int index, TreeLogger.Type type, String msg,
@@ -342,8 +357,7 @@
return;
}
- sharedPendingUpdates.add(new LogEvent(this, false, index, type, msg,
- caught));
+ sharedPendingUpdates.add(new LogEvent(this, false, index, type, msg, caught));
}
/**
@@ -379,8 +393,4 @@
//
return false;
}
-
- private boolean dead;
- private TreeItem lazyTreeItem;
- private final PendingUpdates sharedPendingUpdates;
}
diff --git a/dev/core/src/com/google/gwt/dev/util/log/TreeLoggerWidget.java b/dev/core/src/com/google/gwt/dev/util/log/TreeLoggerWidget.java
index 89c9825..392a7d5 100644
--- a/dev/core/src/com/google/gwt/dev/util/log/TreeLoggerWidget.java
+++ b/dev/core/src/com/google/gwt/dev/util/log/TreeLoggerWidget.java
@@ -44,16 +44,21 @@
import java.io.PrintWriter;
import java.io.StringWriter;
-public class TreeLoggerWidget extends Composite implements TreeListener, SelectionListener {
+/**
+ * SWT widget containing a tree logger.
+ */
+public class TreeLoggerWidget extends Composite implements TreeListener,
+ SelectionListener {
private static AbstractTreeLogger singletonWindowLogger;
/**
- * Useful for debugging, this method creates a standalone window in a background thread and
- * returns a logger you can use to write to it.
+ * Useful for debugging, this method creates a standalone window in a
+ * background thread and returns a logger you can use to write to it.
*/
- public static synchronized AbstractTreeLogger getAsDetachedWindow(final String caption,
- final int width, final int height, final boolean autoScroll) {
+ public static synchronized AbstractTreeLogger getAsDetachedWindow(
+ final String caption, final int width, final int height,
+ final boolean autoScroll) {
if (singletonWindowLogger != null) {
// Already set.
@@ -121,6 +126,14 @@
return singletonWindowLogger;
}
+ private boolean autoScroll;
+
+ private final Text details;
+
+ private final TreeItemLogger logger;
+
+ private final Tree tree;
+
public TreeLoggerWidget(Composite parent) {
super(parent, SWT.NONE);
@@ -149,7 +162,8 @@
logger = new TreeItemLogger();
// The detail
- details = new Text(sash, SWT.MULTI | SWT.WRAP | SWT.READ_ONLY | SWT.BORDER | SWT.V_SCROLL);
+ details = new Text(sash, SWT.MULTI | SWT.WRAP | SWT.READ_ONLY | SWT.BORDER
+ | SWT.V_SCROLL);
final Color detailsBgColor = new Color(null, 255, 255, 255);
details.setBackground(detailsBgColor);
details.addDisposeListener(new DisposeListener() {
@@ -158,7 +172,7 @@
}
});
- sash.setWeights(new int[]{80, 20});
+ sash.setWeights(new int[] {80, 20});
initLogFlushTimer(parent.getDisplay());
}
@@ -170,7 +184,7 @@
collapseAll(item);
}
if (items.length > 0) {
- tree.setSelection(new TreeItem[]{items[0]});
+ tree.setSelection(new TreeItem[] {items[0]});
}
}
@@ -190,7 +204,7 @@
expandAll(item);
}
if (items.length > 0) {
- tree.setSelection(new TreeItem[]{items[0]});
+ tree.setSelection(new TreeItem[] {items[0]});
}
}
@@ -203,6 +217,10 @@
}
}
+ public boolean getAutoScroll() {
+ return autoScroll;
+ }
+
public AbstractTreeLogger getLogger() {
return logger;
}
@@ -212,6 +230,10 @@
details.setText("");
}
+ public void setAutoScroll(boolean autoScroll) {
+ this.autoScroll = autoScroll;
+ }
+
public synchronized void treeCollapsed(TreeEvent treeEvent) {
}
@@ -225,45 +247,8 @@
syncDetailsPane((TreeItem) event.item);
}
- private void syncDetailsPane(TreeItem item) {
- // Try to get a LogEvent from the item's custom data.
- //
- TreeItemLogger.LogEvent logEvent = null;
- Object testLogEvent = item.getData();
- if (testLogEvent instanceof TreeItemLogger.LogEvent) {
- logEvent = (LogEvent) testLogEvent;
- }
-
- // Build a detail string.
- //
- StringBuffer sb = new StringBuffer();
-
- // Show the message type.
- //
- if (logEvent != null && logEvent.type != null) {
- sb.append("[");
- sb.append(logEvent.type.getLabel());
- sb.append("] ");
- }
-
- // Show the item text.
- //
- sb.append(item.getText());
- sb.append("\n");
-
- // Show the exception info for anything other than "UnableToComplete".
- //
- if (logEvent != null && logEvent.caught != null) {
- if (!(logEvent.caught instanceof UnableToCompleteException)) {
- String stackTrace = AbstractTreeLogger.getStackTraceAsString(logEvent.caught);
- sb.append(stackTrace);
- }
- }
-
- details.setText(sb.toString());
- }
-
- protected void appendTreeItemText(PrintWriter result, TreeItem[] items, int depth) {
+ protected void appendTreeItemText(PrintWriter result, TreeItem[] items,
+ int depth) {
for (int i = 0; i < items.length; i++) {
TreeItem item = items[i];
for (int j = 0; j < depth; j++) {
@@ -287,8 +272,8 @@
pw.close();
Clipboard cb = new Clipboard(tree.getDisplay());
- final Object[] cbText = new Object[]{sw.toString()};
- final Transfer[] cbFormat = new Transfer[]{TextTransfer.getInstance()};
+ final Object[] cbText = new Object[] {sw.toString()};
+ final Transfer[] cbFormat = new Transfer[] {TextTransfer.getInstance()};
cb.setContents(cbText, cbFormat);
}
@@ -307,7 +292,7 @@
if (autoScroll) {
TreeItem lastItem = findLastVisibleItem(tree);
if (lastItem != null) {
- tree.setSelection(new TreeItem[]{lastItem});
+ tree.setSelection(new TreeItem[] {lastItem});
tree.showItem(lastItem);
expandAllChildren(lastItem);
syncDetailsPane(lastItem);
@@ -352,16 +337,41 @@
});
}
- public void setAutoScroll(boolean autoScroll) {
- this.autoScroll = autoScroll;
- }
+ private void syncDetailsPane(TreeItem item) {
+ // Try to get a LogEvent from the item's custom data.
+ //
+ TreeItemLogger.LogEvent logEvent = null;
+ Object testLogEvent = item.getData();
+ if (testLogEvent instanceof TreeItemLogger.LogEvent) {
+ logEvent = (LogEvent) testLogEvent;
+ }
- public boolean getAutoScroll() {
- return autoScroll;
- }
+ // Build a detail string.
+ //
+ StringBuffer sb = new StringBuffer();
- private boolean autoScroll;
- private final Text details;
- private final TreeItemLogger logger;
- private final Tree tree;
+ // Show the message type.
+ //
+ if (logEvent != null && logEvent.type != null) {
+ sb.append("[");
+ sb.append(logEvent.type.getLabel());
+ sb.append("] ");
+ }
+
+ // Show the item text.
+ //
+ sb.append(item.getText());
+ sb.append("\n");
+
+ // Show the exception info for anything other than "UnableToComplete".
+ //
+ if (logEvent != null && logEvent.caught != null) {
+ if (!(logEvent.caught instanceof UnableToCompleteException)) {
+ String stackTrace = AbstractTreeLogger.getStackTraceAsString(logEvent.caught);
+ sb.append(stackTrace);
+ }
+ }
+
+ details.setText(sb.toString());
+ }
}
diff --git a/dev/core/src/com/google/gwt/dev/util/msg/Formatter.java b/dev/core/src/com/google/gwt/dev/util/msg/Formatter.java
index 87ec786..6580955 100644
--- a/dev/core/src/com/google/gwt/dev/util/msg/Formatter.java
+++ b/dev/core/src/com/google/gwt/dev/util/msg/Formatter.java
@@ -15,7 +15,11 @@
*/
package com.google.gwt.dev.util.msg;
+/**
+ * Abstract formatter used by {@link Message}.
+ */
public abstract class Formatter {
+
/**
* Transforms the specified object into a string format.
*
diff --git a/dev/core/src/com/google/gwt/dev/util/msg/FormatterForClass.java b/dev/core/src/com/google/gwt/dev/util/msg/FormatterForClass.java
index fe22aa1..35e2d8a 100644
--- a/dev/core/src/com/google/gwt/dev/util/msg/FormatterForClass.java
+++ b/dev/core/src/com/google/gwt/dev/util/msg/FormatterForClass.java
@@ -15,6 +15,9 @@
*/
package com.google.gwt.dev.util.msg;
+/**
+ * Class message formatter.
+ */
public final class FormatterForClass extends Formatter {
private String getNiceTypeName(Class targetType) {
diff --git a/dev/core/src/com/google/gwt/dev/util/msg/FormatterForFile.java b/dev/core/src/com/google/gwt/dev/util/msg/FormatterForFile.java
index 6e43d72..11ef2b6 100644
--- a/dev/core/src/com/google/gwt/dev/util/msg/FormatterForFile.java
+++ b/dev/core/src/com/google/gwt/dev/util/msg/FormatterForFile.java
@@ -17,6 +17,9 @@
import java.io.File;
+/**
+ * File message formatter.
+ */
public final class FormatterForFile extends Formatter {
public String format(Object toFormat) {
diff --git a/dev/core/src/com/google/gwt/dev/util/msg/FormatterForInteger.java b/dev/core/src/com/google/gwt/dev/util/msg/FormatterForInteger.java
index 8fcee58..9fa1d5d 100644
--- a/dev/core/src/com/google/gwt/dev/util/msg/FormatterForInteger.java
+++ b/dev/core/src/com/google/gwt/dev/util/msg/FormatterForInteger.java
@@ -15,6 +15,9 @@
*/
package com.google.gwt.dev.util.msg;
+/**
+ * Integer message formatter.
+ */
public final class FormatterForInteger extends Formatter {
public String format(Object toFormat) {
diff --git a/dev/core/src/com/google/gwt/dev/util/msg/FormatterForLong.java b/dev/core/src/com/google/gwt/dev/util/msg/FormatterForLong.java
index ca5c3d7..c4052fe 100644
--- a/dev/core/src/com/google/gwt/dev/util/msg/FormatterForLong.java
+++ b/dev/core/src/com/google/gwt/dev/util/msg/FormatterForLong.java
@@ -15,6 +15,9 @@
*/
package com.google.gwt.dev.util.msg;
+/**
+ * Long message formatter.
+ */
public final class FormatterForLong extends Formatter {
public String format(Object toFormat) {
diff --git a/dev/core/src/com/google/gwt/dev/util/msg/FormatterForMethod.java b/dev/core/src/com/google/gwt/dev/util/msg/FormatterForMethod.java
index eb45b3c..deec8df 100644
--- a/dev/core/src/com/google/gwt/dev/util/msg/FormatterForMethod.java
+++ b/dev/core/src/com/google/gwt/dev/util/msg/FormatterForMethod.java
@@ -17,6 +17,9 @@
import java.lang.reflect.Method;
+/**
+ * Method message formatter.
+ */
public final class FormatterForMethod extends Formatter {
public String format(Object toFormat) {
diff --git a/dev/core/src/com/google/gwt/dev/util/msg/FormatterForString.java b/dev/core/src/com/google/gwt/dev/util/msg/FormatterForString.java
index 9f3e8ed..184f608 100644
--- a/dev/core/src/com/google/gwt/dev/util/msg/FormatterForString.java
+++ b/dev/core/src/com/google/gwt/dev/util/msg/FormatterForString.java
@@ -15,6 +15,9 @@
*/
package com.google.gwt.dev.util.msg;
+/**
+ * String message formatter.
+ */
public final class FormatterForString extends Formatter {
public String format(Object toFormat) {
diff --git a/dev/core/src/com/google/gwt/dev/util/msg/FormatterForStringArray.java b/dev/core/src/com/google/gwt/dev/util/msg/FormatterForStringArray.java
index e763a33..4ca3dd1 100644
--- a/dev/core/src/com/google/gwt/dev/util/msg/FormatterForStringArray.java
+++ b/dev/core/src/com/google/gwt/dev/util/msg/FormatterForStringArray.java
@@ -15,6 +15,9 @@
*/
package com.google.gwt.dev.util.msg;
+/**
+ * String array message formatter.
+ */
public final class FormatterForStringArray extends Formatter {
public String format(Object toFormat) {
diff --git a/dev/core/src/com/google/gwt/dev/util/msg/FormatterForURL.java b/dev/core/src/com/google/gwt/dev/util/msg/FormatterForURL.java
index f912dce..aa43e00 100644
--- a/dev/core/src/com/google/gwt/dev/util/msg/FormatterForURL.java
+++ b/dev/core/src/com/google/gwt/dev/util/msg/FormatterForURL.java
@@ -17,6 +17,9 @@
import java.net.URL;
+/**
+ * URL message formatter.
+ */
public class FormatterForURL extends Formatter {
public String format(Object toFormat) {
diff --git a/dev/core/src/com/google/gwt/dev/util/msg/FormatterToString.java b/dev/core/src/com/google/gwt/dev/util/msg/FormatterToString.java
index 5ef6319..e0e9405 100644
--- a/dev/core/src/com/google/gwt/dev/util/msg/FormatterToString.java
+++ b/dev/core/src/com/google/gwt/dev/util/msg/FormatterToString.java
@@ -15,10 +15,12 @@
*/
package com.google.gwt.dev.util.msg;
+/**
+ * String message formatter.
+ */
public final class FormatterToString extends Formatter {
public String format(Object toFormat) {
return toFormat.toString();
}
-
}
diff --git a/dev/core/src/com/google/gwt/dev/util/msg/Message.java b/dev/core/src/com/google/gwt/dev/util/msg/Message.java
index 122d2c9..93978b6 100644
--- a/dev/core/src/com/google/gwt/dev/util/msg/Message.java
+++ b/dev/core/src/com/google/gwt/dev/util/msg/Message.java
@@ -22,12 +22,10 @@
import java.net.URL;
/**
- * Fast way to produce messages for the logger.
- * Use $N to specify the replacement argument.
- * Caveats:
- * - N must be a single digit (you shouldn't need more than 10 args, right?)
- * - '$' cannot be escaped
- * - each arg can only appear once
+ * Fast way to produce messages for the logger. Use $N to specify the
+ * replacement argument. Caveats: - N must be a single digit (you shouldn't need
+ * more than 10 args, right?) - '$' cannot be escaped - each arg can only appear
+ * once
*/
public abstract class Message {
@@ -41,6 +39,14 @@
private static final Formatter FMT_STRING = new FormatterForString();
private static final Formatter FMT_STRING_ARRAY = new FormatterForStringArray();
+ protected final TreeLogger.Type type;
+
+ protected final char[][] fmtParts;
+
+ protected final int[] argIndices;
+
+ protected final int minChars;
+
/**
* Creates a lazily-formatted message.
*/
@@ -57,8 +63,8 @@
int to = fmt.indexOf('$', from);
if (to != -1) {
if (to < fmt.length() - 1) {
- char charDigit = fmt.charAt(to + 1);
- if (Character.isDigit(charDigit)) {
+ char charDigit = fmt.charAt(to + 1);
+ if (Character.isDigit(charDigit)) {
int digit = Character.digit(charDigit, 10);
fmtParts[i] = fmt.substring(from, to).toCharArray();
argIndices[i] = digit;
@@ -86,10 +92,6 @@
return FMT_FILE;
}
- protected final Formatter getFormatter(URL u) {
- return FMT_URL;
- }
-
protected final Formatter getFormatter(Integer i) {
return FMT_INTEGER;
}
@@ -106,16 +108,15 @@
return FMT_STRING;
}
- protected final Formatter getToStringFormatter() {
- return FMT_TOSTRING;
- }
-
protected final Formatter getFormatter(String[] sa) {
return FMT_STRING_ARRAY;
}
- protected final TreeLogger.Type type;
- protected final char[][] fmtParts;
- protected final int[] argIndices;
- protected final int minChars;
+ protected final Formatter getFormatter(URL u) {
+ return FMT_URL;
+ }
+
+ protected final Formatter getToStringFormatter() {
+ return FMT_TOSTRING;
+ }
}
diff --git a/dev/core/src/com/google/gwt/dev/util/msg/Message0.java b/dev/core/src/com/google/gwt/dev/util/msg/Message0.java
index b387014..29128e6 100644
--- a/dev/core/src/com/google/gwt/dev/util/msg/Message0.java
+++ b/dev/core/src/com/google/gwt/dev/util/msg/Message0.java
@@ -18,22 +18,25 @@
import com.google.gwt.core.ext.TreeLogger;
import com.google.gwt.core.ext.TreeLogger.Type;
+/**
+ * 0-arg message.
+ */
public final class Message0 extends Message {
public Message0(Type type, String fmt) {
super(type, fmt, 0);
}
- public void log(TreeLogger logger, Throwable caught) {
- if (logger.isLoggable(type)) {
- logger.log(type, new String(fmtParts[0]), caught);
- }
- }
-
public TreeLogger branch(TreeLogger logger, Throwable caught) {
// Always branch, even if the branch root is not loggable.
// See TreeLogger.branch() for details as to why.
//
return logger.branch(type, new String(fmtParts[0]), caught);
}
+
+ public void log(TreeLogger logger, Throwable caught) {
+ if (logger.isLoggable(type)) {
+ logger.log(type, new String(fmtParts[0]), caught);
+ }
+ }
}
diff --git a/dev/core/src/com/google/gwt/dev/util/msg/Message1.java b/dev/core/src/com/google/gwt/dev/util/msg/Message1.java
index f7a6082..49d4092 100644
--- a/dev/core/src/com/google/gwt/dev/util/msg/Message1.java
+++ b/dev/core/src/com/google/gwt/dev/util/msg/Message1.java
@@ -18,6 +18,9 @@
import com.google.gwt.core.ext.TreeLogger;
import com.google.gwt.core.ext.TreeLogger.Type;
+/**
+ * 1-arg message.
+ */
public abstract class Message1 extends Message {
public Message1(Type type, String fmt) {
@@ -33,10 +36,10 @@
// Format the objects.
//
String stringArg1 = (arg1 != null ? fmt1.format(arg1) : "null");
-
+
// To maintain consistency with the other impls, we use an insert var.
//
- String insert1 = stringArg1;
+ String insert1 = stringArg1;
// Cache the length of the inserts.
//
@@ -46,7 +49,7 @@
//
int lenPart0 = fmtParts[0].length;
int lenPart1 = fmtParts[1].length;
-
+
// Prep for copying.
//
int dest = 0;
@@ -55,13 +58,13 @@
// literal + insert, part 0
System.arraycopy(fmtParts[0], 0, chars, dest, lenPart0);
dest += lenPart0;
-
- insert1.getChars(0, lenInsert1, chars, dest);
+
+ insert1.getChars(0, lenInsert1, chars, dest);
dest += lenInsert1;
// final literal
System.arraycopy(fmtParts[1], 0, chars, dest, lenPart1);
-
+
return new String(chars);
}
diff --git a/dev/core/src/com/google/gwt/dev/util/msg/Message1File.java b/dev/core/src/com/google/gwt/dev/util/msg/Message1File.java
index 6b0539f..2e745bd 100644
--- a/dev/core/src/com/google/gwt/dev/util/msg/Message1File.java
+++ b/dev/core/src/com/google/gwt/dev/util/msg/Message1File.java
@@ -20,6 +20,9 @@
import java.io.File;
+/**
+ * File message.
+ */
public final class Message1File extends Message1 {
public Message1File(Type type, String fmt) {
diff --git a/dev/core/src/com/google/gwt/dev/util/msg/Message1Long.java b/dev/core/src/com/google/gwt/dev/util/msg/Message1Long.java
index 5f966ff..06e5073 100644
--- a/dev/core/src/com/google/gwt/dev/util/msg/Message1Long.java
+++ b/dev/core/src/com/google/gwt/dev/util/msg/Message1Long.java
@@ -18,6 +18,9 @@
import com.google.gwt.core.ext.TreeLogger;
import com.google.gwt.core.ext.TreeLogger.Type;
+/**
+ * Long message.
+ */
public final class Message1Long extends Message1 {
public Message1Long(Type type, String fmt) {
diff --git a/dev/core/src/com/google/gwt/dev/util/msg/Message1String.java b/dev/core/src/com/google/gwt/dev/util/msg/Message1String.java
index 1cd68c5..46c2c21 100644
--- a/dev/core/src/com/google/gwt/dev/util/msg/Message1String.java
+++ b/dev/core/src/com/google/gwt/dev/util/msg/Message1String.java
@@ -18,6 +18,9 @@
import com.google.gwt.core.ext.TreeLogger;
import com.google.gwt.core.ext.TreeLogger.Type;
+/**
+ * String message.
+ */
public final class Message1String extends Message1 {
public Message1String(Type type, String fmt) {
diff --git a/dev/core/src/com/google/gwt/dev/util/msg/Message1StringArray.java b/dev/core/src/com/google/gwt/dev/util/msg/Message1StringArray.java
index ed399d7..dc22a4f 100644
--- a/dev/core/src/com/google/gwt/dev/util/msg/Message1StringArray.java
+++ b/dev/core/src/com/google/gwt/dev/util/msg/Message1StringArray.java
@@ -18,17 +18,20 @@
import com.google.gwt.core.ext.TreeLogger;
import com.google.gwt.core.ext.TreeLogger.Type;
+/**
+ * String array message.
+ */
public final class Message1StringArray extends Message1 {
public Message1StringArray(Type type, String fmt) {
super(type, fmt);
}
- public void log(TreeLogger logger, String[] sa, Throwable caught) {
- log1(logger, sa, getFormatter(sa), caught);
- }
-
public TreeLogger branch(TreeLogger logger, String[] sa, Throwable caught) {
return branch1(logger, sa, getFormatter(sa), caught);
}
+
+ public void log(TreeLogger logger, String[] sa, Throwable caught) {
+ log1(logger, sa, getFormatter(sa), caught);
+ }
}
diff --git a/dev/core/src/com/google/gwt/dev/util/msg/Message1ToString.java b/dev/core/src/com/google/gwt/dev/util/msg/Message1ToString.java
index 7f15eb1..41b8526 100644
--- a/dev/core/src/com/google/gwt/dev/util/msg/Message1ToString.java
+++ b/dev/core/src/com/google/gwt/dev/util/msg/Message1ToString.java
@@ -18,6 +18,9 @@
import com.google.gwt.core.ext.TreeLogger;
import com.google.gwt.core.ext.TreeLogger.Type;
+/**
+ * String message.
+ */
public final class Message1ToString extends Message1 {
public Message1ToString(Type type, String fmt) {
diff --git a/dev/core/src/com/google/gwt/dev/util/msg/Message1URL.java b/dev/core/src/com/google/gwt/dev/util/msg/Message1URL.java
index f25c7ad..3929854 100644
--- a/dev/core/src/com/google/gwt/dev/util/msg/Message1URL.java
+++ b/dev/core/src/com/google/gwt/dev/util/msg/Message1URL.java
@@ -20,6 +20,9 @@
import java.net.URL;
+/**
+ * URL message.
+ */
public final class Message1URL extends Message1 {
public Message1URL(Type type, String fmt) {
diff --git a/dev/core/src/com/google/gwt/dev/util/msg/Message2.java b/dev/core/src/com/google/gwt/dev/util/msg/Message2.java
index 32cd369..07a9e8f 100644
--- a/dev/core/src/com/google/gwt/dev/util/msg/Message2.java
+++ b/dev/core/src/com/google/gwt/dev/util/msg/Message2.java
@@ -18,6 +18,9 @@
import com.google.gwt.core.ext.TreeLogger;
import com.google.gwt.core.ext.TreeLogger.Type;
+/**
+ * 2-arg message.
+ */
public abstract class Message2 extends Message {
public Message2(Type type, String fmt) {
@@ -36,7 +39,7 @@
//
String stringArg1 = (arg1 != null ? fmt1.format(arg1) : "null");
String stringArg2 = (arg2 != null ? fmt2.format(arg2) : "null");
-
+
// Decide how to order the inserts.
// Tests are biased toward $1..$2 order.
//
@@ -53,7 +56,7 @@
int lenPart0 = fmtParts[0].length;
int lenPart1 = fmtParts[1].length;
int lenPart2 = fmtParts[2].length;
-
+
// Prep for copying.
//
int dest = 0;
@@ -62,20 +65,20 @@
// literal + insert, part 0
System.arraycopy(fmtParts[0], 0, chars, dest, lenPart0);
dest += lenPart0;
-
- insert1.getChars(0, lenInsert1, chars, dest);
+
+ insert1.getChars(0, lenInsert1, chars, dest);
dest += lenInsert1;
// literal + insert, part 1
System.arraycopy(fmtParts[1], 0, chars, dest, lenPart1);
dest += lenPart1;
-
- insert2.getChars(0, lenInsert2, chars, dest);
+
+ insert2.getChars(0, lenInsert2, chars, dest);
dest += lenInsert2;
-
+
// final literal
System.arraycopy(fmtParts[2], 0, chars, dest, lenPart2);
-
+
return new String(chars);
}
diff --git a/dev/core/src/com/google/gwt/dev/util/msg/Message2ClassClass.java b/dev/core/src/com/google/gwt/dev/util/msg/Message2ClassClass.java
index 509739d..7b917d8 100644
--- a/dev/core/src/com/google/gwt/dev/util/msg/Message2ClassClass.java
+++ b/dev/core/src/com/google/gwt/dev/util/msg/Message2ClassClass.java
@@ -18,17 +18,21 @@
import com.google.gwt.core.ext.TreeLogger;
import com.google.gwt.core.ext.TreeLogger.Type;
+/**
+ * Class & Class message.
+ */
public final class Message2ClassClass extends Message2 {
public Message2ClassClass(Type type, String fmt) {
super(type, fmt);
}
+ public TreeLogger branch(TreeLogger logger, Class c1, Class c2,
+ Throwable caught) {
+ return branch2(logger, c1, c2, getFormatter(c1), getFormatter(c2), caught);
+ }
+
public void log(TreeLogger logger, Class c1, Class c2, Throwable caught) {
log2(logger, c1, c2, getFormatter(c1), getFormatter(c2), caught);
}
-
- public TreeLogger branch(TreeLogger logger, Class c1, Class c2, Throwable caught) {
- return branch2(logger, c1, c2, getFormatter(c1), getFormatter(c2), caught);
- }
}
diff --git a/dev/core/src/com/google/gwt/dev/util/msg/Message2FileString.java b/dev/core/src/com/google/gwt/dev/util/msg/Message2FileString.java
index bc5ef29..0c3b77d 100644
--- a/dev/core/src/com/google/gwt/dev/util/msg/Message2FileString.java
+++ b/dev/core/src/com/google/gwt/dev/util/msg/Message2FileString.java
@@ -20,17 +20,20 @@
import java.io.File;
+/**
+ * File & String message.
+ */
public final class Message2FileString extends Message2 {
public Message2FileString(Type type, String fmt) {
super(type, fmt);
}
- public void log(TreeLogger logger, File f, String s, Throwable caught) {
- log2(logger, f, s, getFormatter(f), getFormatter(s), caught);
- }
-
public TreeLogger branch(TreeLogger logger, File f, String s, Throwable caught) {
return branch2(logger, f, s, getFormatter(f), getFormatter(s), caught);
}
+
+ public void log(TreeLogger logger, File f, String s, Throwable caught) {
+ log2(logger, f, s, getFormatter(f), getFormatter(s), caught);
+ }
}
diff --git a/dev/core/src/com/google/gwt/dev/util/msg/Message2IntString.java b/dev/core/src/com/google/gwt/dev/util/msg/Message2IntString.java
index 82f14bf..c4cb9eb8 100644
--- a/dev/core/src/com/google/gwt/dev/util/msg/Message2IntString.java
+++ b/dev/core/src/com/google/gwt/dev/util/msg/Message2IntString.java
@@ -18,6 +18,9 @@
import com.google.gwt.core.ext.TreeLogger;
import com.google.gwt.core.ext.TreeLogger.Type;
+/**
+ * Integer & String message.
+ */
public final class Message2IntString extends Message2 {
public Message2IntString(Type type, String fmt) {
diff --git a/dev/core/src/com/google/gwt/dev/util/msg/Message2LongString.java b/dev/core/src/com/google/gwt/dev/util/msg/Message2LongString.java
index 71f4afc..2e93531 100644
--- a/dev/core/src/com/google/gwt/dev/util/msg/Message2LongString.java
+++ b/dev/core/src/com/google/gwt/dev/util/msg/Message2LongString.java
@@ -18,6 +18,9 @@
import com.google.gwt.core.ext.TreeLogger;
import com.google.gwt.core.ext.TreeLogger.Type;
+/**
+ * Long & String message.
+ */
public final class Message2LongString extends Message2 {
public Message2LongString(Type type, String fmt) {
diff --git a/dev/core/src/com/google/gwt/dev/util/msg/Message2StringFile.java b/dev/core/src/com/google/gwt/dev/util/msg/Message2StringFile.java
index 7d20b47..8e68640 100644
--- a/dev/core/src/com/google/gwt/dev/util/msg/Message2StringFile.java
+++ b/dev/core/src/com/google/gwt/dev/util/msg/Message2StringFile.java
@@ -20,6 +20,9 @@
import java.io.File;
+/**
+ * String & File message.
+ */
public final class Message2StringFile extends Message2 {
public Message2StringFile(Type type, String fmt) {
diff --git a/dev/core/src/com/google/gwt/dev/util/msg/Message2StringInt.java b/dev/core/src/com/google/gwt/dev/util/msg/Message2StringInt.java
index b48eda8..a3f07bc 100644
--- a/dev/core/src/com/google/gwt/dev/util/msg/Message2StringInt.java
+++ b/dev/core/src/com/google/gwt/dev/util/msg/Message2StringInt.java
@@ -18,20 +18,23 @@
import com.google.gwt.core.ext.TreeLogger;
import com.google.gwt.core.ext.TreeLogger.Type;
+/**
+ * String & Integer message.
+ */
public final class Message2StringInt extends Message2 {
public Message2StringInt(Type type, String fmt) {
super(type, fmt);
}
- public void log(TreeLogger logger, String s, int x, Throwable caught) {
- Integer xi = new Integer(x);
- log2(logger, s, xi, getFormatter(s), getFormatter(xi), caught);
- }
-
public TreeLogger branch(TreeLogger logger, String s, int x, Throwable caught) {
Integer xi = new Integer(x);
return branch2(logger, s, xi, getFormatter(s), getFormatter(xi), caught);
}
+ public void log(TreeLogger logger, String s, int x, Throwable caught) {
+ Integer xi = new Integer(x);
+ log2(logger, s, xi, getFormatter(s), getFormatter(xi), caught);
+ }
+
}
diff --git a/dev/core/src/com/google/gwt/dev/util/msg/Message2StringString.java b/dev/core/src/com/google/gwt/dev/util/msg/Message2StringString.java
index f3ce826..e9b6b5d 100644
--- a/dev/core/src/com/google/gwt/dev/util/msg/Message2StringString.java
+++ b/dev/core/src/com/google/gwt/dev/util/msg/Message2StringString.java
@@ -18,6 +18,9 @@
import com.google.gwt.core.ext.TreeLogger;
import com.google.gwt.core.ext.TreeLogger.Type;
+/**
+ * String & String message.
+ */
public final class Message2StringString extends Message2 {
public Message2StringString(Type type, String fmt) {
diff --git a/dev/core/src/com/google/gwt/dev/util/msg/Message2StringStringArray.java b/dev/core/src/com/google/gwt/dev/util/msg/Message2StringStringArray.java
index 3bbc2d6..c26d4c8 100644
--- a/dev/core/src/com/google/gwt/dev/util/msg/Message2StringStringArray.java
+++ b/dev/core/src/com/google/gwt/dev/util/msg/Message2StringStringArray.java
@@ -18,17 +18,20 @@
import com.google.gwt.core.ext.TreeLogger;
import com.google.gwt.core.ext.TreeLogger.Type;
+/**
+ * String & String array message.
+ */
public final class Message2StringStringArray extends Message2 {
public Message2StringStringArray(Type type, String fmt) {
super(type, fmt);
}
- public void log(TreeLogger logger, String s, String[] sa, Throwable caught) {
- log2(logger, s, sa, getFormatter(s), getFormatter(sa), caught);
- }
-
public TreeLogger branch(TreeLogger logger, String s, String[] sa,
Throwable caught) {
return branch2(logger, s, sa, getFormatter(s), getFormatter(sa), caught);
}
+
+ public void log(TreeLogger logger, String s, String[] sa, Throwable caught) {
+ log2(logger, s, sa, getFormatter(s), getFormatter(sa), caught);
+ }
}
diff --git a/dev/core/src/com/google/gwt/dev/util/msg/Message2StringURL.java b/dev/core/src/com/google/gwt/dev/util/msg/Message2StringURL.java
index c00a397..e88432c 100644
--- a/dev/core/src/com/google/gwt/dev/util/msg/Message2StringURL.java
+++ b/dev/core/src/com/google/gwt/dev/util/msg/Message2StringURL.java
@@ -20,6 +20,9 @@
import java.net.URL;
+/**
+ * String & URL message.
+ */
public final class Message2StringURL extends Message2 {
public Message2StringURL(Type type, String fmt) {
diff --git a/dev/core/src/com/google/gwt/dev/util/msg/Message2URLInt.java b/dev/core/src/com/google/gwt/dev/util/msg/Message2URLInt.java
index b787c8d..44acb34 100644
--- a/dev/core/src/com/google/gwt/dev/util/msg/Message2URLInt.java
+++ b/dev/core/src/com/google/gwt/dev/util/msg/Message2URLInt.java
@@ -20,19 +20,22 @@
import java.net.URL;
+/**
+ * URL & Integer message.
+ */
public final class Message2URLInt extends Message2 {
public Message2URLInt(Type type, String fmt) {
super(type, fmt);
}
- public void log(TreeLogger logger, URL u, int x, Throwable caught) {
- Integer xi = new Integer(x);
- log2(logger, u, xi, getFormatter(u), getFormatter(xi), caught);
- }
-
public TreeLogger branch(TreeLogger logger, URL u, int x, Throwable caught) {
Integer xi = new Integer(x);
return branch2(logger, u, xi, getFormatter(u), getFormatter(xi), caught);
}
+
+ public void log(TreeLogger logger, URL u, int x, Throwable caught) {
+ Integer xi = new Integer(x);
+ log2(logger, u, xi, getFormatter(u), getFormatter(xi), caught);
+ }
}
diff --git a/dev/core/src/com/google/gwt/dev/util/msg/Message2URLString.java b/dev/core/src/com/google/gwt/dev/util/msg/Message2URLString.java
index a69e986..57ae3e8 100644
--- a/dev/core/src/com/google/gwt/dev/util/msg/Message2URLString.java
+++ b/dev/core/src/com/google/gwt/dev/util/msg/Message2URLString.java
@@ -20,17 +20,20 @@
import java.net.URL;
+/**
+ * URL & String message.
+ */
public final class Message2URLString extends Message2 {
public Message2URLString(Type type, String fmt) {
super(type, fmt);
}
- public void log(TreeLogger logger, URL u, String s, Throwable caught) {
- log2(logger, u, s, getFormatter(u), getFormatter(s), caught);
- }
-
public TreeLogger branch(TreeLogger logger, URL u, String s, Throwable caught) {
return branch2(logger, u, s, getFormatter(u), getFormatter(s), caught);
}
+
+ public void log(TreeLogger logger, URL u, String s, Throwable caught) {
+ log2(logger, u, s, getFormatter(u), getFormatter(s), caught);
+ }
}
diff --git a/dev/core/src/com/google/gwt/dev/util/msg/Message2URLURL.java b/dev/core/src/com/google/gwt/dev/util/msg/Message2URLURL.java
index a0df556..cc232bb 100644
--- a/dev/core/src/com/google/gwt/dev/util/msg/Message2URLURL.java
+++ b/dev/core/src/com/google/gwt/dev/util/msg/Message2URLURL.java
@@ -20,17 +20,20 @@
import java.net.URL;
+/**
+ * URL & URL message.
+ */
public final class Message2URLURL extends Message2 {
public Message2URLURL(Type type, String fmt) {
super(type, fmt);
}
- public void log(TreeLogger logger, URL u1, URL u2, Throwable caught) {
- log2(logger, u1, u2, getFormatter(u1), getFormatter(u2), caught);
- }
-
public TreeLogger branch(TreeLogger logger, URL u1, URL u2, Throwable caught) {
return branch2(logger, u1, u2, getFormatter(u1), getFormatter(u2), caught);
}
+
+ public void log(TreeLogger logger, URL u1, URL u2, Throwable caught) {
+ log2(logger, u1, u2, getFormatter(u1), getFormatter(u2), caught);
+ }
}
diff --git a/dev/core/src/com/google/gwt/dev/util/msg/Message3.java b/dev/core/src/com/google/gwt/dev/util/msg/Message3.java
index eeb1d25..22472d5 100644
--- a/dev/core/src/com/google/gwt/dev/util/msg/Message3.java
+++ b/dev/core/src/com/google/gwt/dev/util/msg/Message3.java
@@ -18,6 +18,9 @@
import com.google.gwt.core.ext.TreeLogger;
import com.google.gwt.core.ext.TreeLogger.Type;
+/**
+ * 3-arg message.
+ */
public abstract class Message3 extends Message {
protected Message3(Type type, String fmt) {
@@ -28,12 +31,12 @@
Object arg3, Formatter fmt1, Formatter fmt2, Formatter fmt3,
Throwable caught) {
return logger.branch(type, compose3(arg1, arg2, arg3, fmt1, fmt2, fmt3),
- caught);
+ caught);
}
protected String compose3(Object arg1, Object arg2, Object arg3,
Formatter fmt1, Formatter fmt2, Formatter fmt3) {
-
+
// Format the objects.
//
String stringArg1 = (arg1 != null ? fmt1.format(arg1) : "null");
@@ -43,9 +46,12 @@
// Decide how to order the inserts.
// Tests are biased toward $1..$2 order.
//
- String insert1 = (argIndices[0] == 0) ? stringArg1 : ((argIndices[0] == 1) ? stringArg2 : stringArg3);
- String insert2 = (argIndices[1] == 1) ? stringArg2 : ((argIndices[1] == 0) ? stringArg1 : stringArg3);
- String insert3 = (argIndices[2] == 2) ? stringArg3 : ((argIndices[2] == 0) ? stringArg1 : stringArg2);
+ String insert1 = (argIndices[0] == 0) ? stringArg1 : ((argIndices[0] == 1)
+ ? stringArg2 : stringArg3);
+ String insert2 = (argIndices[1] == 1) ? stringArg2 : ((argIndices[1] == 0)
+ ? stringArg1 : stringArg3);
+ String insert3 = (argIndices[2] == 2) ? stringArg3 : ((argIndices[2] == 0)
+ ? stringArg1 : stringArg2);
// Cache the length of the inserts.
//
@@ -59,7 +65,7 @@
int lenPart1 = fmtParts[1].length;
int lenPart2 = fmtParts[2].length;
int lenPart3 = fmtParts[3].length;
-
+
// Prep for copying.
//
int dest = 0;
@@ -68,27 +74,27 @@
// literal + insert, part 0
System.arraycopy(fmtParts[0], 0, chars, dest, lenPart0);
dest += lenPart0;
-
- insert1.getChars(0, lenInsert1, chars, dest);
+
+ insert1.getChars(0, lenInsert1, chars, dest);
dest += lenInsert1;
// literal + insert, part 1
System.arraycopy(fmtParts[1], 0, chars, dest, lenPart1);
dest += lenPart1;
-
- insert2.getChars(0, lenInsert2, chars, dest);
+
+ insert2.getChars(0, lenInsert2, chars, dest);
dest += lenInsert2;
-
+
// literal + insert, part 2
System.arraycopy(fmtParts[2], 0, chars, dest, lenPart2);
dest += lenPart2;
-
- insert3.getChars(0, lenInsert3, chars, dest);
+
+ insert3.getChars(0, lenInsert3, chars, dest);
dest += lenInsert3;
// final literal
System.arraycopy(fmtParts[3], 0, chars, dest, lenPart3);
-
+
return new String(chars);
}
diff --git a/dev/core/src/com/google/gwt/dev/util/msg/Message3IntMethodString.java b/dev/core/src/com/google/gwt/dev/util/msg/Message3IntMethodString.java
index e733054..fc6c7e4 100644
--- a/dev/core/src/com/google/gwt/dev/util/msg/Message3IntMethodString.java
+++ b/dev/core/src/com/google/gwt/dev/util/msg/Message3IntMethodString.java
@@ -20,6 +20,9 @@
import java.lang.reflect.Method;
+/**
+ * Integer, Method, & String message.
+ */
public final class Message3IntMethodString extends Message3 {
public Message3IntMethodString(Type type, String fmt) {
@@ -30,13 +33,13 @@
Throwable caught) {
Integer xi = new Integer(x);
return branch3(logger, xi, m, s, getFormatter(xi), getFormatter(m),
- getFormatter(s), caught);
+ getFormatter(s), caught);
}
public void log(TreeLogger logger, int x, Method m, String s, Throwable caught) {
Integer xi = new Integer(x);
log3(logger, xi, m, s, getFormatter(xi), getFormatter(m), getFormatter(s),
- caught);
+ caught);
}
}
diff --git a/dev/core/src/com/google/gwt/dev/util/msg/Message3IntStringClass.java b/dev/core/src/com/google/gwt/dev/util/msg/Message3IntStringClass.java
index d77cafe..d107941 100644
--- a/dev/core/src/com/google/gwt/dev/util/msg/Message3IntStringClass.java
+++ b/dev/core/src/com/google/gwt/dev/util/msg/Message3IntStringClass.java
@@ -18,6 +18,9 @@
import com.google.gwt.core.ext.TreeLogger;
import com.google.gwt.core.ext.TreeLogger.Type;
+/**
+ * Integer, String & Class message.
+ */
public final class Message3IntStringClass extends Message3 {
public Message3IntStringClass(Type type, String fmt) {
@@ -28,12 +31,12 @@
Throwable caught) {
Integer xi = new Integer(x);
return branch3(logger, xi, s, c, getFormatter(xi), getFormatter(s),
- getFormatter(c), caught);
+ getFormatter(c), caught);
}
public void log(TreeLogger logger, int x, String s, Class c, Throwable caught) {
Integer xi = new Integer(x);
log3(logger, xi, s, c, getFormatter(xi), getFormatter(s), getFormatter(c),
- caught);
+ caught);
}
}
diff --git a/dev/core/src/com/google/gwt/dev/util/msg/Message3IntStringString.java b/dev/core/src/com/google/gwt/dev/util/msg/Message3IntStringString.java
index e78c750..3cfb96d 100644
--- a/dev/core/src/com/google/gwt/dev/util/msg/Message3IntStringString.java
+++ b/dev/core/src/com/google/gwt/dev/util/msg/Message3IntStringString.java
@@ -18,6 +18,9 @@
import com.google.gwt.core.ext.TreeLogger;
import com.google.gwt.core.ext.TreeLogger.Type;
+/**
+ * Integer, String, & String message.
+ */
public final class Message3IntStringString extends Message3 {
public Message3IntStringString(Type type, String fmt) {
@@ -28,13 +31,13 @@
Throwable caught) {
Integer xi = new Integer(x);
return branch3(logger, xi, s1, s2, getFormatter(xi), getFormatter(s1),
- getFormatter(s2), caught);
+ getFormatter(s2), caught);
}
public void log(TreeLogger logger, int x, String s1, String s2,
Throwable caught) {
Integer xi = new Integer(x);
log3(logger, xi, s1, s2, getFormatter(xi), getFormatter(s1),
- getFormatter(s2), caught);
+ getFormatter(s2), caught);
}
}
diff --git a/dev/core/src/com/google/gwt/dev/util/msg/Message3StringIntString.java b/dev/core/src/com/google/gwt/dev/util/msg/Message3StringIntString.java
index bf388e1..fdee544 100644
--- a/dev/core/src/com/google/gwt/dev/util/msg/Message3StringIntString.java
+++ b/dev/core/src/com/google/gwt/dev/util/msg/Message3StringIntString.java
@@ -18,6 +18,9 @@
import com.google.gwt.core.ext.TreeLogger;
import com.google.gwt.core.ext.TreeLogger.Type;
+/**
+ * String, Integer, & String message.
+ */
public final class Message3StringIntString extends Message3 {
public Message3StringIntString(Type type, String fmt) {
@@ -28,14 +31,14 @@
Throwable caught) {
Integer xi = new Integer(x);
return branch3(logger, s1, xi, s2, getFormatter(s1), getFormatter(xi),
- getFormatter(s2), caught);
+ getFormatter(s2), caught);
}
public void log(TreeLogger logger, String s1, int x, String s2,
Throwable caught) {
Integer xi = new Integer(x);
log3(logger, s1, xi, s2, getFormatter(s1), getFormatter(xi),
- getFormatter(s2), caught);
+ getFormatter(s2), caught);
}
}
diff --git a/dev/core/src/com/google/gwt/dev/util/xml/DefaultSchema.java b/dev/core/src/com/google/gwt/dev/util/xml/DefaultSchema.java
index 1765a43..d5d8594 100644
--- a/dev/core/src/com/google/gwt/dev/util/xml/DefaultSchema.java
+++ b/dev/core/src/com/google/gwt/dev/util/xml/DefaultSchema.java
@@ -22,6 +22,8 @@
public class DefaultSchema extends Schema {
+ private final TreeLogger logger;
+
public DefaultSchema(TreeLogger logger) {
this.logger = logger;
@@ -29,18 +31,18 @@
//
registerAttributeConverter(int.class, new AttributeConverterForInteger());
registerAttributeConverter(Integer.class,
- new AttributeConverterForInteger());
+ new AttributeConverterForInteger());
registerAttributeConverter(String.class, new AttributeConverterForString());
registerAttributeConverter(boolean.class,
- new AttributeConverterForBoolean());
+ new AttributeConverterForBoolean());
registerAttributeConverter(Boolean.class,
- new AttributeConverterForBoolean());
+ new AttributeConverterForBoolean());
}
public void onBadAttributeValue(int line, String elem, String attr,
String value, Class paramType) throws UnableToCompleteException {
Messages.XML_ATTRIBUTE_CONVERSION_ERROR.log(logger, line, attr, paramType,
- null);
+ null);
throw new UnableToCompleteException();
}
@@ -52,8 +54,7 @@
public void onMissingAttribute(int line, String elem, String attr)
throws UnableToCompleteException {
- Messages.XML_REQUIRED_ATTRIBUTE_MISSING
- .log(logger, elem, line, attr, null);
+ Messages.XML_REQUIRED_ATTRIBUTE_MISSING.log(logger, elem, line, attr, null);
throw new UnableToCompleteException();
}
@@ -74,6 +75,4 @@
Messages.XML_ELEMENT_UNEXPECTED.log(logger, line, elem, null);
throw new UnableToCompleteException();
}
-
- private final TreeLogger logger;
}
diff --git a/dev/core/src/com/google/gwt/dev/util/xml/HandlerArgs.java b/dev/core/src/com/google/gwt/dev/util/xml/HandlerArgs.java
index 6b3cb02..3cafa9a 100644
--- a/dev/core/src/com/google/gwt/dev/util/xml/HandlerArgs.java
+++ b/dev/core/src/com/google/gwt/dev/util/xml/HandlerArgs.java
@@ -23,6 +23,19 @@
*/
public class HandlerArgs {
+ // The real (non-normalized) names of the attributes, used to report errors.
+ private final String[] attrNames;
+
+ private final String[] argValues;
+
+ private final HandlerParam[] handlerParams;
+
+ private final int lineNumber;
+
+ private final Schema schema;
+
+ private final String elemName;
+
public HandlerArgs(Schema schema, int lineNumber, String elemName,
HandlerParam[] handlerParams) {
this.schema = schema;
@@ -40,19 +53,17 @@
}
/**
- * @return
- * the argument converted to a form that is expected to compatible with
- * the associated parameter and will work for a reflection "invoke()" call
- * @throws UnableToCompleteException
- * if the argument could not be converted
+ * @return the argument converted to a form that is expected to compatible
+ * with the associated parameter and will work for a reflection
+ * "invoke()" call
+ * @throws UnableToCompleteException if the argument could not be converted
*/
public Object convertToArg(int i) throws UnableToCompleteException {
String value = argValues[i];
if (value != null) {
- AttributeConverter converter = schema
- .getAttributeConverter(handlerParams[i].getParamType());
- return converter.convertToArg(schema, lineNumber, elemName,
- attrNames[i], value);
+ AttributeConverter converter = schema.getAttributeConverter(handlerParams[i].getParamType());
+ return converter.convertToArg(schema, lineNumber, elemName, attrNames[i],
+ value);
} else {
return new NullPointerException("Argument " + i + " was null");
}
@@ -75,9 +86,8 @@
}
/**
- * @return
- * <code>true</code> if the param for the specified attribute was set;
- * <code>false</code> if no matching param was found
+ * @return <code>true</code> if the param for the specified attribute was
+ * set; <code>false</code> if no matching param was found
*/
public boolean setArg(String attrName, String attrValue) {
String normalizedAttrName = normalizeAttrName(attrName);
@@ -97,17 +107,4 @@
// NOTE: this is where other characters would be folded to '_'.
return attrName.replace('-', '_');
}
-
- // The real (non-normalized) names of the attributes, used to report errors.
- private final String[] attrNames;
-
- private final String[] argValues;
-
- private final HandlerParam[] handlerParams;
-
- private final int lineNumber;
-
- private final Schema schema;
-
- private final String elemName;
}
diff --git a/dev/core/src/com/google/gwt/dev/util/xml/HandlerClassInfo.java b/dev/core/src/com/google/gwt/dev/util/xml/HandlerClassInfo.java
index fbafd2d..5aa0e38 100644
--- a/dev/core/src/com/google/gwt/dev/util/xml/HandlerClassInfo.java
+++ b/dev/core/src/com/google/gwt/dev/util/xml/HandlerClassInfo.java
@@ -23,6 +23,15 @@
private static final HandlerMethod[] EMPTY_ARRAY_HANDLERMETHOD = new HandlerMethod[0];
private static Map sClassInfoMap = new HashMap();
+ public static synchronized HandlerClassInfo getClassInfo(Class c) {
+ if (sClassInfoMap.containsKey(c)) {
+ return (HandlerClassInfo) sClassInfoMap.get(c);
+ } else {
+ throw new RuntimeException("The schema class '" + c.getName()
+ + "' should have been registered prior to parsing");
+ }
+ }
+
public static synchronized void registerClass(Class c) {
if (sClassInfoMap.containsKey(c)) {
return;
@@ -36,22 +45,13 @@
sClassInfoMap.put(c, classInfo);
}
- public static synchronized HandlerClassInfo getClassInfo(Class c) {
- if (sClassInfoMap.containsKey(c)) {
- return (HandlerClassInfo) sClassInfoMap.get(c);
- } else {
- throw new RuntimeException("The schema class '" + c.getName()
- + "' should have been registered prior to parsing");
- }
- }
-
private static HandlerClassInfo createClassInfo(Class c) {
Map namedHandlerMethods = new HashMap();
try {
loadClassInfoRecursive(namedHandlerMethods, c);
} catch (Exception e) {
throw new RuntimeException("Unable to use class '" + c.getName()
- + "' as a handler", e);
+ + "' as a handler", e);
}
HandlerClassInfo classInfo = new HandlerClassInfo(namedHandlerMethods);
return classInfo;
@@ -87,26 +87,26 @@
}
}
+ private final Map namedHandlerMethods;
+
// Nobody else can create one.
private HandlerClassInfo(Map namedHandlerMethods) {
this.namedHandlerMethods = namedHandlerMethods;
}
- public HandlerMethod getStartMethod(String localName) {
- String methodName = "__" + localName.replace('-', '_');
- return (HandlerMethod) namedHandlerMethods.get(methodName + "_begin");
- }
-
public HandlerMethod getEndMethod(String localName) {
String methodName = "__" + localName.replace('-', '_');
return (HandlerMethod) namedHandlerMethods.get(methodName + "_end");
}
- private final Map namedHandlerMethods;
-
public HandlerMethod[] getHandlerMethods() {
return (HandlerMethod[]) namedHandlerMethods.values().toArray(
- EMPTY_ARRAY_HANDLERMETHOD);
+ EMPTY_ARRAY_HANDLERMETHOD);
+ }
+
+ public HandlerMethod getStartMethod(String localName) {
+ String methodName = "__" + localName.replace('-', '_');
+ return (HandlerMethod) namedHandlerMethods.get(methodName + "_begin");
}
public HandlerMethod getTextMethod() {
diff --git a/dev/core/src/com/google/gwt/dev/util/xml/HandlerMethod.java b/dev/core/src/com/google/gwt/dev/util/xml/HandlerMethod.java
index 55d1749..4a49663 100644
--- a/dev/core/src/com/google/gwt/dev/util/xml/HandlerMethod.java
+++ b/dev/core/src/com/google/gwt/dev/util/xml/HandlerMethod.java
@@ -63,6 +63,10 @@
private static final int TYPE_END = 2;
private static final int TYPE_TEXT = 3;
+ static {
+ ReflectiveParser.registerSchemaLevel(sArbitraryChildHandler.getClass());
+ }
+
/**
* Attempts to create a handler method from any method. You can pass in any
* method at all, but an exception will be thrown if the method is clearly a
@@ -79,11 +83,11 @@
if (methodName.endsWith("_begin")) {
type = TYPE_BEGIN;
normalizedTagName = methodName.substring(0, methodName.length()
- - "_begin".length());
+ - "_begin".length());
} else if (methodName.endsWith("_end")) {
type = TYPE_END;
normalizedTagName = methodName.substring(0, methodName.length()
- - "_end".length());
+ - "_end".length());
} else if (methodName.equals("__text")) {
type = TYPE_TEXT;
}
@@ -114,11 +118,11 @@
arbitraryChildren = true;
} else {
throw new IllegalArgumentException(
- "The return type of begin handlers must be 'void' or assignable to 'SchemaLevel'");
+ "The return type of begin handlers must be 'void' or assignable to 'SchemaLevel'");
}
} else if (!Void.TYPE.equals(returnType)) {
throw new IllegalArgumentException(
- "Only 'void' may be specified as a return type for 'end' and 'text' handlers");
+ "Only 'void' may be specified as a return type for 'end' and 'text' handlers");
}
// Create handler args.
@@ -127,7 +131,7 @@
Class[] paramTypes = method.getParameterTypes();
if (paramTypes.length != 1 || !String.class.equals(paramTypes[0])) {
throw new IllegalArgumentException(
- "__text handlers must have exactly one String parameter");
+ "__text handlers must have exactly one String parameter");
}
// We pretend it doesn't have any param since they're always
@@ -139,25 +143,32 @@
List handlerParams = new ArrayList();
for (int i = 0, n = paramTypes.length; i < n; ++i) {
HandlerParam handlerParam = HandlerParam.create(method,
- normalizedTagName, i);
+ normalizedTagName, i);
if (handlerParam != null) {
handlerParams.add(handlerParam);
} else {
throw new IllegalArgumentException("In method '" + method.getName()
- + "', parameter " + (i + 1) + " is an unsupported type");
+ + "', parameter " + (i + 1) + " is an unsupported type");
}
}
- HandlerParam[] hpa = (HandlerParam[]) handlerParams
- .toArray(EMPTY_HANDLERPARAMS);
+ HandlerParam[] hpa = (HandlerParam[]) handlerParams.toArray(EMPTY_HANDLERPARAMS);
return new HandlerMethod(method, type, arbitraryChildren, hpa);
}
} catch (Exception e) {
throw new RuntimeException("Unable to use method '" + methodName
- + "' as a handler", e);
+ + "' as a handler", e);
}
}
+ private final boolean arbitraryChildren;
+
+ private final HandlerParam[] handlerParams;
+
+ private final Method method;
+
+ private final int methodType;
+
private HandlerMethod(Method method, int type, boolean arbitraryChildren,
HandlerParam[] hpa) {
this.method = method;
@@ -191,23 +202,6 @@
return handlerParams.length;
}
- public void invokeText(int lineNumber, String text, Schema target)
- throws UnableToCompleteException {
- Throwable caught = null;
- try {
- target.setLineNumber(lineNumber);
- method.invoke(target, new Object[]{text});
- return;
- } catch (IllegalArgumentException e) {
- caught = e;
- } catch (IllegalAccessException e) {
- caught = e;
- } catch (InvocationTargetException e) {
- caught = e.getTargetException();
- }
- target.onHandlerException(lineNumber, "#text", method, caught);
- }
-
public Schema invokeBegin(int lineNumber, String elemLocalName,
Schema target, HandlerArgs args, Object[] outInvokeArgs)
throws UnableToCompleteException {
@@ -277,6 +271,23 @@
target.onHandlerException(lineNumber, elem, method, caught);
}
+ public void invokeText(int lineNumber, String text, Schema target)
+ throws UnableToCompleteException {
+ Throwable caught = null;
+ try {
+ target.setLineNumber(lineNumber);
+ method.invoke(target, new Object[] {text});
+ return;
+ } catch (IllegalArgumentException e) {
+ caught = e;
+ } catch (IllegalAccessException e) {
+ caught = e;
+ } catch (InvocationTargetException e) {
+ caught = e.getTargetException();
+ }
+ target.onHandlerException(lineNumber, "#text", method, caught);
+ }
+
public boolean isEndMethod() {
return methodType == TYPE_END;
}
@@ -284,13 +295,4 @@
public boolean isStartMethod() {
return methodType == TYPE_BEGIN;
}
-
- static {
- ReflectiveParser.registerSchemaLevel(sArbitraryChildHandler.getClass());
- }
-
- private final boolean arbitraryChildren;
- private final HandlerParam[] handlerParams;
- private final Method method;
- private final int methodType;
}
diff --git a/dev/core/src/com/google/gwt/dev/util/xml/HandlerParam.java b/dev/core/src/com/google/gwt/dev/util/xml/HandlerParam.java
index 3e50bee..f9f0065 100644
--- a/dev/core/src/com/google/gwt/dev/util/xml/HandlerParam.java
+++ b/dev/core/src/com/google/gwt/dev/util/xml/HandlerParam.java
@@ -41,7 +41,7 @@
if (matchingField == null) {
throw new IllegalArgumentException("Expecting a meta field with prefix '"
- + fieldNamePrefix + "'");
+ + fieldNamePrefix + "'");
}
int under = fieldName.indexOf("_", fieldNamePrefix.length());
@@ -49,8 +49,8 @@
// Not a valid signature.
//
throw new IllegalArgumentException(
- "Expecting a normalized attribute name suffix (e.g. \"_attr_name\") on field '"
- + fieldName + "'");
+ "Expecting a normalized attribute name suffix (e.g. \"_attr_name\") on field '"
+ + fieldName + "'");
}
// Infer the associated attribute name.
@@ -63,17 +63,23 @@
// Type mismatch.
//
throw new IllegalArgumentException("GWT field '" + fieldName
- + "' must be of type String");
+ + "' must be of type String");
}
// Instantiate one.
//
matchingField.setAccessible(true);
HandlerParam handlerParam = new HandlerParam(paramType, matchingField,
- normalizedAttrName);
+ normalizedAttrName);
return handlerParam;
}
+ private final Class paramType;
+
+ private final Field metaField;
+
+ private final String normalizedAttrName;
+
private HandlerParam(Class paramType, Field metaField,
String normalizedAttrName) {
this.paramType = paramType;
@@ -82,7 +88,7 @@
}
/**
- * Called while parsing to get the default value for an attribute.
+ * Called while parsing to get the default value for an attribute.
*/
public String getDefaultValue(Schema schema) {
Throwable caught = null;
@@ -98,9 +104,9 @@
// which forces us to use this incantation. See the top of
// {@link java.lang.Throwable} for details.
//
- throw (IllegalStateException)new IllegalStateException(
- "Unable to get attribute default value from meta field '"
- + metaField.getName() + "'").initCause(caught);
+ throw (IllegalStateException) new IllegalStateException(
+ "Unable to get attribute default value from meta field '"
+ + metaField.getName() + "'").initCause(caught);
}
public String getNormalizedName() {
@@ -110,8 +116,4 @@
public Class getParamType() {
return paramType;
}
-
- private final Class paramType;
- private final Field metaField;
- private final String normalizedAttrName;
}
diff --git a/dev/core/src/com/google/gwt/dev/util/xml/Messages.java b/dev/core/src/com/google/gwt/dev/util/xml/Messages.java
index 6580aa2..148b30b 100644
--- a/dev/core/src/com/google/gwt/dev/util/xml/Messages.java
+++ b/dev/core/src/com/google/gwt/dev/util/xml/Messages.java
@@ -22,29 +22,36 @@
import com.google.gwt.dev.util.msg.Message3IntStringClass;
import com.google.gwt.dev.util.msg.Message3StringIntString;
+/**
+ * Static XML messages.
+ */
class Messages {
- private Messages() {
- }
-
public static final Message3IntStringClass XML_ATTRIBUTE_CONVERSION_ERROR = new Message3IntStringClass(
- TreeLogger.ERROR, "Line $0: Unable to convert attribute '$1' to type '$2'");
+ TreeLogger.ERROR,
+ "Line $0: Unable to convert attribute '$1' to type '$2'");
public static final Message3StringIntString XML_ATTRIBUTE_UNEXPECTED = new Message3StringIntString(
- TreeLogger.ERROR, "Element '$0' beginning on line $1 contains unexpected attribute '$2'");
+ TreeLogger.ERROR,
+ "Element '$0' beginning on line $1 contains unexpected attribute '$2'");
public static final Message2StringInt XML_CHILDREN_NOT_ALLOWED = new Message2StringInt(
- TreeLogger.ERROR, "Child element $0 on line $1 is not allowed");
+ TreeLogger.ERROR, "Child element $0 on line $1 is not allowed");
public static final Message2IntString XML_ELEMENT_HANDLER_EXCEPTION = new Message2IntString(
- TreeLogger.ERROR, "Line $0: Unexpected exception while processing element '$1'");
+ TreeLogger.ERROR,
+ "Line $0: Unexpected exception while processing element '$1'");
public static final Message2IntString XML_ELEMENT_UNEXPECTED = new Message2IntString(
- TreeLogger.ERROR, "Line $0: Unexpected element '$1'");
+ TreeLogger.ERROR, "Line $0: Unexpected element '$1'");
- public static final Message0 XML_PARSE_FAILED = new Message0(TreeLogger.ERROR,
- "Failure while parsing XML");
+ public static final Message0 XML_PARSE_FAILED = new Message0(
+ TreeLogger.ERROR, "Failure while parsing XML");
public static final Message3StringIntString XML_REQUIRED_ATTRIBUTE_MISSING = new Message3StringIntString(
- TreeLogger.ERROR, "Element '$0' beginning on line $1 is missing required attribute '$2'");
+ TreeLogger.ERROR,
+ "Element '$0' beginning on line $1 is missing required attribute '$2'");
+
+ private Messages() {
+ }
}
diff --git a/dev/core/src/com/google/gwt/dev/util/xml/ReflectiveParser.java b/dev/core/src/com/google/gwt/dev/util/xml/ReflectiveParser.java
index 7903c39..5c31158 100644
--- a/dev/core/src/com/google/gwt/dev/util/xml/ReflectiveParser.java
+++ b/dev/core/src/com/google/gwt/dev/util/xml/ReflectiveParser.java
@@ -47,6 +47,16 @@
private static final class Impl extends DefaultHandler {
+ private Locator locator;
+
+ private Reader reader;
+
+ private Stack schemaLevels = new Stack();
+
+ private Stack argStack = new Stack();
+
+ private Schema defaultSchema;
+
public void characters(char[] ch, int start, int length)
throws SAXException {
int lineNumber = locator.getLineNumber();
@@ -184,7 +194,7 @@
//
try {
schemaLevel.onUnexpectedAttribute(lineNumber, elemName, attrName,
- attrValue);
+ attrValue);
} catch (UnableToCompleteException e) {
throw new SAXException(e);
}
@@ -200,8 +210,8 @@
// It might throw, but it also might not.
//
try {
- schemaLevel.onMissingAttribute(lineNumber, elemName, args
- .getArgName(i));
+ schemaLevel.onMissingAttribute(lineNumber, elemName,
+ args.getArgName(i));
} catch (UnableToCompleteException e) {
throw new SAXException(e);
}
@@ -230,7 +240,7 @@
Schema childSchemaLevel;
try {
childSchemaLevel = method.invokeBegin(lineNumber, elemName,
- schemaLevel, args, invokeArgs);
+ schemaLevel, args, invokeArgs);
} catch (UnableToCompleteException e) {
throw new SAXException(e);
}
@@ -242,6 +252,10 @@
setArgsAndPushLevel(invokeArgs, childSchemaLevel);
}
+ private Object[] getCurrentArgs() {
+ return (Object[]) argStack.peek();
+ }
+
private Schema getNextToTopSchemaLevel() {
return (Schema) schemaLevels.get(schemaLevels.size() - 2);
}
@@ -250,10 +264,6 @@
return (Schema) schemaLevels.peek();
}
- private Object[] getCurrentArgs() {
- return (Object[]) argStack.peek();
- }
-
private void parse(TreeLogger logger, Schema topSchema, Reader reader)
throws UnableToCompleteException {
// Set up the parentmost schema which is used to find default converters
@@ -341,12 +351,6 @@
// The schema for children.
schemaLevels.push(schemaLevel);
}
-
- private Locator locator;
- private Reader reader;
- private Stack schemaLevels = new Stack();
- private Stack argStack = new Stack();
- private Schema defaultSchema;
}
public static void parse(TreeLogger logger, Schema schema, Reader reader)
diff --git a/dev/core/src/com/google/gwt/dev/util/xml/Schema.java b/dev/core/src/com/google/gwt/dev/util/xml/Schema.java
index bddc67d..bf9d044 100644
--- a/dev/core/src/com/google/gwt/dev/util/xml/Schema.java
+++ b/dev/core/src/com/google/gwt/dev/util/xml/Schema.java
@@ -21,15 +21,23 @@
import java.util.HashMap;
import java.util.Map;
+/**
+ * Abstract base class for reflection-based push-parsing of XML.
+ */
public abstract class Schema {
+ private final Map convertersByType = new HashMap();
+
+ private Schema parent;
+
+ private int lineNumber;
+
/**
* Finds the most recent converter in the schema chain that can convert the
* specified type.
*/
public AttributeConverter getAttributeConverter(Class type) {
- AttributeConverter converter = (AttributeConverter) convertersByType
- .get(type);
+ AttributeConverter converter = (AttributeConverter) convertersByType.get(type);
if (converter != null) {
return converter;
} else if (parent != null) {
@@ -37,7 +45,7 @@
}
throw new IllegalStateException(
- "Unable to find an attribute converter for type " + type.getName());
+ "Unable to find an attribute converter for type " + type.getName());
}
public int getLineNumber() {
@@ -98,8 +106,4 @@
public void setParent(Schema parent) {
this.parent = parent;
}
-
- private final Map convertersByType = new HashMap();
- private Schema parent;
- private int lineNumber;
}
diff --git a/dev/core/src/com/google/gwt/util/tools/ArgHandlerExtra.java b/dev/core/src/com/google/gwt/util/tools/ArgHandlerExtra.java
index 523dc3b..dbe1984 100644
--- a/dev/core/src/com/google/gwt/util/tools/ArgHandlerExtra.java
+++ b/dev/core/src/com/google/gwt/util/tools/ArgHandlerExtra.java
@@ -20,6 +20,8 @@
*/
public abstract class ArgHandlerExtra extends ArgHandler {
+ public abstract boolean addExtraArg(String arg);
+
public String[] getDefaultArgs() {
return null;
}
@@ -40,6 +42,4 @@
return false;
}
- public abstract boolean addExtraArg(String arg);
-
}
diff --git a/dev/core/src/com/google/gwt/util/tools/ArgHandlerOutDir.java b/dev/core/src/com/google/gwt/util/tools/ArgHandlerOutDir.java
index 1c10b71..ea4f7a9 100644
--- a/dev/core/src/com/google/gwt/util/tools/ArgHandlerOutDir.java
+++ b/dev/core/src/com/google/gwt/util/tools/ArgHandlerOutDir.java
@@ -20,6 +20,10 @@
*/
public abstract class ArgHandlerOutDir extends ArgHandlerDir {
+ public String[] getDefaultArgs() {
+ return new String[] {"-out", System.getProperty("user.dir")};
+ }
+
public String getPurpose() {
return "The directory to write output files into (defaults to current)";
}
@@ -28,8 +32,4 @@
return "-out";
}
- public String[] getDefaultArgs() {
- return new String[]{"-out", System.getProperty("user.dir")};
- }
-
}
diff --git a/dev/core/src/com/google/gwt/util/tools/ToolBase.java b/dev/core/src/com/google/gwt/util/tools/ToolBase.java
index 8d846e3..f1f5376 100644
--- a/dev/core/src/com/google/gwt/util/tools/ToolBase.java
+++ b/dev/core/src/com/google/gwt/util/tools/ToolBase.java
@@ -51,6 +51,25 @@
*/
public abstract class ToolBase {
+ static {
+ String installPath = Utility.getInstallPath();
+ try {
+ // try to make absolute
+ installPath = new File(installPath).getCanonicalPath();
+ } catch (IOException e) {
+ // ignore problems, failures will occur when the libs try to load
+ }
+ System.setProperty("swt.library.path", installPath + '/');
+ }
+
+ // Use a tree map to sort the order.
+ //
+ private final Map argHandlers = new TreeMap();
+
+ // Use a list to preserve the declared order for help printing.
+ //
+ private final List orderedArgHandlers = new ArrayList();
+
protected void printHelp() {
System.err.println(About.GWT_VERSION);
@@ -271,23 +290,4 @@
orderedArgHandlers.add(handler);
argHandlers.put(tag != null ? tag : "", handler);
}
-
- static {
- String installPath = Utility.getInstallPath();
- try {
- // try to make absolute
- installPath = new File(installPath).getCanonicalPath();
- } catch (IOException e) {
- // ignore problems, failures will occur when the libs try to load
- }
- System.setProperty("swt.library.path", installPath + '/');
- }
-
- // Use a tree map to sort the order.
- //
- private final Map argHandlers = new TreeMap();
-
- // Use a list to preserve the declared order for help printing.
- //
- private final List orderedArgHandlers = new ArrayList();
}