Author: [email protected]
Date: Tue Jul 14 16:09:16 2009
New Revision: 5736
Modified:
changes/jat/ihm/dev/core/src/com/google/gwt/dev/javac/TypeOracleMediator.java
changes/jat/ihm/dev/core/src/com/google/gwt/dev/javac/asm/CollectClassData.java
Log:
More fixes of raw types, synthesize access flags for private inner classes.
Modified:
changes/jat/ihm/dev/core/src/com/google/gwt/dev/javac/TypeOracleMediator.java
==============================================================================
---
changes/jat/ihm/dev/core/src/com/google/gwt/dev/javac/TypeOracleMediator.java
(original)
+++
changes/jat/ihm/dev/core/src/com/google/gwt/dev/javac/TypeOracleMediator.java
Tue Jul 14 16:09:16 2009
@@ -280,6 +280,22 @@
return enclosingType.isGenericType() != null;
}
+ /**
+ * Substitute the raw type if the supplied type is generic.
+ *
+ * @param type
+ * @return original type or its raw type if it is generic
+ */
+ private static JType possiblySubstituteRawType(JType type) {
+ if (type != null) {
+ JGenericType genericType = type.isGenericType();
+ if (genericType != null) {
+ type = genericType.getRawType();
+ }
+ }
+ return type;
+ }
+
// map of internal names to classes
final Map<String, JRealClassType> binaryMapper = new HashMap<String,
JRealClassType>();
@@ -291,11 +307,11 @@
// transient since it is not retained across calls to addnewUnits
private transient HashMap<JRealClassType, CollectClassData> classMapType;
-
+
public TypeOracleMediator() {
this(null);
}
-
+
// @VisibleForTesting
public TypeOracleMediator(TypeOracle typeOracle) {
if (typeOracle == null) {
@@ -864,24 +880,24 @@
if ((access & Opcodes.ACC_INTERFACE) == 0) {
String superName = classData.getSuperName();
if (superName != null) {
- JRealClassType superType = binaryMapper.get(superName);
+ JClassType superType = binaryMapper.get(superName);
if (superType == null || !resolveClass(logger, superType)) {
logger.log(TreeLogger.WARN, "Unable to resolve supertype "
+ superName);
return false;
}
- type.setSuperclass(superType);
+ type.setSuperclass((JClassType)
possiblySubstituteRawType(superType));
}
}
// Set interfaces
for (String intfName : classData.getInterfaces()) {
- JRealClassType intf = binaryMapper.get(intfName);
+ JClassType intf = binaryMapper.get(intfName);
if (intf == null || !resolveClass(logger, intf)) {
logger.log(TreeLogger.WARN, "Unable to resolve interface " +
intfName);
return false;
}
- type.addImplementedInterface(intf);
+ type.addImplementedInterface((JClassType)
possiblySubstituteRawType(intf));
}
}
if (((access & Opcodes.ACC_INTERFACE) == 0) && type.getSuperclass() ==
null) {
@@ -1175,14 +1191,7 @@
return resolveArray(logger, type);
case Type.OBJECT:
JType resolvedType = resolveObject(logger, type);
- // check for raw usage of a generic type
- if (resolvedType != null) {
- JGenericType genericType = resolvedType.isGenericType();
- if (genericType != null) {
- resolvedType = genericType.getRawType();
- }
- }
- return resolvedType;
+ return possiblySubstituteRawType(resolvedType);
default:
assert false : "Unexpected type " + type;
return null;
Modified:
changes/jat/ihm/dev/core/src/com/google/gwt/dev/javac/asm/CollectClassData.java
==============================================================================
---
changes/jat/ihm/dev/core/src/com/google/gwt/dev/javac/asm/CollectClassData.java
(original)
+++
changes/jat/ihm/dev/core/src/com/google/gwt/dev/javac/asm/CollectClassData.java
Tue Jul 14 16:09:16 2009
@@ -354,12 +354,13 @@
// static, for example, only appears in the InnerClass attribute.
if (this.name.equals(name)) {
// TODO(jat): should we only pull in a subset of these flags? Use
only
- // these flags, or what? For now, just grab ACC_STATIC
- int staticFlag = (access & Opcodes.ACC_STATIC);
- this.access |= staticFlag;
+ // these flags, or what? For now, just grab ACC_STATIC and
ACC_PRIVATE
+ int copyFlags = access & (Opcodes.ACC_STATIC | Opcodes.ACC_PRIVATE);
+ this.access |= copyFlags;
+ boolean isStatic = (access & Opcodes.ACC_STATIC) != 0;
switch (classType) {
case TopLevel:
- classType = staticFlag == 0 ? ClassType.Inner : ClassType.Nested;
+ classType = isStatic ? ClassType.Nested : ClassType.Inner;
break;
case Anonymous:
if (innerName != null) {
--~--~---------~--~----~------------~-------~--~----~
http://groups.google.com/group/Google-Web-Toolkit-Contributors
-~----------~----~----~----~------~----~------~--~---