Search in sources :

Example 31 with AbstractTypeDeclaration

use of com.google.devtools.j2objc.ast.AbstractTypeDeclaration in project j2objc by google.

the class PackagePrefixesTest method testGetFullNameWithInnerClassAndPrefix.

// Verify inner class name with prefix.
public void testGetFullNameWithInnerClassAndPrefix() {
    String source = "package foo.bar; public class SomeClass { static class Inner {}}";
    options.getPackagePrefixes().addPrefix("foo.bar", "FB");
    CompilationUnit unit = translateType("SomeClass", source);
    NameTable nameTable = unit.getEnv().nameTable();
    AbstractTypeDeclaration decl = unit.getTypes().get(1);
    assertEquals("FBSomeClass_Inner", nameTable.getFullName(decl.getTypeElement()));
}
Also used : CompilationUnit(com.google.devtools.j2objc.ast.CompilationUnit) AbstractTypeDeclaration(com.google.devtools.j2objc.ast.AbstractTypeDeclaration)

Aggregations

AbstractTypeDeclaration (com.google.devtools.j2objc.ast.AbstractTypeDeclaration)31 CompilationUnit (com.google.devtools.j2objc.ast.CompilationUnit)23 TypeElement (javax.lang.model.element.TypeElement)6 TypeMirror (javax.lang.model.type.TypeMirror)4 BodyDeclaration (com.google.devtools.j2objc.ast.BodyDeclaration)3 VariableDeclarationFragment (com.google.devtools.j2objc.ast.VariableDeclarationFragment)3 NameTable (com.google.devtools.j2objc.util.NameTable)3 MethodDeclaration (com.google.devtools.j2objc.ast.MethodDeclaration)2 ReturnStatement (com.google.devtools.j2objc.ast.ReturnStatement)2 TreeNode (com.google.devtools.j2objc.ast.TreeNode)2 TypeDeclaration (com.google.devtools.j2objc.ast.TypeDeclaration)2 AnnotationMirror (javax.lang.model.element.AnnotationMirror)2 ExecutableElement (javax.lang.model.element.ExecutableElement)2 Annotation (com.google.devtools.j2objc.ast.Annotation)1 AnnotationTypeDeclaration (com.google.devtools.j2objc.ast.AnnotationTypeDeclaration)1 Block (com.google.devtools.j2objc.ast.Block)1 Comment (com.google.devtools.j2objc.ast.Comment)1 EnumDeclaration (com.google.devtools.j2objc.ast.EnumDeclaration)1 Expression (com.google.devtools.j2objc.ast.Expression)1 ExpressionStatement (com.google.devtools.j2objc.ast.ExpressionStatement)1