From bff1d880f6c3cfd2a6891345f8cbae017fdf802c Mon Sep 17 00:00:00 2001 From: Chapman Flack Date: Mon, 4 Sep 2023 21:28:16 -0400 Subject: [PATCH 1/3] Skip handleFirstOptions for javadoc >= 19 In older Java versions, it was necessary to pass along the initial javadoc arguments (the ones a file manager would care about) in a separate step before calling the tool. Starting in 19, that's not only no longer necessary, but fails with "--module-source-path specified more than once". --- pljava-examples/pom.xml | 6 ++++-- pljava/pom.xml | 8 ++++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/pljava-examples/pom.xml b/pljava-examples/pom.xml index 320788c27..497d6a4d9 100644 --- a/pljava-examples/pom.xml +++ b/pljava-examples/pom.xml @@ -230,11 +230,13 @@ function executeReport(report, locale) * A special file manager that will rewrite the RELDOTS seen in * -linkoffline above. The options a file manager recognizes must be the * first ones in args; handleFirstOptions below returns at the first one - * the file manager doesn't know what to do with. + * the file manager doesn't know what to do with. Java 19 seems to have + * learned to pass the args to the file manager without the fuss here. */ var rmgr = new org.postgresql.pljava.pgxs.RelativizingFileManager( smgr, Charset.forName(report.outputEncoding)); - rmgr.handleFirstOptions(args); + if ( 0 > v.compareTo(java.lang.Runtime.Version.parse("19-ea")) ) + rmgr.handleFirstOptions(args); var task = tool.getTask(null, rmgr, diagListener, null, args, null); if (task.call()) diff --git a/pljava/pom.xml b/pljava/pom.xml index 51eb86f51..52491f1c1 100644 --- a/pljava/pom.xml +++ b/pljava/pom.xml @@ -182,11 +182,15 @@ function executeReport(report, locale) * A special file manager that will rewrite the RELDOTS seen in * -linkoffline above. The options a file manager recognizes must be the * first ones in args; handleFirstOptions below returns at the first one - * the file manager doesn't know what to do with. + * the file manager doesn't know what to do with. Java 19 seems to have + * learned to pass the args to the file manager without the fuss here. */ var rmgr = new org.postgresql.pljava.pgxs.RelativizingFileManager( smgr, Charset.forName(report.outputEncoding)); - rmgr.handleFirstOptions(args); + + var v = java.lang.Runtime.version(); + if ( 0 > v.compareTo(java.lang.Runtime.Version.parse("19-ea")) ) + rmgr.handleFirstOptions(args); var task = tool.getTask(null, rmgr, diagListener, null, args, null); if (task.call()) From 6a64e915b7f1c60e2465038a5c081c78a09a6bf0 Mon Sep 17 00:00:00 2001 From: Chapman Flack Date: Mon, 4 Sep 2023 21:29:57 -0400 Subject: [PATCH 2/3] Improve NEWLINE pattern Old one could fail depending on previous matching activity, possibly because of the use of \G (which I should have explained better in a comment, back when I thought I knew why I was doing it). The documented behavior of ^ $ and \z and reluctant quantifiers make for a simpler and more dependable version. Addresses issue #455. --- .../org/postgresql/pljava/sqlgen/Lexicals.java | 2 +- pljava-api/src/test/java/LexicalsTest.java | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/pljava-api/src/main/java/org/postgresql/pljava/sqlgen/Lexicals.java b/pljava-api/src/main/java/org/postgresql/pljava/sqlgen/Lexicals.java index 85bdc66bc..1b6e014a0 100644 --- a/pljava-api/src/main/java/org/postgresql/pljava/sqlgen/Lexicals.java +++ b/pljava-api/src/main/java/org/postgresql/pljava/sqlgen/Lexicals.java @@ -279,7 +279,7 @@ private Lexicals() { } // do not instantiate * engine, letting it handle the details. */ public static final Pattern NEWLINE = Pattern.compile( - "(?ms:$(?:(?except newline, for any Java-recognized newline. diff --git a/pljava-api/src/test/java/LexicalsTest.java b/pljava-api/src/test/java/LexicalsTest.java index 174258115..89b94d07f 100644 --- a/pljava-api/src/test/java/LexicalsTest.java +++ b/pljava-api/src/test/java/LexicalsTest.java @@ -29,6 +29,8 @@ import static org.postgresql.pljava.sqlgen.Lexicals.ISO_AND_PG_IDENTIFIER_CAPTURING; +import static + org.postgresql.pljava.sqlgen.Lexicals.NEWLINE; import static org.postgresql.pljava.sqlgen.Lexicals.SEPARATOR; import static @@ -45,6 +47,22 @@ public class LexicalsTest extends TestCase { public LexicalsTest(String name) { super(name); } + public void testNewline() throws Exception + { + Matcher m = NEWLINE.matcher("abcd\nefgh"); + m.region(4, 9); + assertTrue("newline 0", m.lookingAt()); + assertTrue("newline 1", m.lookingAt()); + + m.reset("abcd\r\nefgh").region(4, 10); + assertTrue("newline 2", m.lookingAt()); + assertEquals("\r\n", m.group()); + + m.reset("abcd\n\refgh").region(4, 10); + assertTrue("newline 3", m.lookingAt()); + assertEquals("\n", m.group()); + } + public void testSeparator() throws Exception { Pattern allTheRest = Pattern.compile(".*", Pattern.DOTALL); From c9b3473cc83fe316aa0ed564390705a7195a07dc Mon Sep 17 00:00:00 2001 From: Chapman Flack Date: Tue, 5 Sep 2023 11:54:48 -0400 Subject: [PATCH 3/3] Javadoc >= 17 rejects non-HTML5 attributes Instead of relying on valign to match the parameters to their descriptions, give the tables the class "striped", which is described in the javadoc-supplied stylesheet.css as one of the "Styles for user-provided tables". --- .../pljava/management/Commands.java | 48 +++++++++---------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/pljava/src/main/java/org/postgresql/pljava/management/Commands.java b/pljava/src/main/java/org/postgresql/pljava/management/Commands.java index 0cdafa254..df3884388 100644 --- a/pljava/src/main/java/org/postgresql/pljava/management/Commands.java +++ b/pljava/src/main/java/org/postgresql/pljava/management/Commands.java @@ -88,18 +88,18 @@ *
SELECT sqlj.install_jar(<jar_url>, <jar_name>, <deploy>); *
*

