@Test public void testParse() throws Exception { { ParamBlockParser parser = new ParamBlockParser(); DefaultJavadocScanner scanner = string("a"); IrDocBlock block = parser.parse("param", scanner); List<? extends IrDocFragment> fragments = block.getFragments(); assertKinds(fragments, SIMPLE_NAME); assertEquals("a", ((IrDocSimpleName) fragments.get(0)).getIdentifier()); } { ParamBlockParser parser = new ParamBlockParser(); DefaultJavadocScanner scanner = string("a a parameter"); IrDocBlock block = parser.parse("param", scanner); List<? extends IrDocFragment> fragments = block.getFragments(); assertKinds(fragments, SIMPLE_NAME, TEXT); assertEquals("a", ((IrDocSimpleName) fragments.get(0)).getIdentifier()); assertTextEquals(" a parameter", fragments.get(1)); } { ParamBlockParser parser = new ParamBlockParser(); DefaultJavadocScanner scanner = string("<T> a parameter"); IrDocBlock block = parser.parse("param", scanner); List<? extends IrDocFragment> fragments = block.getFragments(); assertKinds(fragments, TEXT, SIMPLE_NAME, TEXT, TEXT); assertTextEquals("<", fragments.get(0)); assertEquals("T", ((IrDocSimpleName) fragments.get(1)).getIdentifier()); assertTextEquals(">", fragments.get(2)); assertTextEquals(" a parameter", fragments.get(3)); } { ParamBlockParser parser = new ParamBlockParser(); DefaultJavadocScanner scanner = string("<T< a parameter"); IrDocBlock block = parser.parse("param", scanner); List<? extends IrDocFragment> fragments = block.getFragments(); assertKinds(fragments, TEXT); assertTextEquals("<T< a parameter", fragments.get(0)); } }
@Override public IrDocBlock parse(String tag, JavadocScanner scanner) throws JavadocParseException { ArrayList<IrDocFragment> fragments = new ArrayList<>(); IrDocSimpleName name = fetchSimpleName(scanner); if (name != null) { fragments.add(name); } else { consumeIfTypeParameter(scanner, fragments); } fragments.addAll(fetchRestFragments(scanner)); fragments.trimToSize(); return newBlock(tag, fragments); }
ParamBlockParser extends AcceptableJavadocBlockParser { @Override public IrDocBlock parse(String tag, JavadocScanner scanner) throws JavadocParseException { ArrayList<IrDocFragment> fragments = new ArrayList<>(); IrDocSimpleName name = fetchSimpleName(scanner); if (name != null) { fragments.add(name); } else { consumeIfTypeParameter(scanner, fragments); } fragments.addAll(fetchRestFragments(scanner)); fragments.trimToSize(); return newBlock(tag, fragments); } }
ParamBlockParser extends AcceptableJavadocBlockParser { @Override public IrDocBlock parse(String tag, JavadocScanner scanner) throws JavadocParseException { ArrayList<IrDocFragment> fragments = new ArrayList<>(); IrDocSimpleName name = fetchSimpleName(scanner); if (name != null) { fragments.add(name); } else { consumeIfTypeParameter(scanner, fragments); } fragments.addAll(fetchRestFragments(scanner)); fragments.trimToSize(); return newBlock(tag, fragments); } ParamBlockParser();  ParamBlockParser(String tagName, String... tagNames); }
ParamBlockParser extends AcceptableJavadocBlockParser { @Override public IrDocBlock parse(String tag, JavadocScanner scanner) throws JavadocParseException { ArrayList<IrDocFragment> fragments = new ArrayList<>(); IrDocSimpleName name = fetchSimpleName(scanner); if (name != null) { fragments.add(name); } else { consumeIfTypeParameter(scanner, fragments); } fragments.addAll(fetchRestFragments(scanner)); fragments.trimToSize(); return newBlock(tag, fragments); } ParamBlockParser();  ParamBlockParser(String tagName, String... tagNames); @Override IrDocBlock parse(String tag, JavadocScanner scanner); }
ParamBlockParser extends AcceptableJavadocBlockParser { @Override public IrDocBlock parse(String tag, JavadocScanner scanner) throws JavadocParseException { ArrayList<IrDocFragment> fragments = new ArrayList<>(); IrDocSimpleName name = fetchSimpleName(scanner); if (name != null) { fragments.add(name); } else { consumeIfTypeParameter(scanner, fragments); } fragments.addAll(fetchRestFragments(scanner)); fragments.trimToSize(); return newBlock(tag, fragments); } ParamBlockParser();  ParamBlockParser(String tagName, String... tagNames); @Override IrDocBlock parse(String tag, JavadocScanner scanner);  }