checkstyle partial pass.
git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@11 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/dev/core/src/com/google/gwt/dev/util/xml/AttributeConverter.java b/dev/core/src/com/google/gwt/dev/util/xml/AttributeConverter.java
index c665dd7..bcaeb8b 100644
--- a/dev/core/src/com/google/gwt/dev/util/xml/AttributeConverter.java
+++ b/dev/core/src/com/google/gwt/dev/util/xml/AttributeConverter.java
@@ -1,4 +1,18 @@
-// Copyright 2006 Google Inc. All Rights Reserved.
+/*
+ * Copyright 2006 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
package com.google.gwt.dev.util.xml;
import com.google.gwt.core.ext.UnableToCompleteException;
@@ -10,7 +24,7 @@
/**
* Converts from a string to the type needed.
* Does not throw conversion-related exceptions.
- * @param attrValue
+ * @param value
* the value to convert
* @param schema
* used to report conversion problems
diff --git a/dev/core/src/com/google/gwt/dev/util/xml/AttributeConverterForBoolean.java b/dev/core/src/com/google/gwt/dev/util/xml/AttributeConverterForBoolean.java
index 11356c6..a54f1db 100644
--- a/dev/core/src/com/google/gwt/dev/util/xml/AttributeConverterForBoolean.java
+++ b/dev/core/src/com/google/gwt/dev/util/xml/AttributeConverterForBoolean.java
@@ -1,4 +1,18 @@
-// Copyright 2006 Google Inc. All Rights Reserved.
+/*
+ * Copyright 2006 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
package com.google.gwt.dev.util.xml;
import com.google.gwt.core.ext.UnableToCompleteException;
diff --git a/dev/core/src/com/google/gwt/dev/util/xml/AttributeConverterForInteger.java b/dev/core/src/com/google/gwt/dev/util/xml/AttributeConverterForInteger.java
index 853e7ef..562f3d5 100644
--- a/dev/core/src/com/google/gwt/dev/util/xml/AttributeConverterForInteger.java
+++ b/dev/core/src/com/google/gwt/dev/util/xml/AttributeConverterForInteger.java
@@ -1,4 +1,18 @@
-// Copyright 2006 Google Inc. All Rights Reserved.
+/*
+ * Copyright 2006 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
package com.google.gwt.dev.util.xml;
import com.google.gwt.core.ext.UnableToCompleteException;
diff --git a/dev/core/src/com/google/gwt/dev/util/xml/AttributeConverterForString.java b/dev/core/src/com/google/gwt/dev/util/xml/AttributeConverterForString.java
index ad93198..936e449 100644
--- a/dev/core/src/com/google/gwt/dev/util/xml/AttributeConverterForString.java
+++ b/dev/core/src/com/google/gwt/dev/util/xml/AttributeConverterForString.java
@@ -1,4 +1,18 @@
-// Copyright 2006 Google Inc. All Rights Reserved.
+/*
+ * Copyright 2006 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
package com.google.gwt.dev.util.xml;
/**
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 7dc1440..1765a43 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
@@ -1,4 +1,18 @@
-// Copyright 2006 Google Inc. All Rights Reserved.
+/*
+ * Copyright 2006 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
package com.google.gwt.dev.util.xml;
import com.google.gwt.core.ext.TreeLogger;
@@ -9,7 +23,7 @@
public class DefaultSchema extends Schema {
public DefaultSchema(TreeLogger logger) {
- fLogger = logger;
+ this.logger = logger;
// Registers converters for the typical primitive types.
//
@@ -25,41 +39,41 @@
public void onBadAttributeValue(int line, String elem, String attr,
String value, Class paramType) throws UnableToCompleteException {
- Messages.XML_ATTRIBUTE_CONVERSION_ERROR.log(fLogger, line, attr, paramType,
+ Messages.XML_ATTRIBUTE_CONVERSION_ERROR.log(logger, line, attr, paramType,
null);
throw new UnableToCompleteException();
}
public void onHandlerException(int line, String elem, Method method,
Throwable e) throws UnableToCompleteException {
- Messages.XML_ELEMENT_HANDLER_EXCEPTION.log(fLogger, line, elem, e);
+ Messages.XML_ELEMENT_HANDLER_EXCEPTION.log(logger, line, elem, e);
throw new UnableToCompleteException();
}
public void onMissingAttribute(int line, String elem, String attr)
throws UnableToCompleteException {
Messages.XML_REQUIRED_ATTRIBUTE_MISSING
- .log(fLogger, elem, line, attr, null);
+ .log(logger, elem, line, attr, null);
throw new UnableToCompleteException();
}
public void onUnexpectedAttribute(int line, String elem, String attr,
String value) throws UnableToCompleteException {
- Messages.XML_ATTRIBUTE_UNEXPECTED.log(fLogger, elem, line, attr, null);
+ Messages.XML_ATTRIBUTE_UNEXPECTED.log(logger, elem, line, attr, null);
throw new UnableToCompleteException();
}
public void onUnexpectedChild(int line, String childElem)
throws UnableToCompleteException {
- Messages.XML_CHILDREN_NOT_ALLOWED.log(fLogger, childElem, line, null);
+ Messages.XML_CHILDREN_NOT_ALLOWED.log(logger, childElem, line, null);
throw new UnableToCompleteException();
}
public void onUnexpectedElement(int line, String elem)
throws UnableToCompleteException {
- Messages.XML_ELEMENT_UNEXPECTED.log(fLogger, line, elem, null);
+ Messages.XML_ELEMENT_UNEXPECTED.log(logger, line, elem, null);
throw new UnableToCompleteException();
}
- private final TreeLogger fLogger;
+ 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 7605677..6b3cb02 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
@@ -1,4 +1,18 @@
-// Copyright 2006 Google Inc. All Rights Reserved.
+/*
+ * Copyright 2006 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
package com.google.gwt.dev.util.xml;
import com.google.gwt.core.ext.UnableToCompleteException;
@@ -11,17 +25,17 @@
public HandlerArgs(Schema schema, int lineNumber, String elemName,
HandlerParam[] handlerParams) {
- fSchema = schema;
- fLineNumber = lineNumber;
- fElemName = elemName;
- fHandlerParams = handlerParams;
- fAttrNames = new String[handlerParams.length];
- fArgValues = new String[handlerParams.length];
+ this.schema = schema;
+ this.lineNumber = lineNumber;
+ this.elemName = elemName;
+ this.handlerParams = handlerParams;
+ attrNames = new String[handlerParams.length];
+ argValues = new String[handlerParams.length];
// Set default values.
//
for (int i = 0, n = handlerParams.length; i < n; ++i) {
- fArgValues[i] = fHandlerParams[i].getDefaultValue(schema);
+ argValues[i] = this.handlerParams[i].getDefaultValue(schema);
}
}
@@ -33,27 +47,27 @@
* if the argument could not be converted
*/
public Object convertToArg(int i) throws UnableToCompleteException {
- String value = fArgValues[i];
+ String value = argValues[i];
if (value != null) {
- AttributeConverter converter = fSchema
- .getAttributeConverter(fHandlerParams[i].getParamType());
- return converter.convertToArg(fSchema, fLineNumber, fElemName,
- fAttrNames[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");
}
}
public int getArgCount() {
- return fHandlerParams.length;
+ return handlerParams.length;
}
public String getArgName(int i) {
- return fHandlerParams[i].getNormalizedName();
+ return handlerParams[i].getNormalizedName();
}
public boolean isArgSet(int i) {
- if (fArgValues[i] != null) {
+ if (argValues[i] != null) {
return true;
} else {
return false;
@@ -67,12 +81,12 @@
*/
public boolean setArg(String attrName, String attrValue) {
String normalizedAttrName = normalizeAttrName(attrName);
- for (int i = 0, n = fHandlerParams.length; i < n; ++i) {
- Object testParamName = fHandlerParams[i].getNormalizedName();
+ for (int i = 0, n = handlerParams.length; i < n; ++i) {
+ Object testParamName = handlerParams[i].getNormalizedName();
if (testParamName.equals(normalizedAttrName)) {
// Set it, but don't convert it yet.
- fAttrNames[i] = attrName;
- fArgValues[i] = attrValue;
+ attrNames[i] = attrName;
+ argValues[i] = attrValue;
return true;
}
}
@@ -85,15 +99,15 @@
}
// The real (non-normalized) names of the attributes, used to report errors.
- private final String[] fAttrNames;
+ private final String[] attrNames;
- private final String[] fArgValues;
+ private final String[] argValues;
- private final HandlerParam[] fHandlerParams;
+ private final HandlerParam[] handlerParams;
- private final int fLineNumber;
+ private final int lineNumber;
- private final Schema fSchema;
+ private final Schema schema;
- private final String fElemName;
+ 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 02e837b..fbafd2d 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
@@ -1,4 +1,18 @@
-// Copyright 2006 Google Inc. All Rights Reserved.
+/*
+ * Copyright 2006 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
package com.google.gwt.dev.util.xml;
import java.lang.reflect.Method;
@@ -10,8 +24,9 @@
private static Map sClassInfoMap = new HashMap();
public static synchronized void registerClass(Class c) {
- if (sClassInfoMap.containsKey(c))
+ if (sClassInfoMap.containsKey(c)) {
return;
+ }
// Put a guard null in so that recursive registration of the same
// class won't die.
@@ -22,11 +37,12 @@
}
public static synchronized HandlerClassInfo getClassInfo(Class c) {
- if (sClassInfoMap.containsKey(c))
+ if (sClassInfoMap.containsKey(c)) {
return (HandlerClassInfo) sClassInfoMap.get(c);
- else
+ } else {
throw new RuntimeException("The schema class '" + c.getName()
+ "' should have been registered prior to parsing");
+ }
}
private static HandlerClassInfo createClassInfo(Class c) {
@@ -57,41 +73,43 @@
// (Allows inheritance where most-derived class wins).
//
String name = method.getName();
- if (!namedHandlerMethods.containsKey(name))
+ if (!namedHandlerMethods.containsKey(name)) {
namedHandlerMethods.put(name, handlerMethod);
+ }
}
}
// Recurse into superclass.
//
Class superclass = c.getSuperclass();
- if (superclass != null)
+ if (superclass != null) {
loadClassInfoRecursive(namedHandlerMethods, superclass);
+ }
}
// Nobody else can create one.
private HandlerClassInfo(Map namedHandlerMethods) {
- fNamedHandlerMethods = namedHandlerMethods;
+ this.namedHandlerMethods = namedHandlerMethods;
}
public HandlerMethod getStartMethod(String localName) {
String methodName = "__" + localName.replace('-', '_');
- return (HandlerMethod) fNamedHandlerMethods.get(methodName + "_begin");
+ return (HandlerMethod) namedHandlerMethods.get(methodName + "_begin");
}
public HandlerMethod getEndMethod(String localName) {
String methodName = "__" + localName.replace('-', '_');
- return (HandlerMethod) fNamedHandlerMethods.get(methodName + "_end");
+ return (HandlerMethod) namedHandlerMethods.get(methodName + "_end");
}
- private final Map fNamedHandlerMethods;
+ private final Map namedHandlerMethods;
public HandlerMethod[] getHandlerMethods() {
- return (HandlerMethod[]) fNamedHandlerMethods.values().toArray(
+ return (HandlerMethod[]) namedHandlerMethods.values().toArray(
EMPTY_ARRAY_HANDLERMETHOD);
}
public HandlerMethod getTextMethod() {
- return (HandlerMethod) fNamedHandlerMethods.get("__text");
+ return (HandlerMethod) namedHandlerMethods.get("__text");
}
}
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 c4ffa6b..55d1749 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
@@ -1,4 +1,18 @@
-// Copyright 2006 Google Inc. All Rights Reserved.
+/*
+ * Copyright 2006 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
package com.google.gwt.dev.util.xml;
import com.google.gwt.core.ext.UnableToCompleteException;
@@ -146,34 +160,35 @@
private HandlerMethod(Method method, int type, boolean arbitraryChildren,
HandlerParam[] hpa) {
- fMethod = method;
- fMethodType = type;
- fArbitraryChildren = arbitraryChildren;
- fHandlerParams = (HandlerParam[]) hpa.clone();
+ this.method = method;
+ this.methodType = type;
+ this.arbitraryChildren = arbitraryChildren;
+ this.handlerParams = (HandlerParam[]) hpa.clone();
- fMethod.setAccessible(true);
+ this.method.setAccessible(true);
}
public HandlerArgs createArgs(Schema schema, int lineNumber, String elemName) {
- return new HandlerArgs(schema, lineNumber, elemName, fHandlerParams);
+ return new HandlerArgs(schema, lineNumber, elemName, handlerParams);
}
public String getNormalizedName() {
- String name = fMethod.getName();
- if (isStartMethod())
+ String name = method.getName();
+ if (isStartMethod()) {
return name.substring(2, name.length() - "_begin".length());
- else if (isEndMethod())
+ } else if (isEndMethod()) {
return name.substring(2, name.length() - "_end".length());
- else
+ } else {
throw new IllegalStateException("Unexpected method name");
+ }
}
public HandlerParam getParam(int i) {
- return fHandlerParams[i];
+ return handlerParams[i];
}
public int getParamCount() {
- return fHandlerParams.length;
+ return handlerParams.length;
}
public void invokeText(int lineNumber, String text, Schema target)
@@ -181,7 +196,7 @@
Throwable caught = null;
try {
target.setLineNumber(lineNumber);
- fMethod.invoke(target, new Object[]{text});
+ method.invoke(target, new Object[]{text});
return;
} catch (IllegalArgumentException e) {
caught = e;
@@ -190,7 +205,7 @@
} catch (InvocationTargetException e) {
caught = e.getTargetException();
}
- target.onHandlerException(lineNumber, "#text", fMethod, caught);
+ target.onHandlerException(lineNumber, "#text", method, caught);
}
public Schema invokeBegin(int lineNumber, String elemLocalName,
@@ -208,7 +223,7 @@
Throwable caught = null;
try {
target.setLineNumber(lineNumber);
- nextSchemaLevel = (Schema) fMethod.invoke(target, outInvokeArgs);
+ nextSchemaLevel = (Schema) method.invoke(target, outInvokeArgs);
} catch (IllegalArgumentException e) {
caught = e;
} catch (IllegalAccessException e) {
@@ -217,8 +232,9 @@
caught = e.getTargetException();
}
- if (caught != null)
- target.onHandlerException(lineNumber, elemLocalName, fMethod, caught);
+ if (caught != null) {
+ target.onHandlerException(lineNumber, elemLocalName, method, caught);
+ }
// Prepare a resulting schema level that allows the reflective parser
// to simply perform its normal logic, even while there are some
@@ -235,12 +251,13 @@
// (4) the method failed or could not be called, which is treated the same
// as case (3)
//
- if (nextSchemaLevel != null)
+ if (nextSchemaLevel != null) {
return nextSchemaLevel;
- else if (fArbitraryChildren)
+ } else if (arbitraryChildren) {
return sArbitraryChildHandler;
- else
+ } else {
return null;
+ }
}
public void invokeEnd(int lineNumber, String elem, Schema target,
@@ -248,7 +265,7 @@
Throwable caught = null;
try {
target.setLineNumber(lineNumber);
- fMethod.invoke(target, args);
+ method.invoke(target, args);
return;
} catch (IllegalArgumentException e) {
caught = e;
@@ -257,23 +274,23 @@
} catch (InvocationTargetException e) {
caught = e.getTargetException();
}
- target.onHandlerException(lineNumber, elem, fMethod, caught);
+ target.onHandlerException(lineNumber, elem, method, caught);
}
public boolean isEndMethod() {
- return fMethodType == TYPE_END;
+ return methodType == TYPE_END;
}
public boolean isStartMethod() {
- return fMethodType == TYPE_BEGIN;
+ return methodType == TYPE_BEGIN;
}
static {
ReflectiveParser.registerSchemaLevel(sArbitraryChildHandler.getClass());
}
- private final boolean fArbitraryChildren;
- private final HandlerParam[] fHandlerParams;
- private final Method fMethod;
- private final int fMethodType;
+ 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 65de3bc..3e50bee 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
@@ -1,4 +1,18 @@
-// Copyright 2006 Google Inc. All Rights Reserved.
+/*
+ * Copyright 2006 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
package com.google.gwt.dev.util.xml;
import java.lang.reflect.Field;
@@ -62,9 +76,9 @@
private HandlerParam(Class paramType, Field metaField,
String normalizedAttrName) {
- fParamType = paramType;
- fMetaField = metaField;
- fNormalizedAttrName = normalizedAttrName;
+ this.paramType = paramType;
+ this.metaField = metaField;
+ this.normalizedAttrName = normalizedAttrName;
}
/**
@@ -73,7 +87,7 @@
public String getDefaultValue(Schema schema) {
Throwable caught = null;
try {
- return (String) fMetaField.get(schema);
+ return (String) metaField.get(schema);
} catch (IllegalArgumentException e) {
caught = e;
} catch (IllegalAccessException e) {
@@ -86,18 +100,18 @@
//
throw (IllegalStateException)new IllegalStateException(
"Unable to get attribute default value from meta field '"
- + fMetaField.getName() + "'").initCause(caught);
+ + metaField.getName() + "'").initCause(caught);
}
public String getNormalizedName() {
- return fNormalizedAttrName;
+ return normalizedAttrName;
}
public Class getParamType() {
- return fParamType;
+ return paramType;
}
- private final Class fParamType;
- private final Field fMetaField;
- private final String fNormalizedAttrName;
+ 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 cd6b56c..6580aa2 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
@@ -1,4 +1,18 @@
-// Copyright 2006 Google Inc. All Rights Reserved.
+/*
+ * Copyright 2006 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
package com.google.gwt.dev.util.xml;
import com.google.gwt.core.ext.TreeLogger;
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 39e3267..7903c39 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
@@ -1,4 +1,18 @@
-// Copyright 2006 Google Inc. All Rights Reserved.
+/*
+ * Copyright 2006 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
package com.google.gwt.dev.util.xml;
import com.google.gwt.core.ext.TreeLogger;
@@ -35,7 +49,7 @@
public void characters(char[] ch, int start, int length)
throws SAXException {
- int lineNumber = fLocator.getLineNumber();
+ int lineNumber = locator.getLineNumber();
// Get the active schema level.
//
@@ -65,7 +79,7 @@
public void endElement(String namespaceURI, String localName, String elem)
throws SAXException {
- int lineNumber = fLocator.getLineNumber();
+ int lineNumber = locator.getLineNumber();
// Get the active schema level.
//
@@ -103,12 +117,12 @@
}
public void setDocumentLocator(Locator locator) {
- fLocator = locator;
+ this.locator = locator;
}
public void startElement(String namespaceURI, String localName,
String elemName, Attributes atts) throws SAXException {
- int lineNumber = fLocator.getLineNumber();
+ int lineNumber = locator.getLineNumber();
// Get the active schema level.
//
@@ -229,15 +243,15 @@
}
private Schema getNextToTopSchemaLevel() {
- return (Schema) fSchemaLevels.get(fSchemaLevels.size() - 2);
+ return (Schema) schemaLevels.get(schemaLevels.size() - 2);
}
private Schema getTopSchemaLevel() {
- return (Schema) fSchemaLevels.peek();
+ return (Schema) schemaLevels.peek();
}
private Object[] getCurrentArgs() {
- return (Object[]) fArgStack.peek();
+ return (Object[]) argStack.peek();
}
private void parse(TreeLogger logger, Schema topSchema, Reader reader)
@@ -245,17 +259,17 @@
// Set up the parentmost schema which is used to find default converters
// and handlers (but isn't actually on the schema stack.)
//
- fDefaultSchema = new DefaultSchema(logger);
+ defaultSchema = new DefaultSchema(logger);
// Tell this schema level about the default schema, which is initialized
// with
// converters for basic types.
//
- topSchema.setParent(fDefaultSchema);
+ topSchema.setParent(defaultSchema);
// Make a slot for the document element's args.
//
- fArgStack.push(null);
+ argStack.push(null);
// Push the first schema.
//
@@ -263,9 +277,9 @@
Throwable caught = null;
try {
- fReader = reader;
+ this.reader = reader;
SAXParser parser = SAXParserFactory.newInstance().newSAXParser();
- InputSource inputSource = new InputSource(fReader);
+ InputSource inputSource = new InputSource(this.reader);
XMLReader xmlReader = parser.getXMLReader();
xmlReader.setContentHandler(this);
xmlReader.parse(inputSource);
@@ -276,10 +290,11 @@
caught = e;
Exception inner = e.getException();
- if (inner instanceof RuntimeException)
+ if (inner instanceof RuntimeException) {
throw (RuntimeException) inner;
- else if (inner != null)
+ } else if (inner != null) {
caught = inner;
+ }
} catch (ParserConfigurationException e) {
caught = e;
@@ -296,39 +311,42 @@
}
private Schema popLevel() {
- fArgStack.pop();
- fSchemaLevels.pop();
+ argStack.pop();
+ schemaLevels.pop();
return getTopSchemaLevel();
}
private void setArgsAndPushLevel(Object[] handlerArgs, Schema schemaLevel) {
// Set the args on the current schema level.
- fArgStack.set(fArgStack.size() - 1, handlerArgs);
+ argStack.set(argStack.size() - 1, handlerArgs);
// A slot for the args at the childrens' depth.
- fArgStack.push(null);
- if (!fSchemaLevels.isEmpty()) {
+ argStack.push(null);
+ if (!schemaLevels.isEmpty()) {
// Tell this schema level about its parent.
//
Schema maybeParent = null;
- for (int i = fSchemaLevels.size() - 1; i >= 0; --i) {
- maybeParent = (Schema) fSchemaLevels.get(i);
- if (maybeParent != null)
+ for (int i = schemaLevels.size() - 1; i >= 0; --i) {
+ maybeParent = (Schema) schemaLevels.get(i);
+ if (maybeParent != null) {
break;
+ }
}
- if (maybeParent == null)
+ if (maybeParent == null) {
throw new IllegalStateException("Cannot find any parent schema");
- if (schemaLevel != null)
+ }
+ if (schemaLevel != null) {
schemaLevel.setParent(maybeParent);
+ }
}
// The schema for children.
- fSchemaLevels.push(schemaLevel);
+ schemaLevels.push(schemaLevel);
}
- private Locator fLocator;
- private Reader fReader;
- private Stack fSchemaLevels = new Stack();
- private Stack fArgStack = new Stack();
- private Schema fDefaultSchema;
+ 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)
@@ -355,8 +373,9 @@
Class[] nested = schemaLevelClass.getDeclaredClasses();
for (int i = 0, n = nested.length; i < n; ++i) {
Class nestedClass = nested[i];
- if (Schema.class.isAssignableFrom(nestedClass))
+ if (Schema.class.isAssignableFrom(nestedClass)) {
registerSchemaLevel(nestedClass);
+ }
}
}
}
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 704df76..bddc67d 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
@@ -1,4 +1,18 @@
-// Copyright 2006 Google Inc. All Rights Reserved.
+/*
+ * Copyright 2006 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
package com.google.gwt.dev.util.xml;
import com.google.gwt.core.ext.UnableToCompleteException;
@@ -16,10 +30,11 @@
public AttributeConverter getAttributeConverter(Class type) {
AttributeConverter converter = (AttributeConverter) convertersByType
.get(type);
- if (converter != null)
+ if (converter != null) {
return converter;
- else if (parent != null)
+ } else if (parent != null) {
return parent.getAttributeConverter(type);
+ }
throw new IllegalStateException(
"Unable to find an attribute converter for type " + type.getName());
@@ -31,38 +46,44 @@
public void onBadAttributeValue(int line, String elem, String attr,
String value, Class paramType) throws UnableToCompleteException {
- if (parent != null)
+ if (parent != null) {
parent.onBadAttributeValue(line, elem, attr, value, paramType);
+ }
}
public void onHandlerException(int line, String elem, Method method,
Throwable e) throws UnableToCompleteException {
- if (parent != null)
+ if (parent != null) {
parent.onHandlerException(line, elem, method, e);
+ }
}
public void onMissingAttribute(int line, String elem, String attr)
throws UnableToCompleteException {
- if (parent != null)
+ if (parent != null) {
parent.onMissingAttribute(line, elem, attr);
+ }
}
public void onUnexpectedAttribute(int line, String elem, String attr,
String value) throws UnableToCompleteException {
- if (parent != null)
+ if (parent != null) {
parent.onUnexpectedAttribute(line, elem, attr, value);
+ }
}
public void onUnexpectedChild(int line, String elem)
throws UnableToCompleteException {
- if (parent != null)
+ if (parent != null) {
parent.onUnexpectedChild(line, elem);
+ }
}
public void onUnexpectedElement(int line, String elem)
throws UnableToCompleteException {
- if (parent != null)
+ if (parent != null) {
parent.onUnexpectedElement(line, elem);
+ }
}
public void registerAttributeConverter(Class type,