Parameters

- *
+ *
Parameters for sqlj.install_jar(url...)
* - * + * * * * - * + * * * * - * + * * @@ -109,20 +109,20 @@ *
SELECT sqlj.install_jar(<jar_image>, <jar_name>, <deploy>); *
*

Parameters

- *
Parameters for sqlj.install_jar(url...)
jar_urljar_urlThe URL that denotes the location of the jar that should be loaded
jar_namejar_nameThis is the name by which this jar can be referenced once it has been * loaded
deploydeployTrue if the jar should be deployed according to a {@link * org.postgresql.pljava.management.SQLDeploymentDescriptor deployment * descriptor}, false otherwise
Parameters for + *
* - * + * * * * - * + * * * * - * + * * @@ -136,17 +136,17 @@ *
SELECT sqlj.replace_jar(<jar_url>, <jar_name>, <redeploy>); *
*

Parameters

- *
Parameters for * sqlj.install_jar(bytea...)
jar_imagejar_imageThe byte array that constitutes the contents of the jar that should be * loaded
jar_namejar_nameThis is the name by which this jar can be referenced once it has been * loaded
deploydeployTrue if the jar should be deployed according to a {@link * org.postgresql.pljava.management.SQLDeploymentDescriptor deployment * descriptor}, false otherwise
+ *
Parameters for sqlj.replace_jar(url...)
* - * + * * * * - * + * * * * - * + * *
Parameters for sqlj.replace_jar(url...)
jar_urljar_urlThe URL that denotes the location of the jar that should be loaded
jar_namejar_nameThe name of the jar to be replaced
redeployredeployTrue if the old and new jar should be undeployed and deployed according * to their respective {@link * org.postgresql.pljava.management.SQLDeploymentDescriptor deployment @@ -157,19 +157,19 @@ *
SELECT sqlj.replace_jar(<jar_image>, <jar_name>, <redeploy>); *
*

Parameters

- *
Parameters for + *
* - * + * * * * - * + * * * * - * + * *
Parameters for * sqlj.replace_jar(bytea...)
jar_imagejar_imageThe byte array that constitutes the contents of the jar that should be * loaded
jar_namejar_nameThe name of the jar to be replaced
redeployredeployTrue if the old and new jar should be undeployed and deployed according * to their respective {@link * org.postgresql.pljava.management.SQLDeploymentDescriptor deployment @@ -184,13 +184,13 @@ *
SELECT sqlj.remove_jar(<jar_name>, <undeploy>); *
*

Parameters

- *
+ *
Parameters for sqlj.remove_jar
* - * + * * * * - * + * * @@ -204,7 +204,7 @@ *
SELECT sqlj.get_classpath(<schema>); *
*

Parameters

- *
Parameters for sqlj.remove_jar
jar_namejar_nameThe name of the jar to be removed
undeployundeployTrue if the jar should be undeployed according to its {@link * org.postgresql.pljava.management.SQLDeploymentDescriptor deployment * descriptor}, false otherwise
+ *
Parameters for sqlj.get_classpath
* * * @@ -219,7 +219,7 @@ *
SELECT sqlj.set_classpath(<schema>, <classpath>); *
*

Parameters

- *
Parameters for sqlj.get_classpath
schemaThe name of the schema
+ *
Parameters for sqlj.set_classpath
* * * @@ -236,7 +236,7 @@ *
SELECT sqlj.add_type_mapping(<sqlTypeName>, <className>); *
*

Parameters

- *
Parameters for sqlj.set_classpath
schemaThe name of the schema
+ *
Parameters for sqlj.add_type_mapping
* * *
Parameters for sqlj.add_type_mapping
sqlTypeNameThe name of the SQL type. The name can be qualified with a @@ -256,7 +256,7 @@ *
SELECT sqlj.drop_type_mapping(<sqlTypeName>); *
*

Parameters

- *
+ *
Parameters for sqlj.drop_type_mapping
* * *
Parameters for sqlj.drop_type_mapping
sqlTypeNameThe name of the SQL type. The name can be qualified with a @@ -275,7 +275,7 @@ * {@code SELECT sqlj.alias_java_language(, sandboxed => );} * *

Parameters

- *
+ *
Parameters for sqlj.alias_java_language
* * *
Parameters for sqlj.alias_java_language
aliasThe name desired for the language alias. Language names are not