ordercheck passes.
git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@24 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/dev/core/src/com/google/gwt/core/ext/BadPropertyValueException.java b/dev/core/src/com/google/gwt/core/ext/BadPropertyValueException.java
index 54e8b4c..2220c7b 100644
--- a/dev/core/src/com/google/gwt/core/ext/BadPropertyValueException.java
+++ b/dev/core/src/com/google/gwt/core/ext/BadPropertyValueException.java
@@ -20,6 +20,17 @@
*/
public class BadPropertyValueException extends Exception {
+ private final String badValue;
+
+ private final String propName;
+
+ public BadPropertyValueException(String propName) {
+ super("Missing property '" + propName + "' was not specified");
+
+ this.propName = propName;
+ this.badValue = "<null>";
+ }
+
public BadPropertyValueException(String propName, String badValue) {
super("Property '" + propName + "' cannot be set to unexpected value '"
+ badValue + "'");
@@ -28,21 +39,10 @@
this.badValue = badValue;
}
- public BadPropertyValueException(String propName) {
- super("Missing property '" + propName + "' was not specified");
-
- this.propName = propName;
- this.badValue = "<null>";
- }
-
String getBadValue() {
return badValue;
}
-
String getPropName() {
return propName;
}
-
- private final String badValue;
- private final String propName;
}
diff --git a/dev/core/src/com/google/gwt/core/ext/Generator.java b/dev/core/src/com/google/gwt/core/ext/Generator.java
index e608084..39fea20 100644
--- a/dev/core/src/com/google/gwt/core/ext/Generator.java
+++ b/dev/core/src/com/google/gwt/core/ext/Generator.java
@@ -22,18 +22,6 @@
public abstract class Generator {
/**
- * Generate a default constructible subclass of the requested type.
- *
- * @return the name of a subclass to substitute for the requested class, or
- * return <code>null</code> to cause the requested type itself to be
- * used
- * @throws UnableToCompleteException if for any reason the generator cannot
- * provide a substitute class
- */
- public abstract String generate(TreeLogger logger, GeneratorContext context,
- String typeName) throws UnableToCompleteException;
-
- /**
* Escapes string content to be a valid string literal.
* @return an escaped version of <code>unescaped</code>, suitable for being
* enclosed in double quotes in Java source
@@ -82,4 +70,16 @@
return String.valueOf(newChars);
}
+
+ /**
+ * Generate a default constructible subclass of the requested type.
+ *
+ * @return the name of a subclass to substitute for the requested class, or
+ * return <code>null</code> to cause the requested type itself to be
+ * used
+ * @throws UnableToCompleteException if for any reason the generator cannot
+ * provide a substitute class
+ */
+ public abstract String generate(TreeLogger logger, GeneratorContext context,
+ String typeName) throws UnableToCompleteException;
}
diff --git a/dev/core/src/com/google/gwt/core/ext/GeneratorContext.java b/dev/core/src/com/google/gwt/core/ext/GeneratorContext.java
index ea97504..24701cb 100644
--- a/dev/core/src/com/google/gwt/core/ext/GeneratorContext.java
+++ b/dev/core/src/com/google/gwt/core/ext/GeneratorContext.java
@@ -25,6 +25,27 @@
public interface GeneratorContext {
/**
+ * Commits source generation begun with
+ * {@link #tryCreate(TreeLogger, String, String)}.
+ */
+ void commit(TreeLogger logger, PrintWriter pw);
+
+ /**
+ * Gets the property oracle for the current generator context. Generators can
+ * use the property oracle to query deferred binding properties.
+ */
+ PropertyOracle getPropertyOracle();
+
+ /**
+ * Gets the type oracle for the current generator context. Generators can use
+ * the type oracle to ask questions about the entire translatable code base.
+ *
+ * @return a TypeOracle over all the relevant translatable compilation units
+ * in the source path
+ */
+ TypeOracle getTypeOracle();
+
+ /**
* Attempts to get a <code>PrintWriter</code> so that the caller can
* generate the source code for the named type. If the named types already
* exists, <code>null</code> is returned to indicate that no work needs to
@@ -39,25 +60,4 @@
* <code>PrintWriter</code> is returned.
*/
PrintWriter tryCreate(TreeLogger logger, String packageName, String simpleName);
-
- /**
- * Commits source generation begun with
- * {@link #tryCreate(TreeLogger, String, String)}.
- */
- void commit(TreeLogger logger, PrintWriter pw);
-
- /**
- * Gets the type oracle for the current generator context. Generators can use
- * the type oracle to ask questions about the entire translatable code base.
- *
- * @return a TypeOracle over all the relevant translatable compilation units
- * in the source path
- */
- TypeOracle getTypeOracle();
-
- /**
- * Gets the property oracle for the current generator context. Generators can
- * use the property oracle to query deferred binding properties.
- */
- PropertyOracle getPropertyOracle();
}
diff --git a/dev/core/src/com/google/gwt/core/ext/TreeLogger.java b/dev/core/src/com/google/gwt/core/ext/TreeLogger.java
index 441ab74..122277b 100644
--- a/dev/core/src/com/google/gwt/core/ext/TreeLogger.java
+++ b/dev/core/src/com/google/gwt/core/ext/TreeLogger.java
@@ -62,6 +62,12 @@
return (Type) instances.get(label.toUpperCase());
}
+ private final String label;
+
+ private final Type parent;
+
+ private final boolean needsAttention;
+
/**
* Constructs a log type with an optional parent.
*/
@@ -85,10 +91,6 @@
return label;
}
- public String toString() {
- return label;
- }
-
/**
* Gets the parent of this severity type.
*
@@ -97,7 +99,6 @@
public Type getParent() {
return parent;
}
-
/**
* Indicates whether this severity type represents a high severity that
* should be highlighted for the user.
@@ -108,66 +109,12 @@
public boolean needsAttention() {
return needsAttention;
}
-
- private final String label;
- private final Type parent;
- private final boolean needsAttention;
+ public String toString() {
+ return label;
+ }
}
/**
- * Produces a branched logger, which can be used to write messages that are
- * logically grouped together underneath the current logger. The details of
- * how/if the resulting messages are displayed is implementation-dependent.
- *
- * <p>
- * The log message supplied when branching serves two purposes. First, the
- * message should be considered a heading for all the child messages below it.
- * Second, the <code>type</code> of the message provides a hint as to the
- * importance of the children below it. As an optimization, an implementation
- * could return a "no-op" logger if messages of the specified type weren't
- * being logged, which the implication being that all nested log messages were
- * no more important than the level of their branch parent.
- * </p>
- *
- * <p>
- * As an example of how hierarchical logging can be used, a branched logger in
- * a GUI could write log message as child items of a parent node in a tree
- * control. If logging to streams, such as a text console, the branched logger
- * could prefix each entry with a unique string and indent its text so that it
- * could be sorted later to reconstruct a proper hierarchy.
- * </p>
- *
- * @param type
- * @param msg An optional message to log, which can be <code>null</code> if
- * only an exception is being logged
- * @param caught An optional exception to log, which can be <code>null</code>
- * if only a message is being logged
- * @return an instance of {@link TreeLogger} representing the new branch of
- * the log. May be the same instance on which this method is called
- */
- TreeLogger branch(TreeLogger.Type type, String msg, Throwable caught);
-
- /**
- * Determines whether or not a log entry of the specified type would actually
- * be logged. Caller use this method to avoid constructing log messages that
- * would be thrown away.
- */
- boolean isLoggable(TreeLogger.Type type);
-
- /**
- * Logs a message and/or an exception. It is also legal to call this method
- * using <code>null</code> arguments for <i>both</i> <code>msg</code> and
- * <code>caught</code>, in which case the log event can be ignored.
- *
- * @param type
- * @param msg An optional message to log, which can be <code>null</code> if
- * only an exception is being logged
- * @param caught An optional exception to log, which can be <code>null</code>
- * if only a message is being logged
- */
- void log(TreeLogger.Type type, String msg, Throwable caught);
-
- /**
* Logs an error.
*/
Type ERROR = new Type(true, "ERROR", null);
@@ -220,4 +167,57 @@
// nothing
}
};
+
+ /**
+ * Produces a branched logger, which can be used to write messages that are
+ * logically grouped together underneath the current logger. The details of
+ * how/if the resulting messages are displayed is implementation-dependent.
+ *
+ * <p>
+ * The log message supplied when branching serves two purposes. First, the
+ * message should be considered a heading for all the child messages below it.
+ * Second, the <code>type</code> of the message provides a hint as to the
+ * importance of the children below it. As an optimization, an implementation
+ * could return a "no-op" logger if messages of the specified type weren't
+ * being logged, which the implication being that all nested log messages were
+ * no more important than the level of their branch parent.
+ * </p>
+ *
+ * <p>
+ * As an example of how hierarchical logging can be used, a branched logger in
+ * a GUI could write log message as child items of a parent node in a tree
+ * control. If logging to streams, such as a text console, the branched logger
+ * could prefix each entry with a unique string and indent its text so that it
+ * could be sorted later to reconstruct a proper hierarchy.
+ * </p>
+ *
+ * @param type
+ * @param msg An optional message to log, which can be <code>null</code> if
+ * only an exception is being logged
+ * @param caught An optional exception to log, which can be <code>null</code>
+ * if only a message is being logged
+ * @return an instance of {@link TreeLogger} representing the new branch of
+ * the log. May be the same instance on which this method is called
+ */
+ TreeLogger branch(TreeLogger.Type type, String msg, Throwable caught);
+
+ /**
+ * Determines whether or not a log entry of the specified type would actually
+ * be logged. Caller use this method to avoid constructing log messages that
+ * would be thrown away.
+ */
+ boolean isLoggable(TreeLogger.Type type);
+
+ /**
+ * Logs a message and/or an exception. It is also legal to call this method
+ * using <code>null</code> arguments for <i>both</i> <code>msg</code> and
+ * <code>caught</code>, in which case the log event can be ignored.
+ *
+ * @param type
+ * @param msg An optional message to log, which can be <code>null</code> if
+ * only an exception is being logged
+ * @param caught An optional exception to log, which can be <code>null</code>
+ * if only a message is being logged
+ */
+ void log(TreeLogger.Type type, String msg, Throwable caught);
}
diff --git a/dev/core/src/com/google/gwt/core/ext/typeinfo/CompilationUnitProvider.java b/dev/core/src/com/google/gwt/core/ext/typeinfo/CompilationUnitProvider.java
index 7c99165..e3a8fc9 100644
--- a/dev/core/src/com/google/gwt/core/ext/typeinfo/CompilationUnitProvider.java
+++ b/dev/core/src/com/google/gwt/core/ext/typeinfo/CompilationUnitProvider.java
@@ -24,16 +24,6 @@
*/
public interface CompilationUnitProvider {
- long getLastModified() throws UnableToCompleteException;
-
- boolean isTransient();
-
- String getLocation();
-
- String getPackageName();
-
- char[] getSource() throws UnableToCompleteException;
-
Comparator LOCATION_COMPARATOR = new Comparator() {
public int compare(Object o1, Object o2) {
String loc1 = ((CompilationUnitProvider) o1).getLocation();
@@ -41,4 +31,14 @@
return loc1.compareTo(loc2);
}
};
+
+ long getLastModified() throws UnableToCompleteException;
+
+ String getLocation();
+
+ String getPackageName();
+
+ char[] getSource() throws UnableToCompleteException;
+
+ boolean isTransient();
}
diff --git a/dev/core/src/com/google/gwt/core/ext/typeinfo/HasMetaData.java b/dev/core/src/com/google/gwt/core/ext/typeinfo/HasMetaData.java
index a627513..1ef3c46 100644
--- a/dev/core/src/com/google/gwt/core/ext/typeinfo/HasMetaData.java
+++ b/dev/core/src/com/google/gwt/core/ext/typeinfo/HasMetaData.java
@@ -54,6 +54,11 @@
*/
public interface HasMetaData {
/**
+ * Adds additional metadata.
+ */
+ void addMetaData(String tagName, String[] values);
+
+ /**
* Gets each list of metadata for the specified tag name.
*/
String[][] getMetaData(String tagName);
@@ -62,9 +67,4 @@
* Gets the name of available metadata tags.
*/
String[] getMetaDataTags();
-
- /**
- * Adds additional metadata.
- */
- void addMetaData(String tagName, String[] values);
}
diff --git a/dev/core/src/com/google/gwt/core/ext/typeinfo/JAbstractMethod.java b/dev/core/src/com/google/gwt/core/ext/typeinfo/JAbstractMethod.java
index a2bc813..f2e0e97 100644
--- a/dev/core/src/com/google/gwt/core/ext/typeinfo/JAbstractMethod.java
+++ b/dev/core/src/com/google/gwt/core/ext/typeinfo/JAbstractMethod.java
@@ -24,6 +24,24 @@
*/
public abstract class JAbstractMethod implements HasMetaData {
+ private int bodyEnd;
+
+ private int bodyStart;
+
+ private final int declEnd;
+
+ private final int declStart;
+
+ private final HasMetaData metaData = new MetaData();
+
+ private int modifierBits;
+
+ private final String name;
+
+ private final List params = new ArrayList();
+
+ private final List thrownTypes = new ArrayList();
+
// Only the builder can construct
JAbstractMethod(String name, int declStart, int declEnd, int bodyStart,
int bodyEnd) {
@@ -38,6 +56,14 @@
metaData.addMetaData(tagName, values);
}
+ public void addModifierBits(int bits) {
+ modifierBits |= bits;
+ }
+
+ public void addThrows(JType type) {
+ thrownTypes.add(type);
+ }
+
public JParameter findParameter(String name) {
for (Iterator iter = params.iterator(); iter.hasNext();) {
JParameter param = (JParameter) iter.next();
@@ -96,25 +122,19 @@
public boolean isDefaultAccess() {
return 0 == (modifierBits & (TypeOracle.MOD_PUBLIC | TypeOracle.MOD_PRIVATE | TypeOracle.MOD_PROTECTED));
}
-
public abstract JMethod isMethod();
-
public boolean isPrivate() {
return 0 != (modifierBits & TypeOracle.MOD_PRIVATE);
}
-
public boolean isProtected() {
return 0 != (modifierBits & TypeOracle.MOD_PROTECTED);
}
-
public boolean isPublic() {
return 0 != (modifierBits & TypeOracle.MOD_PUBLIC);
}
-
protected int getModifierBits() {
return modifierBits;
}
-
protected void toStringParamsAndThrows(StringBuffer sb) {
sb.append("(");
boolean needComma = false;
@@ -145,19 +165,9 @@
}
}
}
-
- public void addModifierBits(int bits) {
- modifierBits |= bits;
- }
-
void addParameter(JParameter param) {
params.add(param);
}
-
- public void addThrows(JType type) {
- thrownTypes.add(type);
- }
-
boolean hasParamTypes(JType[] paramTypes) {
if (params.size() != paramTypes.length) {
return false;
@@ -173,14 +183,4 @@
}
return true;
}
-
- private int bodyEnd;
- private int bodyStart;
- private final int declEnd;
- private final int declStart;
- private final HasMetaData metaData = new MetaData();
- private int modifierBits;
- private final String name;
- private final List params = new ArrayList();
- private final List thrownTypes = new ArrayList();
}
diff --git a/dev/core/src/com/google/gwt/core/ext/typeinfo/JArrayType.java b/dev/core/src/com/google/gwt/core/ext/typeinfo/JArrayType.java
index a6bb036..9cc1b14 100644
--- a/dev/core/src/com/google/gwt/core/ext/typeinfo/JArrayType.java
+++ b/dev/core/src/com/google/gwt/core/ext/typeinfo/JArrayType.java
@@ -20,6 +20,12 @@
*/
public class JArrayType extends JType {
+ private JType componentType;
+
+ private String lazyQualifiedName;
+
+ private String lazySimpleName;
+
JArrayType(JType componentType) {
this.componentType = componentType;
}
@@ -32,6 +38,10 @@
return "[" + componentType.getJNISignature();
}
+ public JType getLeafType() {
+ return componentType.getLeafType();
+ }
+
public String getQualifiedSourceName() {
if (lazyQualifiedName == null) {
lazyQualifiedName = getComponentType().getQualifiedSourceName() + "[]";
@@ -39,45 +49,6 @@
return lazyQualifiedName;
}
- public String getSimpleSourceName() {
- if (lazySimpleName == null) {
- lazySimpleName = getComponentType().getSimpleSourceName() + "[]";
- }
- return lazySimpleName;
- }
-
- public JArrayType isArray() {
- return this;
- }
-
- public JClassType isClass() {
- // intentional null
- return null;
- }
-
- public JClassType isInterface() {
- // intentional null
- return null;
- }
-
- public JParameterizedType isParameterized() {
- // intentional null
- return null;
- }
-
- public JPrimitiveType isPrimitive() {
- // intentional null
- return null;
- }
-
- public String toString() {
- return getQualifiedSourceName();
- }
-
- public JType getLeafType() {
- return componentType.getLeafType();
- }
-
public int getRank() {
JArrayType componentArrayType = componentType.isArray();
if (componentArrayType != null) {
@@ -86,7 +57,37 @@
return 1;
}
+
+ public String getSimpleSourceName() {
+ if (lazySimpleName == null) {
+ lazySimpleName = getComponentType().getSimpleSourceName() + "[]";
+ }
+ return lazySimpleName;
+ }
+
+ public JArrayType isArray() {
+ return this;
+ }
+ public JClassType isClass() {
+ // intentional null
+ return null;
+ }
+
+ public JClassType isInterface() {
+ // intentional null
+ return null;
+ }
+
+ public JParameterizedType isParameterized() {
+ // intentional null
+ return null;
+ }
+
+ public JPrimitiveType isPrimitive() {
+ // intentional null
+ return null;
+ }
public void setLeafType(JType type) {
JArrayType componentTypeIsArray = componentType.isArray();
if (componentTypeIsArray != null) {
@@ -95,8 +96,7 @@
componentType = type;
}
}
-
- private JType componentType;
- private String lazyQualifiedName;
- private String lazySimpleName;
+ public String toString() {
+ return getQualifiedSourceName();
+ }
}
diff --git a/dev/core/src/com/google/gwt/core/ext/typeinfo/JClassType.java b/dev/core/src/com/google/gwt/core/ext/typeinfo/JClassType.java
index bc7a101..cbae399 100644
--- a/dev/core/src/com/google/gwt/core/ext/typeinfo/JClassType.java
+++ b/dev/core/src/com/google/gwt/core/ext/typeinfo/JClassType.java
@@ -33,9 +33,9 @@
* Type representing a java class type.
*/
public class JClassType extends JType implements HasMetaData {
- private static final char[] HEX_CHARS = new char[]{
- '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E',
- 'F'};
+ private static final char[] HEX_CHARS = new char[] {
+ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D',
+ 'E', 'F'};
/**
* Computes the MD5 hash for the specified byte array.
@@ -65,6 +65,52 @@
return new String(name);
}
+ private final Set allSubtypes = new HashSet();
+
+ private final int bodyEnd;
+
+ private final int bodyStart;
+
+ private final List constructors = new ArrayList();
+
+ private final CompilationUnitProvider cup;
+
+ private final JPackage declaringPackage;
+
+ private final int declEnd;
+
+ private final int declStart;
+
+ private final JClassType enclosingType;
+
+ private final Map fields = new HashMap();
+
+ private final List interfaces = new ArrayList();
+
+ private final boolean isInterface;
+
+ private final boolean isLocalType;
+
+ private String lazyHash;
+
+ private String lazyQualifiedName;
+
+ private final HasMetaData metaData = new MetaData();
+
+ private final Map methods = new HashMap();
+
+ private int modifierBits;
+
+ private final String name;
+
+ private final String nestedName;
+
+ private final Map nestedTypes = new HashMap();
+
+ private final TypeOracle oracle;
+
+ private JClassType superclass;
+
public JClassType(TypeOracle oracle, CompilationUnitProvider cup,
JPackage declaringPackage, JClassType enclosingType, boolean isLocalType,
String name, int declStart, int declEnd, int bodyStart, int bodyEnd,
@@ -426,32 +472,6 @@
}
}
- private void acceptSubtype(JClassType me) {
- allSubtypes.add(me);
- notifySuperTypesOf(me);
- }
-
- private String makeCompoundName(JClassType type) {
- if (type.enclosingType == null) {
- return type.name;
- } else {
- return makeCompoundName(type.enclosingType) + "." + type.name;
- }
- }
-
- /**
- * Tells this type's superclasses and superinterfaces about it.
- */
- private void notifySuperTypesOf(JClassType me) {
- if (superclass != null) {
- superclass.acceptSubtype(me);
- }
- for (int i = 0, n = interfaces.size(); i < n; ++i) {
- JClassType intf = (JClassType) interfaces.get(i);
- intf.acceptSubtype(me);
- }
- }
-
protected int getModifierBits() {
return modifierBits;
}
@@ -496,27 +516,29 @@
notifySuperTypesOf(this);
}
- private final Set allSubtypes = new HashSet();
- private final int bodyEnd;
- private final int bodyStart;
- private final List constructors = new ArrayList();
- private final CompilationUnitProvider cup;
- private final JPackage declaringPackage;
- private final int declEnd;
- private final int declStart;
- private final JClassType enclosingType;
- private final Map fields = new HashMap();
- private final List interfaces = new ArrayList();
- private final boolean isInterface;
- private final boolean isLocalType;
- private String lazyHash;
- private String lazyQualifiedName;
- private final HasMetaData metaData = new MetaData();
- private final Map methods = new HashMap();
- private int modifierBits;
- private final String name;
- private final String nestedName;
- private final Map nestedTypes = new HashMap();
- private final TypeOracle oracle;
- private JClassType superclass;
+ private void acceptSubtype(JClassType me) {
+ allSubtypes.add(me);
+ notifySuperTypesOf(me);
+ }
+
+ private String makeCompoundName(JClassType type) {
+ if (type.enclosingType == null) {
+ return type.name;
+ } else {
+ return makeCompoundName(type.enclosingType) + "." + type.name;
+ }
+ }
+
+ /**
+ * Tells this type's superclasses and superinterfaces about it.
+ */
+ private void notifySuperTypesOf(JClassType me) {
+ if (superclass != null) {
+ superclass.acceptSubtype(me);
+ }
+ for (int i = 0, n = interfaces.size(); i < n; ++i) {
+ JClassType intf = (JClassType) interfaces.get(i);
+ intf.acceptSubtype(me);
+ }
+ }
}
diff --git a/dev/core/src/com/google/gwt/core/ext/typeinfo/JConstructor.java b/dev/core/src/com/google/gwt/core/ext/typeinfo/JConstructor.java
index 776d1ac..46a5d22 100644
--- a/dev/core/src/com/google/gwt/core/ext/typeinfo/JConstructor.java
+++ b/dev/core/src/com/google/gwt/core/ext/typeinfo/JConstructor.java
@@ -16,6 +16,8 @@
package com.google.gwt.core.ext.typeinfo;
public class JConstructor extends JAbstractMethod {
+ private final JClassType enclosingType;
+
public JConstructor(JClassType enclosingType, String name, int declStart,
int declEnd, int bodyStart, int bodyEnd) {
super(name, declStart, declEnd, bodyStart, bodyEnd);
@@ -50,6 +52,4 @@
public String toString() {
return getReadableDeclaration();
}
-
- private final JClassType enclosingType;
}
diff --git a/dev/core/src/com/google/gwt/core/ext/typeinfo/JField.java b/dev/core/src/com/google/gwt/core/ext/typeinfo/JField.java
index f1db65c..096551b 100644
--- a/dev/core/src/com/google/gwt/core/ext/typeinfo/JField.java
+++ b/dev/core/src/com/google/gwt/core/ext/typeinfo/JField.java
@@ -17,6 +17,16 @@
public class JField implements HasMetaData {
+ private final JClassType enclosingType;
+
+ private final HasMetaData metaData = new MetaData();
+
+ private int modifierBits;
+
+ private final String name;
+
+ private JType type;
+
public JField(JClassType enclosingType, String name) {
this.enclosingType = enclosingType;
this.name = name;
@@ -29,6 +39,10 @@
metaData.addMetaData(tagName, values);
}
+ public void addModifierBits(int modifierBits) {
+ this.modifierBits |= modifierBits;
+ }
+
public JClassType getEnclosingType() {
return enclosingType;
}
@@ -83,10 +97,6 @@
return 0 != (modifierBits & TypeOracle.MOD_VOLATILE);
}
- public void addModifierBits(int modifierBits) {
- this.modifierBits |= modifierBits;
- }
-
public void setType(JType type) {
this.type = type;
}
@@ -108,10 +118,4 @@
sb.append(getName());
return sb.toString();
}
-
- private final JClassType enclosingType;
- private final HasMetaData metaData = new MetaData();
- private int modifierBits;
- private final String name;
- private JType type;
}
diff --git a/dev/core/src/com/google/gwt/core/ext/typeinfo/JMethod.java b/dev/core/src/com/google/gwt/core/ext/typeinfo/JMethod.java
index 840c998..263cc9c 100644
--- a/dev/core/src/com/google/gwt/core/ext/typeinfo/JMethod.java
+++ b/dev/core/src/com/google/gwt/core/ext/typeinfo/JMethod.java
@@ -17,6 +17,10 @@
public class JMethod extends JAbstractMethod {
+ private final JClassType enclosingType;
+
+ private JType returnType;
+
public JMethod(JClassType enclosingType, String name, int declStart,
int declEnd, int bodyStart, int bodyEnd) {
super(name, declStart, declEnd, bodyStart, bodyEnd);
@@ -81,6 +85,10 @@
return 0 != (getModifierBits() & TypeOracle.MOD_STATIC);
}
+ public void setReturnType(JType type) {
+ returnType = type;
+ }
+
public String toString() {
return getReadableDeclaration();
}
@@ -100,11 +108,4 @@
return sb.toString();
}
-
- public void setReturnType(JType type) {
- returnType = type;
- }
-
- private final JClassType enclosingType;
- private JType returnType;
}
diff --git a/dev/core/src/com/google/gwt/core/ext/typeinfo/JPackage.java b/dev/core/src/com/google/gwt/core/ext/typeinfo/JPackage.java
index 1a0e4e4..26bd1f1 100644
--- a/dev/core/src/com/google/gwt/core/ext/typeinfo/JPackage.java
+++ b/dev/core/src/com/google/gwt/core/ext/typeinfo/JPackage.java
@@ -20,6 +20,10 @@
public class JPackage {
+ private final String name;
+
+ private final Map types = new HashMap();
+
JPackage(String name) {
this.name = name;
}
@@ -76,7 +80,4 @@
Object removed = types.remove(type.getSimpleSourceName());
// JDT will occasionally remove non-existent items, such as packages.
}
-
- private final String name;
- private final Map types = new HashMap();
}
diff --git a/dev/core/src/com/google/gwt/core/ext/typeinfo/JParameter.java b/dev/core/src/com/google/gwt/core/ext/typeinfo/JParameter.java
index 02e7370..41d8a9d 100644
--- a/dev/core/src/com/google/gwt/core/ext/typeinfo/JParameter.java
+++ b/dev/core/src/com/google/gwt/core/ext/typeinfo/JParameter.java
@@ -17,6 +17,14 @@
public class JParameter implements HasMetaData {
+ private final HasMetaData metaData = new MetaData();
+
+ private final String name;
+
+ private JType type;
+
+ private final JAbstractMethod enclosingMethod;
+
public JParameter(JAbstractMethod enclosingMethod, JType type, String name) {
this.enclosingMethod = enclosingMethod;
this.type = type;
@@ -29,6 +37,10 @@
metaData.addMetaData(tagName, values);
}
+ public JAbstractMethod getEnclosingMethod() {
+ return enclosingMethod;
+ }
+
public String[][] getMetaData(String tagName) {
return metaData.getMetaData(tagName);
}
@@ -45,15 +57,6 @@
return type;
}
- public JAbstractMethod getEnclosingMethod() {
- return enclosingMethod;
- }
-
- // Called when parameter types are found to be parameterized
- void setType(JType type) {
- this.type = type;
- }
-
public String toString() {
StringBuffer sb = new StringBuffer();
sb.append(type.getQualifiedSourceName());
@@ -62,8 +65,8 @@
return sb.toString();
}
- private final HasMetaData metaData = new MetaData();
- private final String name;
- private JType type;
- private final JAbstractMethod enclosingMethod;
+ // Called when parameter types are found to be parameterized
+ void setType(JType type) {
+ this.type = type;
+ }
}
diff --git a/dev/core/src/com/google/gwt/core/ext/typeinfo/JParameterizedType.java b/dev/core/src/com/google/gwt/core/ext/typeinfo/JParameterizedType.java
index b26ecdc..a0e5374 100644
--- a/dev/core/src/com/google/gwt/core/ext/typeinfo/JParameterizedType.java
+++ b/dev/core/src/com/google/gwt/core/ext/typeinfo/JParameterizedType.java
@@ -21,6 +21,10 @@
public class JParameterizedType extends JType {
+ private final JClassType parameterized;
+
+ private final List typeArgs = new ArrayList();
+
JParameterizedType(JClassType parameterized) {
this.parameterized = parameterized;
}
@@ -32,6 +36,17 @@
return getRawType().getJNISignature();
}
+ public JType getLeafType() {
+ return parameterized;
+ }
+
+ /*
+ * Get the name of this type without all of the parameterized information
+ */
+ public String getNonParameterizedQualifiedSourceName() {
+ return parameterized.getQualifiedSourceName();
+ }
+
public String getParameterizedQualifiedSourceName() {
StringBuffer sb = new StringBuffer();
sb.append(parameterized.getQualifiedSourceName());
@@ -49,7 +64,7 @@
sb.append('>');
return sb.toString();
}
-
+
/**
* Everything is fully qualified and includes the < and > in the
* signature.
@@ -58,13 +73,6 @@
return parameterized.getQualifiedSourceName();
}
- /*
- * Get the name of this type without all of the parameterized information
- */
- public String getNonParameterizedQualifiedSourceName() {
- return parameterized.getQualifiedSourceName();
- }
-
public JClassType getRawType() {
return parameterized;
}
@@ -104,11 +112,4 @@
assert (type.isPrimitive() == null);
typeArgs.add(type);
}
-
- public JType getLeafType() {
- return parameterized;
- }
-
- private final JClassType parameterized;
- private final List typeArgs = new ArrayList();
}
diff --git a/dev/core/src/com/google/gwt/core/ext/typeinfo/JPrimitiveType.java b/dev/core/src/com/google/gwt/core/ext/typeinfo/JPrimitiveType.java
index 6a315f1..3244e73 100644
--- a/dev/core/src/com/google/gwt/core/ext/typeinfo/JPrimitiveType.java
+++ b/dev/core/src/com/google/gwt/core/ext/typeinfo/JPrimitiveType.java
@@ -50,6 +50,10 @@
return map;
}
+ private final String jni;
+
+ private final String name;
+
private JPrimitiveType(String name, String jni) {
this.name = name;
this.jni = jni;
@@ -90,7 +94,4 @@
public JPrimitiveType isPrimitive() {
return this;
}
-
- private final String jni;
- private final String name;
}
diff --git a/dev/core/src/com/google/gwt/core/ext/typeinfo/JType.java b/dev/core/src/com/google/gwt/core/ext/typeinfo/JType.java
index 500e8a0..0b949d4 100644
--- a/dev/core/src/com/google/gwt/core/ext/typeinfo/JType.java
+++ b/dev/core/src/com/google/gwt/core/ext/typeinfo/JType.java
@@ -16,13 +16,19 @@
package com.google.gwt.core.ext.typeinfo;
public abstract class JType {
+ public abstract String getJNISignature();
+
+ public JType getLeafType() {
+ return this;
+ }
+
+ public String getParameterizedQualifiedSourceName() {
+ return getQualifiedSourceName();
+ }
+
public abstract String getQualifiedSourceName();
public abstract String getSimpleSourceName();
-
- public String getParameterizedQualifiedSourceName() {
- return getQualifiedSourceName();
- }
public abstract JArrayType isArray();
@@ -41,10 +47,4 @@
public abstract JParameterizedType isParameterized();
public abstract JPrimitiveType isPrimitive();
-
- public abstract String getJNISignature();
-
- public JType getLeafType() {
- return this;
- }
}
diff --git a/dev/core/src/com/google/gwt/core/ext/typeinfo/MetaData.java b/dev/core/src/com/google/gwt/core/ext/typeinfo/MetaData.java
index 4f46c72..39b35ee 100644
--- a/dev/core/src/com/google/gwt/core/ext/typeinfo/MetaData.java
+++ b/dev/core/src/com/google/gwt/core/ext/typeinfo/MetaData.java
@@ -25,6 +25,19 @@
class MetaData implements HasMetaData {
+ private final Map tagNameToStringArrayList = new HashMap();
+
+ public void addMetaData(String tagName, String[] values) {
+ List list = (List) tagNameToStringArrayList.get(tagName);
+ if (list == null) {
+ list = new ArrayList();
+ tagNameToStringArrayList.put(tagName, list);
+ }
+ // Yes, we're adding the string array as an object into the list.
+ //
+ list.add(values);
+ }
+
public String[][] getMetaData(String tagName) {
List list = (List) tagNameToStringArrayList.get(tagName);
if (list != null) {
@@ -39,17 +52,6 @@
TypeOracle.NO_STRINGS);
}
- public void addMetaData(String tagName, String[] values) {
- List list = (List) tagNameToStringArrayList.get(tagName);
- if (list == null) {
- list = new ArrayList();
- tagNameToStringArrayList.put(tagName, list);
- }
- // Yes, we're adding the string array as an object into the list.
- //
- list.add(values);
- }
-
public String toString() {
StringBuffer sb = new StringBuffer();
final Set keys = tagNameToStringArrayList.keySet();
@@ -83,6 +85,4 @@
}
return sb.toString();
}
-
- private final Map tagNameToStringArrayList = new HashMap();
}
diff --git a/dev/core/src/com/google/gwt/core/ext/typeinfo/TypeOracle.java b/dev/core/src/com/google/gwt/core/ext/typeinfo/TypeOracle.java
index c116857..4cad1a5 100644
--- a/dev/core/src/com/google/gwt/core/ext/typeinfo/TypeOracle.java
+++ b/dev/core/src/com/google/gwt/core/ext/typeinfo/TypeOracle.java
@@ -131,6 +131,18 @@
return (String[]) strings.toArray(NO_STRINGS);
}
+ private final Map arrayTypes = new IdentityHashMap();
+
+ private JClassType javaLangObject;
+
+ private final Map packages = new HashMap();
+
+ private final Map parameterizedTypes = new HashMap();
+
+ private int reloadCount = 0;
+
+ private final Map typesByCup = new IdentityHashMap();
+
public TypeOracle() {
// Always create the default package.
//
@@ -194,7 +206,7 @@
}
return null;
}
-
+
/**
* Gets the type object that represents an array of the specified type. The
* returned type always has a stable identity so as to guarantee that all
@@ -294,7 +306,7 @@
}
return existing;
}
-
+
public long getReloadCount() {
return reloadCount;
}
@@ -362,25 +374,6 @@
}
}
- void incrementReloadCount() {
- reloadCount++;
- }
-
- Set invalidateTypesInCompilationUnit(CompilationUnitProvider cup) {
- Set invalidTypes = new HashSet();
- JClassType[] types = (JClassType[]) typesByCup.get(cup);
- if (types == null) {
- return invalidTypes;
- }
- for (int i = 0; i < types.length; i++) {
- JPackage jp = types[i].getPackage();
- invalidTypes.add(types[i].getQualifiedSourceName());
- jp.remove(types[i]);
- }
- typesByCup.remove(cup);
- return invalidTypes;
- }
-
/**
* Parses the string form of a type to produce the corresponding type object.
* The types that can be parsed include primitives, class and interface names,
@@ -414,25 +407,6 @@
}
/**
- * Updates relationships within this type oracle. Should be called after any
- * changes are made.
- *
- * @throws TypeOracleException thrown if fundamental baseline correctness
- * criteria are violated, most notably the absence of
- * "java.lang.Object"
- */
- void refresh(TreeLogger logger) throws NotFoundException {
- if (javaLangObject == null) {
- javaLangObject = findType("java.lang.Object");
- if (javaLangObject == null) {
- throw new NotFoundException("java.lang.Object");
- }
- }
- computeHierarchyRelationships();
- consumeTypeArgMetaData(logger);
- }
-
- /**
* Convenience method to sort class types in a consistent way. Note that the
* order is subject to change and is intended to generate an "aesthetically
* pleasing" order rather than a computationally reliable order.
@@ -495,6 +469,25 @@
});
}
+ void incrementReloadCount() {
+ reloadCount++;
+ }
+
+ Set invalidateTypesInCompilationUnit(CompilationUnitProvider cup) {
+ Set invalidTypes = new HashSet();
+ JClassType[] types = (JClassType[]) typesByCup.get(cup);
+ if (types == null) {
+ return invalidTypes;
+ }
+ for (int i = 0; i < types.length; i++) {
+ JPackage jp = types[i].getPackage();
+ invalidTypes.add(types[i].getQualifiedSourceName());
+ jp.remove(types[i]);
+ }
+ typesByCup.remove(cup);
+ return invalidTypes;
+ }
+
void recordTypeInCompilationUnit(CompilationUnitProvider cup, JClassType type) {
JClassType[] types = (JClassType[]) typesByCup.get(cup);
if (types == null) {
@@ -508,6 +501,25 @@
typesByCup.put(cup, types);
}
+ /**
+ * Updates relationships within this type oracle. Should be called after any
+ * changes are made.
+ *
+ * @throws TypeOracleException thrown if fundamental baseline correctness
+ * criteria are violated, most notably the absence of
+ * "java.lang.Object"
+ */
+ void refresh(TreeLogger logger) throws NotFoundException {
+ if (javaLangObject == null) {
+ javaLangObject = findType("java.lang.Object");
+ if (javaLangObject == null) {
+ throw new NotFoundException("java.lang.Object");
+ }
+ }
+ computeHierarchyRelationships();
+ consumeTypeArgMetaData(logger);
+ }
+
private void buildAllTypesImpl(Set allTypes, JClassType type) {
boolean didAdd = allTypes.add(type);
assert (didAdd);
@@ -549,7 +561,6 @@
consumeTypeArgMetaData(branch, type.getFields());
}
}
-
private void consumeTypeArgMetaData(TreeLogger logger, JField[] fields) {
TreeLogger branch;
for (int i = 0; i < fields.length; i++) {
@@ -587,7 +598,6 @@
}
}
}
-
private void consumeTypeArgMetaData(TreeLogger logger, JMethod[] methods) {
TreeLogger branch;
for (int i = 0; i < methods.length; i++) {
@@ -661,7 +671,6 @@
}
}
}
-
/*
* Given a declared type and some number of type arguments determine what the
* actual type should be.
@@ -685,7 +694,6 @@
return resultingType;
}
-
private JType parseImpl(String type) throws NotFoundException,
ParseException, BadTypeArgsException {
if (type.endsWith("[]")) {
@@ -754,7 +762,6 @@
throw new NotFoundException(type);
}
-
private JType parseTypeArgTokens(TreeLogger logger, String maybeRawType,
String[] tokens, int startIndex) throws UnableToCompleteException {
String munged = combine(tokens, startIndex).trim();
@@ -771,11 +778,4 @@
}
return parameterizedType;
}
-
- private final Map arrayTypes = new IdentityHashMap();
- private JClassType javaLangObject;
- private final Map packages = new HashMap();
- private final Map parameterizedTypes = new HashMap();
- private int reloadCount = 0;
- private final Map typesByCup = new IdentityHashMap();
}