@Test public void testParseMethod() throws Exception { { FollowsReferenceBlockParser parser = new FollowsReferenceBlockParser(); DefaultJavadocScanner scanner = string("#method()"); IrDocBlock block = parser.parse(null, scanner); List<? extends IrDocFragment> fragments = block.getFragments(); assertKinds(fragments, METHOD); IrDocMethod method = (IrDocMethod) fragments.get(0); assertNull(method.getDeclaringType()); assertEquals("method", method.getName().getIdentifier()); assertEquals(0, method.getParameters().size()); } { FollowsReferenceBlockParser parser = new FollowsReferenceBlockParser(); DefaultJavadocScanner scanner = string("#method(int)"); IrDocBlock block = parser.parse(null, scanner); List<? extends IrDocFragment> fragments = block.getFragments(); assertKinds(fragments, METHOD); IrDocMethod method = (IrDocMethod) fragments.get(0); assertNull(method.getDeclaringType()); assertEquals("method", method.getName().getIdentifier()); assertEquals(1, method.getParameters().size()); { IrDocMethodParameter param = method.getParameters().get(0); assertEquals(BASIC_TYPE, param.getType().getKind()); assertEquals(IrBasicTypeKind.INT, ((IrDocBasicType) param.getType()).getTypeKind()); } } }
@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);  }