Link Here
|
4071 |
"\n" + |
4071 |
"\n" + |
4072 |
" /**\n" + |
4072 |
" /**\n" + |
4073 |
" * Returns the change directly associated with this change element or <code\n" + |
4073 |
" * Returns the change directly associated with this change element or <code\n" + |
4074 |
" * null</code>\n" + |
4074 |
" * null</code> if the element isn\'t associated with a change.\n" + |
4075 |
" * if the element isn\'t associated with a change.\n" + |
|
|
4076 |
" * \n" + |
4075 |
" * \n" + |
4077 |
" * @return the change or <code>null</code>\n" + |
4076 |
" * @return the change or <code>null</code>\n" + |
4078 |
" */\n" + |
4077 |
" */\n" + |
Link Here
|
4398 |
} |
4397 |
} |
4399 |
|
4398 |
|
4400 |
/** |
4399 |
/** |
|
|
4400 |
* @bug 260381: [formatter] Javadoc formatter breaks {@code ...} tags. |
4401 |
* @test Ensure that the @code tag is similar to <code> HTML tag |
4402 |
* @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=260381" |
4403 |
*/ |
4404 |
public void testBug260381() throws JavaModelException { |
4405 |
String source = |
4406 |
"/**\n" + |
4407 |
" * Comments that can be formated in several lines...\n" + |
4408 |
" * \n" + |
4409 |
" * @author Myself\n" + |
4410 |
" * @version {@code $Revision: 1.2 $ $Date: 2009/01/07 12:27:50 $ $Author:myself $ $Source: /projects/cvs/module/project/src/com/foo/Main.java,v $}\n" + |
4411 |
" */\n" + |
4412 |
"public class X01 {\n" + |
4413 |
"}\n"; |
4414 |
formatSource(source); |
4415 |
} |
4416 |
public void testBug260381b() throws JavaModelException { |
4417 |
String source = |
4418 |
"/**\n" + |
4419 |
" * Comments that can be formated in several lines...\n" + |
4420 |
" * \n" + |
4421 |
" * @author Myself\n" + |
4422 |
" * @version <code>$Revision: 1.2 $ $Date: 2009/01/07 12:27:50 $ $Author:myself $ $Source: /projects/cvs/module/project/src/com/foo/Main.java,v $</code>\n" + |
4423 |
" */\n" + |
4424 |
"public class X01b {\n" + |
4425 |
"}\n"; |
4426 |
formatSource(source); |
4427 |
} |
4428 |
public void testBug260381c() throws JavaModelException { |
4429 |
String source = |
4430 |
"/**\n" + |
4431 |
" * Comments that can be formated in several lines...\n" + |
4432 |
" * \n" + |
4433 |
" * @author Myself\n" + |
4434 |
" * @version\n" + |
4435 |
" * <code>3.0 xxxxxxxxxxxxxx xwxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx</code>\n" + |
4436 |
" */\n" + |
4437 |
"public class X01c {\n" + |
4438 |
"}\n"; |
4439 |
formatSource(source, |
4440 |
"/**\n" + |
4441 |
" * Comments that can be formated in several lines...\n" + |
4442 |
" * \n" + |
4443 |
" * @author Myself\n" + |
4444 |
" * @version <code>3.0 xxxxxxxxxxxxxx xwxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx</code>\n" + |
4445 |
" */\n" + |
4446 |
"public class X01c {\n" + |
4447 |
"}\n" |
4448 |
); |
4449 |
} |
4450 |
public void testBug260381d() throws JavaModelException { |
4451 |
String source = |
4452 |
"/**\n" + |
4453 |
" * Comments that can be formated in several lines...\n" + |
4454 |
" * \n" + |
4455 |
" * @author Myself\n" + |
4456 |
" * @see Object <code>$Revision: 1.2 $ $Date: 2009/01/07 12:27:50 $ $Author:myself $ $Source: /projects/cvs/module/project/src/com/foo/Main.java,v $</code>\n" + |
4457 |
" */\n" + |
4458 |
"public class X02 {\n" + |
4459 |
"}\n"; |
4460 |
formatSource(source, |
4461 |
"/**\n" + |
4462 |
" * Comments that can be formated in several lines...\n" + |
4463 |
" * \n" + |
4464 |
" * @author Myself\n" + |
4465 |
" * @see Object\n" + |
4466 |
" * <code>$Revision: 1.2 $ $Date: 2009/01/07 12:27:50 $ $Author:myself $ $Source: /projects/cvs/module/project/src/com/foo/Main.java,v $</code>\n" + |
4467 |
" */\n" + |
4468 |
"public class X02 {\n" + |
4469 |
"}\n" |
4470 |
); |
4471 |
} |
4472 |
public void testBug260381e() throws JavaModelException { |
4473 |
String source = |
4474 |
"/**\n" + |
4475 |
" * Comments that can be formated in several lines...\n" + |
4476 |
" * \n" + |
4477 |
" * {@code $Revision: 1.2 $ $Date: 2009/01/07 12:27:50 $ $Author:myself $\n" + |
4478 |
" * $Source: /projects/cvs/module/project/src/com/foo/Main.java,v $}\n" + |
4479 |
" */\n" + |
4480 |
"public class X03 {\n" + |
4481 |
"}\n"; |
4482 |
formatSource(source); |
4483 |
} |
4484 |
public void testBug260381f() throws JavaModelException { |
4485 |
String source = |
4486 |
"/**\n" + |
4487 |
" * Literal inline tag should also be untouched by the formatter\n" + |
4488 |
" * \n" + |
4489 |
" * @version {@literal $Revision: 1.2 $ $Date: 2009/01/07 12:27:50 $ $Author:myself $ $Source: /projects/cvs/module/project/src/com/foo/Main.java,v $}\n" + |
4490 |
" */\n" + |
4491 |
"public class X04 {\n" + |
4492 |
"\n" + |
4493 |
"}\n"; |
4494 |
formatSource(source); |
4495 |
} |
4496 |
public void testBug260381_wksp1_01() throws JavaModelException { |
4497 |
String source = |
4498 |
"package wksp1;\n" + |
4499 |
"\n" + |
4500 |
"public interface I01 {\n" + |
4501 |
"\n" + |
4502 |
" /**\n" + |
4503 |
" * Returns all configured content types for the given source viewer. This list\n" + |
4504 |
" * tells the caller which content types must be configured for the given source \n" + |
4505 |
" * viewer, i.e. for which content types the given source viewer\'s functionalities\n" + |
4506 |
" * must be specified. This implementation always returns <code>\n" + |
4507 |
" * new String[] { IDocument.DEFAULT_CONTENT_TYPE }</code>.\n" + |
4508 |
" *\n" + |
4509 |
" * @param source the source viewer to be configured by this configuration\n" + |
4510 |
" * @return the configured content types for the given viewer\n" + |
4511 |
" */\n" + |
4512 |
" public String[] getConfiguredContentTypes(String source);\n" + |
4513 |
"}\n"; |
4514 |
formatSource(source, |
4515 |
"package wksp1;\n" + |
4516 |
"\n" + |
4517 |
"public interface I01 {\n" + |
4518 |
"\n" + |
4519 |
" /**\n" + |
4520 |
" * Returns all configured content types for the given source viewer. This\n" + |
4521 |
" * list tells the caller which content types must be configured for the\n" + |
4522 |
" * given source viewer, i.e. for which content types the given source\n" + |
4523 |
" * viewer\'s functionalities must be specified. This implementation always\n" + |
4524 |
" * returns <code>\n" + |
4525 |
" * new String[] { IDocument.DEFAULT_CONTENT_TYPE }</code>.\n" + |
4526 |
" * \n" + |
4527 |
" * @param source\n" + |
4528 |
" * the source viewer to be configured by this configuration\n" + |
4529 |
" * @return the configured content types for the given viewer\n" + |
4530 |
" */\n" + |
4531 |
" public String[] getConfiguredContentTypes(String source);\n" + |
4532 |
"}\n" |
4533 |
); |
4534 |
} |
4535 |
public void testBug260381_wksp2_01() throws JavaModelException { |
4536 |
String source = |
4537 |
"package wksp2;\n" + |
4538 |
"public interface I01 {\n" + |
4539 |
" /**\n" + |
4540 |
" * Returns the composition of two functions. For {@code f: A->B} and\n" + |
4541 |
" * {@code g: B->C}, composition is defined as the function h such that\n" + |
4542 |
" * {@code h(a) == g(f(a))} for each {@code a}.\n" + |
4543 |
" *\n" + |
4544 |
" * @see <a href=\"//en.wikipedia.org/wiki/Function_composition\">\n" + |
4545 |
" * function composition</a>\n" + |
4546 |
" *\n" + |
4547 |
" * @param g the second function to apply\n" + |
4548 |
" * @param f the first function to apply\n" + |
4549 |
" * @return the composition of {@code f} and {@code g}\n" + |
4550 |
" */\n" + |
4551 |
" void foo();\n" + |
4552 |
"}\n"; |
4553 |
formatSource(source, |
4554 |
"package wksp2;\n" + |
4555 |
"\n" + |
4556 |
"public interface I01 {\n" + |
4557 |
" /**\n" + |
4558 |
" * Returns the composition of two functions. For {@code f: A->B} and\n" + |
4559 |
" * {@code g: B->C}, composition is defined as the function h such that\n" + |
4560 |
" * {@code h(a) == g(f(a))} for each {@code a}.\n" + |
4561 |
" * \n" + |
4562 |
" * @see <a href=\"//en.wikipedia.org/wiki/Function_composition\"> function\n" + |
4563 |
" * composition</a>\n" + |
4564 |
" * \n" + |
4565 |
" * @param g\n" + |
4566 |
" * the second function to apply\n" + |
4567 |
" * @param f\n" + |
4568 |
" * the first function to apply\n" + |
4569 |
" * @return the composition of {@code f} and {@code g}\n" + |
4570 |
" */\n" + |
4571 |
" void foo();\n" + |
4572 |
"}\n" |
4573 |
); |
4574 |
} |
4575 |
public void testBug260381_wksp2_01b() throws JavaModelException { |
4576 |
String source = |
4577 |
"package wksp2;\n" + |
4578 |
"public interface I01b {\n" + |
4579 |
" /**\n" + |
4580 |
" * Returns the composition of two functions. For <code> f: A->B</code> and\n" + |
4581 |
" * <code> g: B->C</code>, composition is defined as the function h such that\n" + |
4582 |
" * <code> h(a) == g(f(a))</code> for each <code> a</code>.\n" + |
4583 |
" *\n" + |
4584 |
" * @see <a href=\"//en.wikipedia.org/wiki/Function_composition\">\n" + |
4585 |
" * function composition</a>\n" + |
4586 |
" *\n" + |
4587 |
" * @param g the second function to apply\n" + |
4588 |
" * @param f the first function to apply\n" + |
4589 |
" * @return the composition of <code> f</code> and <code> g</code>\n" + |
4590 |
" */\n" + |
4591 |
" void foo();\n" + |
4592 |
"}\n"; |
4593 |
formatSource(source, |
4594 |
"package wksp2;\n" + |
4595 |
"\n" + |
4596 |
"public interface I01b {\n" + |
4597 |
" /**\n" + |
4598 |
" * Returns the composition of two functions. For <code> f: A->B</code> and\n" + |
4599 |
" * <code> g: B->C</code>, composition is defined as the function h such that\n" + |
4600 |
" * <code> h(a) == g(f(a))</code> for each <code> a</code>.\n" + |
4601 |
" * \n" + |
4602 |
" * @see <a href=\"//en.wikipedia.org/wiki/Function_composition\"> function\n" + |
4603 |
" * composition</a>\n" + |
4604 |
" * \n" + |
4605 |
" * @param g\n" + |
4606 |
" * the second function to apply\n" + |
4607 |
" * @param f\n" + |
4608 |
" * the first function to apply\n" + |
4609 |
" * @return the composition of <code> f</code> and <code> g</code>\n" + |
4610 |
" */\n" + |
4611 |
" void foo();\n" + |
4612 |
"}\n" |
4613 |
); |
4614 |
} |
4615 |
public void testBug260381_wksp2_01c() throws JavaModelException { |
4616 |
String source = |
4617 |
"package wksp2;\n" + |
4618 |
"public interface I01c {\n" + |
4619 |
" /**\n" + |
4620 |
" * Returns the composition of two functions. For <code> f: A->B</code> and\n" + |
4621 |
" * <code>\n" + |
4622 |
" * g: B->C\n" + |
4623 |
" * </code>,\n" + |
4624 |
" * composition is defined as the function h such that\n" + |
4625 |
" * <code>\n" + |
4626 |
" * h(a) == g(f(a))\n" + |
4627 |
" * </code>\n" + |
4628 |
" * for each\n" + |
4629 |
" * <code>\n" + |
4630 |
" * a\n" + |
4631 |
" * </code>.\n" + |
4632 |
" *\n" + |
4633 |
" * @see <a href=\"//en.wikipedia.org/wiki/Function_composition\">\n" + |
4634 |
" * function composition</a>\n" + |
4635 |
" *\n" + |
4636 |
" * @param g the second function to apply\n" + |
4637 |
" * @param f the first function to apply\n" + |
4638 |
" * @return the composition of <code> f</code> and <code> g</code>\n" + |
4639 |
" */\n" + |
4640 |
" void foo();\n" + |
4641 |
"}\n"; |
4642 |
formatSource(source, |
4643 |
"package wksp2;\n" + |
4644 |
"\n" + |
4645 |
"public interface I01c {\n" + |
4646 |
" /**\n" + |
4647 |
" * Returns the composition of two functions. For <code> f: A->B</code> and\n" + |
4648 |
" * <code>\n" + |
4649 |
" * g: B->C\n" + |
4650 |
" * </code>, composition is defined as the function h such that <code>\n" + |
4651 |
" * h(a) == g(f(a))\n" + |
4652 |
" * </code> for each <code>\n" + |
4653 |
" * a\n" + |
4654 |
" * </code>.\n" + |
4655 |
" * \n" + |
4656 |
" * @see <a href=\"//en.wikipedia.org/wiki/Function_composition\"> function\n" + |
4657 |
" * composition</a>\n" + |
4658 |
" * \n" + |
4659 |
" * @param g\n" + |
4660 |
" * the second function to apply\n" + |
4661 |
" * @param f\n" + |
4662 |
" * the first function to apply\n" + |
4663 |
" * @return the composition of <code> f</code> and <code> g</code>\n" + |
4664 |
" */\n" + |
4665 |
" void foo();\n" + |
4666 |
"}\n" |
4667 |
); |
4668 |
} |
4669 |
public void testBug260381_wksp2_02() throws JavaModelException { |
4670 |
String source = |
4671 |
"package wksp2;\n" + |
4672 |
"\n" + |
4673 |
"public interface I02 {\n" + |
4674 |
"\n" + |
4675 |
" /**\n" + |
4676 |
" * Implementations of {@code computeNext} <b>must</b> invoke this method when\n" + |
4677 |
" * there are no elements left in the iteration.\n" + |
4678 |
" *\n" + |
4679 |
" * @return {@code null}; a convenience so your {@link #computeNext}\n" + |
4680 |
" * implementation can use the simple statement {@code return endOfData();}\n" + |
4681 |
" */\n" + |
4682 |
" void foo();\n" + |
4683 |
"}\n"; |
4684 |
formatSource(source, |
4685 |
"package wksp2;\n" + |
4686 |
"\n" + |
4687 |
"public interface I02 {\n" + |
4688 |
"\n" + |
4689 |
" /**\n" + |
4690 |
" * Implementations of {@code computeNext} <b>must</b> invoke this method\n" + |
4691 |
" * when there are no elements left in the iteration.\n" + |
4692 |
" * \n" + |
4693 |
" * @return {@code null}; a convenience so your {@link #computeNext}\n" + |
4694 |
" * implementation can use the simple statement\n" + |
4695 |
" * {@code return endOfData();}\n" + |
4696 |
" */\n" + |
4697 |
" void foo();\n" + |
4698 |
"}\n" |
4699 |
); |
4700 |
} |
4701 |
public void testBug260381_wksp2_03() throws JavaModelException { |
4702 |
String source = |
4703 |
"package wksp2;\n" + |
4704 |
"\n" + |
4705 |
"public interface I03 {\n" + |
4706 |
" /**\n" + |
4707 |
" * A builder for creating immutable bimap instances, especially {@code public\n" + |
4708 |
" * static final} bimaps (\"constant bimaps\"). Example: <pre> {@code\n" + |
4709 |
" *\n" + |
4710 |
" * static final ImmutableBiMap<String, Integer> WORD_TO_INT =\n" + |
4711 |
" * new ImmutableBiMap.Builder<String, Integer>()\n" + |
4712 |
" * .put(\"one\", 1)\n" + |
4713 |
" * .put(\"two\", 2)\n" + |
4714 |
" * .put(\"three\", 3)\n" + |
4715 |
" * .build();}</pre>\n" + |
4716 |
" *\n" + |
4717 |
" * For <i>small</i> immutable bimaps, the {@code ImmutableBiMap.of()} methods\n" + |
4718 |
" * are even more convenient.\n" + |
4719 |
" *\n" + |
4720 |
" * <p>Builder instances can be reused - it is safe to call {@link #build}\n" + |
4721 |
" * multiple times to build multiple bimaps in series. Each bimap is a superset\n" + |
4722 |
" * of the bimaps created before it.\n" + |
4723 |
" */\n" + |
4724 |
" void foo();\n" + |
4725 |
"}\n"; |
4726 |
formatSource(source, |
4727 |
"package wksp2;\n" + |
4728 |
"\n" + |
4729 |
"public interface I03 {\n" + |
4730 |
" /**\n" + |
4731 |
" * A builder for creating immutable bimap instances, especially\n" + |
4732 |
" * {@code public static final} bimaps (\"constant bimaps\"). Example:\n" + |
4733 |
" * \n" + |
4734 |
" * <pre>\n" + |
4735 |
" * {\n" + |
4736 |
" * @code\n" + |
4737 |
" * static final ImmutableBiMap<String, Integer> WORD_TO_INT = new ImmutableBiMap.Builder<String, Integer>()\n" + |
4738 |
" * .put("one", 1).put("two", 2).put("three", 3).build();\n" + |
4739 |
" * }\n" + |
4740 |
" * </pre>\n" + |
4741 |
" * \n" + |
4742 |
" * For <i>small</i> immutable bimaps, the {@code ImmutableBiMap.of()}\n" + |
4743 |
" * methods are even more convenient.\n" + |
4744 |
" * \n" + |
4745 |
" * <p>\n" + |
4746 |
" * Builder instances can be reused - it is safe to call {@link #build}\n" + |
4747 |
" * multiple times to build multiple bimaps in series. Each bimap is a\n" + |
4748 |
" * superset of the bimaps created before it.\n" + |
4749 |
" */\n" + |
4750 |
" void foo();\n" + |
4751 |
"}\n" |
4752 |
); |
4753 |
} |
4754 |
public void testBug260381_wksp2_04() throws JavaModelException { |
4755 |
String source = |
4756 |
"package wksp2;\n" + |
4757 |
"\n" + |
4758 |
"public interface I04 {\n" + |
4759 |
"\n" + |
4760 |
" /**\n" + |
4761 |
" * Returns an immutable multiset containing the given elements.\n" + |
4762 |
" * \n" + |
4763 |
" * <p>The multiset is ordered by the first occurrence of each element. For\n" + |
4764 |
" * example, {@code ImmutableMultiset.copyOf(Arrays.asList(2, 3, 1, 3))} yields\n" + |
4765 |
" * a multiset with elements in the order {@code 2, 3, 3, 1}.\n" + |
4766 |
" *\n" + |
4767 |
" * <p>Note that if {@code c} is a {@code Collection<String>}, then {@code\n" + |
4768 |
" * ImmutableMultiset.copyOf(c)} returns an {@code ImmutableMultiset<String>}\n" + |
4769 |
" * containing each of the strings in {@code c}, while\n" + |
4770 |
" * {@code ImmutableMultiset.of(c)} returns an\n" + |
4771 |
" * {@code ImmutableMultiset<Collection<String>>} containing one element (the\n" + |
4772 |
" * given collection itself).\n" + |
4773 |
" *\n" + |
4774 |
" * <p><b>Note:</b> Despite what the method name suggests, if {@code elements}\n" + |
4775 |
" * is an {@code ImmutableMultiset}, no copy will actually be performed, and\n" + |
4776 |
" * the given multiset itself will be returned.\n" + |
4777 |
" *\n" + |
4778 |
" * @throws NullPointerException if any of {@code elements} is null\n" + |
4779 |
" */\n" + |
4780 |
" void foo();\n" + |
4781 |
"}\n"; |
4782 |
formatSource(source, |
4783 |
"package wksp2;\n" + |
4784 |
"\n" + |
4785 |
"public interface I04 {\n" + |
4786 |
"\n" + |
4787 |
" /**\n" + |
4788 |
" * Returns an immutable multiset containing the given elements.\n" + |
4789 |
" * \n" + |
4790 |
" * <p>\n" + |
4791 |
" * The multiset is ordered by the first occurrence of each element. For\n" + |
4792 |
" * example, {@code ImmutableMultiset.copyOf(Arrays.asList(2, 3, 1, 3))}\n" + |
4793 |
" * yields a multiset with elements in the order {@code 2, 3, 3, 1}.\n" + |
4794 |
" * \n" + |
4795 |
" * <p>\n" + |
4796 |
" * Note that if {@code c} is a {@code Collection<String>}, then\n" + |
4797 |
" * {@code ImmutableMultiset.copyOf(c)} returns an\n" + |
4798 |
" * {@code ImmutableMultiset<String>} containing each of the strings in\n" + |
4799 |
" * {@code c}, while {@code ImmutableMultiset.of(c)} returns an\n" + |
4800 |
" * {@code ImmutableMultiset<Collection<String>>} containing one element (the\n" + |
4801 |
" * given collection itself).\n" + |
4802 |
" * \n" + |
4803 |
" * <p>\n" + |
4804 |
" * <b>Note:</b> Despite what the method name suggests, if {@code elements}\n" + |
4805 |
" * is an {@code ImmutableMultiset}, no copy will actually be performed, and\n" + |
4806 |
" * the given multiset itself will be returned.\n" + |
4807 |
" * \n" + |
4808 |
" * @throws NullPointerException\n" + |
4809 |
" * if any of {@code elements} is null\n" + |
4810 |
" */\n" + |
4811 |
" void foo();\n" + |
4812 |
"}\n" |
4813 |
); |
4814 |
} |
4815 |
public void testBug260381_wksp2_05() throws JavaModelException { |
4816 |
String source = |
4817 |
"package wksp2;\n" + |
4818 |
"\n" + |
4819 |
"public interface I05 {\n" + |
4820 |
"\n" + |
4821 |
" /**\n" + |
4822 |
" * Indexes the specified values into a {@code Multimap} by applying a\n" + |
4823 |
" * specified function to each item in an {@code Iterable} of values. Each\n" + |
4824 |
" * value will be stored as a value in the specified multimap. The key used to\n" + |
4825 |
" * store that value in the multimap will be the result of calling the function\n" + |
4826 |
" * on that value. Depending on the multimap implementation, duplicate entries\n" + |
4827 |
" * (equal keys and equal values) may be collapsed.\n" + |
4828 |
" *\n" + |
4829 |
" * <p>For example,\n" + |
4830 |
" *\n" + |
4831 |
" * <pre class=\"code\">\n" + |
4832 |
" * List<String> badGuys =\n" + |
4833 |
" * Arrays.asList(\"Inky\", \"Blinky\", \"Pinky\", \"Pinky\", \"Clyde\");\n" + |
4834 |
" * Function<String, Integer> stringLengthFunction = ...;\n" + |
4835 |
" * Multimap<Integer, String> index = Multimaps.newHashMultimap();\n" + |
4836 |
" * Multimaps.index(badGuys, stringLengthFunction, index);\n" + |
4837 |
" * System.out.println(index); </pre>\n" + |
4838 |
" *\n" + |
4839 |
" * prints\n" + |
4840 |
" *\n" + |
4841 |
" * <pre class=\"code\">\n" + |
4842 |
" * {4=[Inky], 5=[Pinky, Clyde], 6=[Blinky]} </pre>\n" + |
4843 |
" *\n" + |
4844 |
" * The {@link HashMultimap} collapses the duplicate occurrence of\n" + |
4845 |
" * {@code (5, \"Pinky\")}.\n" + |
4846 |
" *\n" + |
4847 |
" * @param values the values to add to the multimap\n" + |
4848 |
" * @param keyFunction the function used to produce the key for each value\n" + |
4849 |
" * @param multimap the multimap to store the key value pairs\n" + |
4850 |
" */\n" + |
4851 |
" void foo();\n" + |
4852 |
"}\n"; |
4853 |
formatSource(source, |
4854 |
"package wksp2;\n" + |
4855 |
"\n" + |
4856 |
"public interface I05 {\n" + |
4857 |
"\n" + |
4858 |
" /**\n" + |
4859 |
" * Indexes the specified values into a {@code Multimap} by applying a\n" + |
4860 |
" * specified function to each item in an {@code Iterable} of values. Each\n" + |
4861 |
" * value will be stored as a value in the specified multimap. The key used\n" + |
4862 |
" * to store that value in the multimap will be the result of calling the\n" + |
4863 |
" * function on that value. Depending on the multimap implementation,\n" + |
4864 |
" * duplicate entries (equal keys and equal values) may be collapsed.\n" + |
4865 |
" * \n" + |
4866 |
" * <p>\n" + |
4867 |
" * For example,\n" + |
4868 |
" * \n" + |
4869 |
" * <pre class=\"code\">\n" + |
4870 |
" * List<String> badGuys =\n" + |
4871 |
" * Arrays.asList(\"Inky\", \"Blinky\", \"Pinky\", \"Pinky\", \"Clyde\");\n" + |
4872 |
" * Function<String, Integer> stringLengthFunction = ...;\n" + |
4873 |
" * Multimap<Integer, String> index = Multimaps.newHashMultimap();\n" + |
4874 |
" * Multimaps.index(badGuys, stringLengthFunction, index);\n" + |
4875 |
" * System.out.println(index);\n" + |
4876 |
" * </pre>\n" + |
4877 |
" * \n" + |
4878 |
" * prints\n" + |
4879 |
" * \n" + |
4880 |
" * <pre class=\"code\">\n" + |
4881 |
" * {4=[Inky], 5=[Pinky, Clyde], 6=[Blinky]}\n" + |
4882 |
" * </pre>\n" + |
4883 |
" * \n" + |
4884 |
" * The {@link HashMultimap} collapses the duplicate occurrence of\n" + |
4885 |
" * {@code (5, \"Pinky\")}.\n" + |
4886 |
" * \n" + |
4887 |
" * @param values\n" + |
4888 |
" * the values to add to the multimap\n" + |
4889 |
" * @param keyFunction\n" + |
4890 |
" * the function used to produce the key for each value\n" + |
4891 |
" * @param multimap\n" + |
4892 |
" * the multimap to store the key value pairs\n" + |
4893 |
" */\n" + |
4894 |
" void foo();\n" + |
4895 |
"}\n" |
4896 |
); |
4897 |
} |
4898 |
public void testBug260381_wksp2_06() throws JavaModelException { |
4899 |
String source = |
4900 |
"package wksp2;\n" + |
4901 |
"\n" + |
4902 |
"public interface I06 {\n" + |
4903 |
"\n" + |
4904 |
" /**\n" + |
4905 |
" * Adds a number of occurrences of an element to this multiset. Note that if\n" + |
4906 |
" * {@code occurrences == 1}, this method has the identical effect to {@link\n" + |
4907 |
" * #add(Object)}. This method is functionally equivalent (except in the case\n" + |
4908 |
" * of overflow) to the call {@code addAll(Collections.nCopies(element,\n" + |
4909 |
" * occurrences))}, which would presumably perform much more poorly.\n" + |
4910 |
" *\n" + |
4911 |
" * @param element the element to add occurrences of; may be {@code null} only\n" + |
4912 |
" * if explicitly allowed by the implementation\n" + |
4913 |
" * @param occurrences the number of occurrences of this element to add. May\n" + |
4914 |
" * be zero, in which case no change will be made.\n" + |
4915 |
" * @return the previous count of this element before the operation; possibly\n" + |
4916 |
" * zero - TODO: make this the actual behavior!\n" + |
4917 |
" * @throws IllegalArgumentException if {@code occurrences} is negative, or if\n" + |
4918 |
" * this operation would result in more than {@link Integer#MAX_VALUE}\n" + |
4919 |
" * occurrences of the element \n" + |
4920 |
" * @throws NullPointerException if {@code element} is null and this\n" + |
4921 |
" * implementation does not permit null elements. Note that if {@code\n" + |
4922 |
" * occurrences} is zero, the implementation may opt to return normally.\n" + |
4923 |
" */\n" + |
4924 |
" boolean /*int*/ add(E element, int occurrences);\n" + |
4925 |
"}\n"; |
4926 |
formatSource(source, |
4927 |
"package wksp2;\n" + |
4928 |
"\n" + |
4929 |
"public interface I06 {\n" + |
4930 |
"\n" + |
4931 |
" /**\n" + |
4932 |
" * Adds a number of occurrences of an element to this multiset. Note that if\n" + |
4933 |
" * {@code occurrences == 1}, this method has the identical effect to\n" + |
4934 |
" * {@link #add(Object)}. This method is functionally equivalent (except in\n" + |
4935 |
" * the case of overflow) to the call\n" + |
4936 |
" * {@code addAll(Collections.nCopies(element, occurrences))}, which would\n" + |
4937 |
" * presumably perform much more poorly.\n" + |
4938 |
" * \n" + |
4939 |
" * @param element\n" + |
4940 |
" * the element to add occurrences of; may be {@code null} only if\n" + |
4941 |
" * explicitly allowed by the implementation\n" + |
4942 |
" * @param occurrences\n" + |
4943 |
" * the number of occurrences of this element to add. May be zero,\n" + |
4944 |
" * in which case no change will be made.\n" + |
4945 |
" * @return the previous count of this element before the operation; possibly\n" + |
4946 |
" * zero - TODO: make this the actual behavior!\n" + |
4947 |
" * @throws IllegalArgumentException\n" + |
4948 |
" * if {@code occurrences} is negative, or if this operation\n" + |
4949 |
" * would result in more than {@link Integer#MAX_VALUE}\n" + |
4950 |
" * occurrences of the element\n" + |
4951 |
" * @throws NullPointerException\n" + |
4952 |
" * if {@code element} is null and this implementation does not\n" + |
4953 |
" * permit null elements. Note that if {@code occurrences} is\n" + |
4954 |
" * zero, the implementation may opt to return normally.\n" + |
4955 |
" */\n" + |
4956 |
" boolean /* int */add(E element, int occurrences);\n" + |
4957 |
"}\n" |
4958 |
); |
4959 |
} |
4960 |
public void testBug260381_wksp2_07() throws JavaModelException { |
4961 |
String source = |
4962 |
"package wksp2;\n" + |
4963 |
"\n" + |
4964 |
"public interface I07 {\n" + |
4965 |
"\n" + |
4966 |
" /**\n" + |
4967 |
" * Constructs a new, empty multiset, sorted according to the specified\n" + |
4968 |
" * comparator. All elements inserted into the multiset must be <i>mutually\n" + |
4969 |
" * comparable</i> by the specified comparator: {@code comparator.compare(e1,\n" + |
4970 |
" * e2)} must not throw a {@code ClassCastException} for any elements {@code\n" + |
4971 |
" * e1} and {@code e2} in the multiset. If the user attempts to add an element\n" + |
4972 |
" * to the multiset that violates this constraint, the {@code add(Object)} call\n" + |
4973 |
" * will throw a {@code ClassCastException}.\n" + |
4974 |
" *\n" + |
4975 |
" * @param comparator the comparator that will be used to sort this multiset. A\n" + |
4976 |
" * null value indicates that the elements\' <i>natural ordering</i> should\n" + |
4977 |
" * be used.\n" + |
4978 |
" */\n" + |
4979 |
" void foo();\n" + |
4980 |
"}\n"; |
4981 |
formatSource(source, |
4982 |
"package wksp2;\n" + |
4983 |
"\n" + |
4984 |
"public interface I07 {\n" + |
4985 |
"\n" + |
4986 |
" /**\n" + |
4987 |
" * Constructs a new, empty multiset, sorted according to the specified\n" + |
4988 |
" * comparator. All elements inserted into the multiset must be <i>mutually\n" + |
4989 |
" * comparable</i> by the specified comparator:\n" + |
4990 |
" * {@code comparator.compare(e1, e2)} must not throw a\n" + |
4991 |
" * {@code ClassCastException} for any elements {@code e1} and {@code e2} in\n" + |
4992 |
" * the multiset. If the user attempts to add an element to the multiset that\n" + |
4993 |
" * violates this constraint, the {@code add(Object)} call will throw a\n" + |
4994 |
" * {@code ClassCastException}.\n" + |
4995 |
" * \n" + |
4996 |
" * @param comparator\n" + |
4997 |
" * the comparator that will be used to sort this multiset. A null\n" + |
4998 |
" * value indicates that the elements\' <i>natural ordering</i>\n" + |
4999 |
" * should be used.\n" + |
5000 |
" */\n" + |
5001 |
" void foo();\n" + |
5002 |
"}\n" |
5003 |
); |
5004 |
} |
5005 |
public void testBug260381_wksp2_08() throws JavaModelException { |
5006 |
String source = |
5007 |
"package wksp2;\n" + |
5008 |
"\n" + |
5009 |
"public interface I08 {\n" + |
5010 |
"\n" + |
5011 |
" /**\n" + |
5012 |
" * Returns the composition of a function and a predicate. For every {@code x},\n" + |
5013 |
" * the generated predicate returns {@code predicate(function(x))}.\n" + |
5014 |
" *\n" + |
5015 |
" * @return the composition of the provided function and predicate\n" + |
5016 |
" */\n" + |
5017 |
" void foo();\n" + |
5018 |
"}\n"; |
5019 |
formatSource(source, |
5020 |
"package wksp2;\n" + |
5021 |
"\n" + |
5022 |
"public interface I08 {\n" + |
5023 |
"\n" + |
5024 |
" /**\n" + |
5025 |
" * Returns the composition of a function and a predicate. For every\n" + |
5026 |
" * {@code x}, the generated predicate returns {@code predicate(function(x))}\n" + |
5027 |
" * .\n" + |
5028 |
" * \n" + |
5029 |
" * @return the composition of the provided function and predicate\n" + |
5030 |
" */\n" + |
5031 |
" void foo();\n" + |
5032 |
"}\n" |
5033 |
); |
5034 |
} |
5035 |
public void testBug260381_wksp2_09() throws JavaModelException { |
5036 |
String source = |
5037 |
"package wksp2;\n" + |
5038 |
"\n" + |
5039 |
"/**\n" + |
5040 |
" A Conditional represents an if/then/else block.\n" + |
5041 |
" When this is created the code will already have\n" + |
5042 |
" the conditional check code. The code is optimized for branch\n" + |
5043 |
" offsets that fit in 2 bytes, though will handle 4 byte offsets.\n" + |
5044 |
"<code>\n" + |
5045 |
" if condition\n" + |
5046 |
" then code\n" + |
5047 |
" else code\n" + |
5048 |
"</code>\n" + |
5049 |
" what actually gets built is\n" + |
5050 |
"<code>\n" + |
5051 |
" if !condition branch to eb:\n" + |
5052 |
" then code\n" + |
5053 |
" goto end: // skip else\n" + |
5054 |
" eb:\n" + |
5055 |
" else code\n" + |
5056 |
" end:\n" + |
5057 |
"</code>\n" + |
5058 |
"*/\n" + |
5059 |
"public class X09 {\n" + |
5060 |
"\n" + |
5061 |
"}\n"; |
5062 |
formatSource(source, |
5063 |
"package wksp2;\n" + |
5064 |
"\n" + |
5065 |
"/**\n" + |
5066 |
" * A Conditional represents an if/then/else block. When this is created the code\n" + |
5067 |
" * will already have the conditional check code. The code is optimized for\n" + |
5068 |
" * branch offsets that fit in 2 bytes, though will handle 4 byte offsets. <code>\n" + |
5069 |
" if condition\n" + |
5070 |
" then code\n" + |
5071 |
" else code\n" + |
5072 |
"</code>\n" + |
5073 |
" * what actually gets built is <code>\n" + |
5074 |
" if !condition branch to eb:\n" + |
5075 |
" then code\n" + |
5076 |
" goto end: // skip else\n" + |
5077 |
" eb:\n" + |
5078 |
" else code\n" + |
5079 |
" end:\n" + |
5080 |
"</code>\n" + |
5081 |
" */\n" + |
5082 |
"public class X09 {\n" + |
5083 |
"\n" + |
5084 |
"}\n" |
5085 |
); |
5086 |
} |
5087 |
|
5088 |
/** |
4401 |
* @bug 260798: [formatter] Strange behavior of never join lines |
5089 |
* @bug 260798: [formatter] Strange behavior of never join lines |
4402 |
* @test Ensure that the formatter indents lines correctly when never join lines pref is activated |
5090 |
* @test Ensure that the formatter indents lines correctly when never join lines pref is activated |
4403 |
* @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=260798" |
5091 |
* @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=260798" |