use of com.google.devtools.j2objc.util.ElementUtil in project j2objc by google.
the class AnonymousClassConverterTest method testAnonymousClassExtracted.
/**
* Verify that an anonymous class is moved to the compilation unit's types list.
*/
public void testAnonymousClassExtracted() {
List<TypeDeclaration> types = translateClassBody("Object test() { return new java.util.Enumeration<Object>() { " + "public boolean hasMoreElements() { return false; } " + "public Object nextElement() { return null; } }; }");
assertEquals(2, types.size());
TypeDeclaration type = types.get(1);
ElementUtil elementUtil = TreeUtil.getCompilationUnit(type).getEnv().elementUtil();
assertEquals("Test$1", elementUtil.getBinaryName(type.getTypeElement()));
}
Aggregations