Skip to content

Commit

Permalink
issue 39 as a test
Browse files Browse the repository at this point in the history
  • Loading branch information
paul-hammant committed Aug 27, 2021
1 parent 0fd4b6f commit 03c538c
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ private String[] getMethodParameterNames(Method method, String raw) {
* <code><strong><a href="../../java/io/File.html#File(java.io.File, java.lang.String)">File</a></strong>(<a href="../../java/io/File.html" title="class in java.io">File</a>&nbsp;parent, <a href="../../java/lang/String.html" title="class in java.lang">String</a>&nbsp;child)</code>
* <code><strong><a href="../../java/util/Collection.html#containsAll(java.util.Collection)">containsAll</a></strong>(<a href="../../java/util/Collection.html" title="interface in java.util">Collection</a>&lt;?&gt;&nbsp;c)</code>
*/
private String[] getParameterNames(AccessibleObject a, String name, Class<?>[] types, String raw) {
static String[] getParameterNames(AccessibleObject a, String name, Class<?>[] types, String raw) {
if (types.length == 0)
return new String[0];

Expand Down
52 changes: 52 additions & 0 deletions paranamer/src/test/com/thoughtworks/paranamer/Issue39TestCase.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
package com.thoughtworks.paranamer;

import org.junit.Test;

import java.lang.reflect.Method;
import java.time.LocalDate;

import static org.junit.Assert.assertEquals;

public class Issue39TestCase {

@Test
public void jdk8u301_getParameterNames() throws Exception {
Method method = LocalDate.class
.getMethod("of", int.class, int.class, int.class);

String[] names = JavadocParanamer.getParameterNames(method, "of", new Class[]{int.class, int.class, int.class}, "<!-- -->\n" +
"</a>\n" +
"<ul class=\"blockList\">\n" +
"<li class=\"blockList\">\n" +
"<h4>of</h4>\n" +
"<pre>public static&nbsp;<a href=\"../../java/time/LocalDate.html\" title=\"class in java.time\">LocalDate</a>&nbsp;of(int&nbsp;year,\n" +
" int&nbsp;month,\n" +
" int&nbsp;dayOfMonth)</pre>\n" +
"<div class=\"block\">Obtains an instance of <code>LocalDate</code> from a year, month and day.\n" +
" <p>\n" +
" This returns a <code>LocalDate</code> with the specified year, month and day-of-month.\n" +
" The day must be valid for the year and month, otherwise an exception will be thrown.</div>\n" +
"<dl>\n" +
"<dt><span class=\"paramLabel\">Parameters:</span></dt>\n" +
"<dd><code>year</code> - the year to represent, from MIN_YEAR to MAX_YEAR</dd>\n" +
"<dd><code>month</code> - the month-of-year to represent, from 1 (January) to 12 (December)</dd>\n" +
"<dd><code>dayOfMonth</code> - the day-of-month to represent, from 1 to 31</dd>\n" +
"<dt><span class=\"returnLabel\">Returns:</span></dt>\n" +
"<dd>the local date, not null</dd>\n" +
"<dt><span class=\"throwsLabel\">Throws:</span></dt>\n" +
"<dd><code><a href=\"../../java/time/DateTimeException.html\" title=\"class in java.time\">DateTimeException</a></code> - if the value of any field is out of range,\n" +
" or if the day-of-month is invalid for the month-year</dd>\n" +
"</dl>\n" +
"</li>\n" +
"</ul>\n" +
"<a name=\"ofYearDay-int-int-\">\n" +
"<!-- -->");

assertEquals(3, names.length);
assertEquals("year", names[0]);
assertEquals("month", names[1]);
assertEquals("dayOfMonth", names[2]);
}


}
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
<source>1.8</source>
<target>1.8</target>

This comment has been minimized.

Copy link
@mjustin

mjustin Aug 27, 2021

Contributor

I have no qualms if you're ready to upgrade your library to Java 1.8 (1.6 is pretty ancient), though if this specific task is just for reading Java 8 Javadocs from HTML, it wouldn't matter if the library were still on an older version.

This comment has been minimized.

Copy link
@paul-hammant

paul-hammant Aug 27, 2021

Author Owner

I think we have to for the next version. Paranamer's API isn't changing. JFK 5,6,7 people can pick the previous release.

</configuration>
</plugin>
<plugin>
Expand Down

0 comments on commit 03c538c

Please sign in to comment.