ClassTreeImpl extends JavaTree implements ClassTree { @Override public int getLine() { if (simpleName == null) { return super.getLine(); } return ((IdentifierTreeImpl) simpleName).getLine(); } ClassTreeImpl(Kind kind, SyntaxToken openBraceToken, List<Tree> members, SyntaxToken closeBraceToken);  ClassTreeImpl(ModifiersTree modifiers, SyntaxToken openBraceToken, List<Tree> members, SyntaxToken closeBraceToken); ClassTreeImpl completeModifiers(ModifiersTreeImpl modifiers); ClassTreeImpl completeIdentifier(IdentifierTree identifier); ClassTreeImpl completeTypeParameters(TypeParameterListTreeImpl typeParameters); ClassTreeImpl completeSuperclass(SyntaxToken extendsKeyword, TypeTree superClass); ClassTreeImpl completeInterfaces(SyntaxToken keyword, QualifiedIdentifierListTreeImpl interfaces); ClassTreeImpl complete(InternalSyntaxToken atToken, InternalSyntaxToken interfaceToken, IdentifierTree simpleName); ClassTreeImpl completeDeclarationKeyword(SyntaxToken declarationKeyword); void completeRecordComponents(List<VariableTree> recordComponents); @Override Kind kind(); @Nullable @Override IdentifierTree simpleName(); @Override TypeParameters typeParameters(); @Override List<VariableTree> recordComponents(); @Override ModifiersTree modifiers(); @Nullable @Override TypeTree superClass(); @Override ListTree<TypeTree> superInterfaces(); @Override SyntaxToken openBraceToken(); @Override List<Tree> members(); @Override SyntaxToken closeBraceToken(); @Override Symbol.TypeSymbol symbol(); @Nullable @Override SyntaxToken declarationKeyword(); @Nullable SyntaxToken atToken(); @Override void accept(TreeVisitor visitor); @Override int getLine(); @Override Iterable<Tree> children(); @Nullable
  public ITypeBinding typeBinding; }
@Test void getLine() { CompilationUnitTree tree = createTree("class A {\n" + "A a = new A() {};" + "\n}"); ClassTree classTree = (ClassTree) tree.types().get(0); assertThat(((JavaTree) classTree).getLine()).isEqualTo(1); NewClassTree newClassTree = (NewClassTree) ((VariableTree) classTree.members().get(0)).initializer(); assertThat(((JavaTree)newClassTree.classBody()).getLine()).isEqualTo(2); }