No unit test for this, it'd be good to add one.
GenerateJavaAST already has the right code, in a slightly different
form:
try {
// TODO: This is slow! Cache lookup.
Field privateField =
ForeachStatement.class.getDeclaredField("collectionElementType");
privateField.setAccessible(true);
collectionType = (TypeBinding) privateField.get(x);
} catch (Exception e) {
throw new InternalCompilerException(elementDecl,
"Failed to retreive collectionElementType through reflection", e);
}
http://gwt-code-reviews.appspot.com/1450814/diff/1/dev/core/src/com/google/gwt/dev/jjs/impl/GwtAstBuilder.java
File dev/core/src/com/google/gwt/dev/jjs/impl/GwtAstBuilder.java
(right):
http://gwt-code-reviews.appspot.com/1450814/diff/1/dev/core/src/com/google/gwt/dev/jjs/impl/GwtAstBuilder.java#newcode2780
dev/core/src/com/google/gwt/dev/jjs/impl/GwtAstBuilder.java:2780: }
catch (Exception e) {
Unexpected that it would ever happen, but Java requires me to catch the
Exception types.
http://gwt-code-reviews.appspot.com/1450814/
--
http://groups.google.com/group/Google-Web-Toolkit-Contributors