@Test public void testParseType() throws Exception { { FollowsReferenceBlockParser parser = new FollowsReferenceBlockParser(); DefaultJavadocScanner scanner = string("A"); IrDocBlock block = parser.parse(null, scanner); List<? extends IrDocFragment> fragments = block.getFragments(); assertKinds(fragments, NAMED_TYPE); assertEquals("A", ((IrDocNamedType) fragments.get(0)).getName().asString()); } { FollowsReferenceBlockParser parser = new FollowsReferenceBlockParser(); DefaultJavadocScanner scanner = string("hoge.foo.Bar"); IrDocBlock block = parser.parse(null, scanner); List<? extends IrDocFragment> fragments = block.getFragments(); assertKinds(fragments, NAMED_TYPE); assertEquals("hoge.foo.Bar", ((IrDocNamedType) fragments.get(0)).getName().asString()); } { FollowsReferenceBlockParser parser = new FollowsReferenceBlockParser(); DefaultJavadocScanner scanner = string( "\n" + " * hoge.foo.Bar"); IrDocBlock block = parser.parse(null, scanner); List<? extends IrDocFragment> fragments = block.getFragments(); assertKinds(fragments, NAMED_TYPE); assertEquals("hoge.foo.Bar", ((IrDocNamedType) fragments.get(0)).getName().asString()); } { FollowsReferenceBlockParser parser = new FollowsReferenceBlockParser(); DefaultJavadocScanner scanner = string( "\n" + " * hoge.foo.Bar?"); IrDocBlock block = parser.parse(null, scanner); List<? extends IrDocFragment> fragments = block.getFragments(); assertKinds(fragments, TEXT); assertTextEquals("hoge.foo.Bar?", fragments.get(0)); } { FollowsReferenceBlockParser parser = new FollowsReferenceBlockParser(); DefaultJavadocScanner scanner = string( " hoge.foo.Bar This is a pen."); IrDocBlock block = parser.parse(null, scanner); List<? extends IrDocFragment> fragments = block.getFragments(); assertKinds(fragments, NAMED_TYPE, TEXT); assertEquals("hoge.foo.Bar", ((IrDocNamedType) fragments.get(0)).getName().asString()); assertTextEquals(" This is a pen.", fragments.get(1)); } }
@Override public IrDocBlock parse(String tag, JavadocScanner scanner) throws JavadocParseException { ArrayList<IrDocFragment> fragments = new ArrayList<>(); IrDocFragment first = fetchLinkTarget(scanner); if (first != null) { fragments.add(first); } fragments.addAll(fetchRestFragments(scanner)); fragments.trimToSize(); return newBlock(tag, fragments); }
FollowsReferenceBlockParser extends AcceptableJavadocBlockParser { @Override public IrDocBlock parse(String tag, JavadocScanner scanner) throws JavadocParseException { ArrayList<IrDocFragment> fragments = new ArrayList<>(); IrDocFragment first = fetchLinkTarget(scanner); if (first != null) { fragments.add(first); } fragments.addAll(fetchRestFragments(scanner)); fragments.trimToSize(); return newBlock(tag, fragments); } }
FollowsReferenceBlockParser extends AcceptableJavadocBlockParser { @Override public IrDocBlock parse(String tag, JavadocScanner scanner) throws JavadocParseException { ArrayList<IrDocFragment> fragments = new ArrayList<>(); IrDocFragment first = fetchLinkTarget(scanner); if (first != null) { fragments.add(first); } fragments.addAll(fetchRestFragments(scanner)); fragments.trimToSize(); return newBlock(tag, fragments); } FollowsReferenceBlockParser(String...tagNames); }
FollowsReferenceBlockParser extends AcceptableJavadocBlockParser { @Override public IrDocBlock parse(String tag, JavadocScanner scanner) throws JavadocParseException { ArrayList<IrDocFragment> fragments = new ArrayList<>(); IrDocFragment first = fetchLinkTarget(scanner); if (first != null) { fragments.add(first); } fragments.addAll(fetchRestFragments(scanner)); fragments.trimToSize(); return newBlock(tag, fragments); } FollowsReferenceBlockParser(String...tagNames); @Override IrDocBlock parse(String tag, JavadocScanner scanner); }
FollowsReferenceBlockParser extends AcceptableJavadocBlockParser { @Override public IrDocBlock parse(String tag, JavadocScanner scanner) throws JavadocParseException { ArrayList<IrDocFragment> fragments = new ArrayList<>(); IrDocFragment first = fetchLinkTarget(scanner); if (first != null) { fragments.add(first); } fragments.addAll(fetchRestFragments(scanner)); fragments.trimToSize(); return newBlock(tag, fragments); } FollowsReferenceBlockParser(String...tagNames); @Override IrDocBlock parse(String tag, JavadocScanner scanner);  }