From 4e7ea985cae333efbd7029cf24ff83c8811ba2ce Mon Sep 17 00:00:00 2001 From: Romain Marcadier-Muller Date: Fri, 7 Jun 2019 17:50:17 +0200 Subject: [PATCH] fix(java): Escape `*/` in package-info.java (#526) Code examples in the `README.md` file can contain multi-line comments that will interfere with the comment block in `package-info.java`. Escaping the `*/` to `*{@literal /}` fixes that issue. --- packages/codemaker/package-lock.json | 2 +- packages/jsii-calc/README.md | 7 +++++-- packages/jsii-calc/test/assembly.jsii | 4 ++-- packages/jsii-diff/package-lock.json | 2 +- packages/jsii-dotnet-jsonmodel/package-lock.json | 2 +- packages/jsii-dotnet-runtime-test/package-lock.json | 2 +- packages/jsii-dotnet-runtime/package-lock.json | 2 +- packages/jsii-java-runtime/package-lock.json | 2 +- packages/jsii-kernel/package-lock.json | 2 +- packages/jsii-pacmak/lib/targets/java.ts | 2 +- packages/jsii-pacmak/package-lock.json | 2 +- .../dotnet/Amazon.JSII.Tests.CalculatorPackageId/.jsii | 4 ++-- .../amazon/jsii/tests/calculator/package-info.java | 4 ++++ .../jsii-pacmak/test/expected.jsii-calc/python/README.md | 7 +++++-- .../test/expected.jsii-calc/sphinx/_jsii-calc.README.md | 7 +++++-- packages/jsii-reflect/package-lock.json | 2 +- packages/jsii-ruby-runtime/package-lock.json | 2 +- packages/jsii-runtime/package-lock.json | 2 +- packages/jsii-spec/package-lock.json | 2 +- packages/jsii/package-lock.json | 2 +- packages/oo-ascii-tree/package-lock.json | 2 +- 21 files changed, 38 insertions(+), 25 deletions(-) diff --git a/packages/codemaker/package-lock.json b/packages/codemaker/package-lock.json index ed51904024..2fd2d08317 100644 --- a/packages/codemaker/package-lock.json +++ b/packages/codemaker/package-lock.json @@ -1,6 +1,6 @@ { "name": "codemaker", - "version": "0.11.0", + "version": "0.11.1", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/packages/jsii-calc/README.md b/packages/jsii-calc/README.md index 186faff39d..9044031f0a 100644 --- a/packages/jsii-calc/README.md +++ b/packages/jsii-calc/README.md @@ -10,6 +10,9 @@ If this file starts with an "H1" line (in our case `# jsii Calculator`), this heading will be used as the Sphinx topic name. Otherwise, the name of the module (`jsii-calc`) will be used instead. +## Code Samples - - +```ts +/* This is totes a magic comment in here, just you wait! */ +const foo = 'bar'; +``` diff --git a/packages/jsii-calc/test/assembly.jsii b/packages/jsii-calc/test/assembly.jsii index 6bdd2f0e4d..127fca209e 100644 --- a/packages/jsii-calc/test/assembly.jsii +++ b/packages/jsii-calc/test/assembly.jsii @@ -197,7 +197,7 @@ }, "name": "jsii-calc", "readme": { - "markdown": "# jsii Calculator\n\nThis library is used to demonstrate and test the features of JSII\n\n## Sphinx\n\nThis file will be incorporated into the sphinx documentation.\n\nIf this file starts with an \"H1\" line (in our case `# jsii Calculator`), this\nheading will be used as the Sphinx topic name. Otherwise, the name of the module\n(`jsii-calc`) will be used instead.\n\n\n\n\n" + "markdown": "# jsii Calculator\n\nThis library is used to demonstrate and test the features of JSII\n\n## Sphinx\n\nThis file will be incorporated into the sphinx documentation.\n\nIf this file starts with an \"H1\" line (in our case `# jsii Calculator`), this\nheading will be used as the Sphinx topic name. Otherwise, the name of the module\n(`jsii-calc`) will be used instead.\n\n## Code Samples\n\n```ts\n/* This is totes a magic comment in here, just you wait! */\nconst foo = 'bar';\n```\n" }, "repository": { "type": "git", @@ -8604,5 +8604,5 @@ } }, "version": "0.11.1", - "fingerprint": "uCNbkp5+1duLs9lW2h4C+T4dTtV6ZArNhzgT39ChGpk=" + "fingerprint": "9L8/rsLS+UYbDYN+YX0Wb3gybgQNUCyFdD52GKTWEs0=" } diff --git a/packages/jsii-diff/package-lock.json b/packages/jsii-diff/package-lock.json index 244789a664..dbfc55c833 100644 --- a/packages/jsii-diff/package-lock.json +++ b/packages/jsii-diff/package-lock.json @@ -1,6 +1,6 @@ { "name": "jsii-diff", - "version": "0.11.0", + "version": "0.11.1", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/packages/jsii-dotnet-jsonmodel/package-lock.json b/packages/jsii-dotnet-jsonmodel/package-lock.json index 873c611801..153cde6ee9 100644 --- a/packages/jsii-dotnet-jsonmodel/package-lock.json +++ b/packages/jsii-dotnet-jsonmodel/package-lock.json @@ -1,6 +1,6 @@ { "name": "jsii-dotnet-jsonmodel", - "version": "0.11.0", + "version": "0.11.1", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/packages/jsii-dotnet-runtime-test/package-lock.json b/packages/jsii-dotnet-runtime-test/package-lock.json index a67eefbd66..1b84c9fab0 100644 --- a/packages/jsii-dotnet-runtime-test/package-lock.json +++ b/packages/jsii-dotnet-runtime-test/package-lock.json @@ -1,6 +1,6 @@ { "name": "jsii-dotnet-runtime-test", - "version": "0.11.0", + "version": "0.11.1", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/packages/jsii-dotnet-runtime/package-lock.json b/packages/jsii-dotnet-runtime/package-lock.json index 191a04f9d6..defd5ba522 100644 --- a/packages/jsii-dotnet-runtime/package-lock.json +++ b/packages/jsii-dotnet-runtime/package-lock.json @@ -1,6 +1,6 @@ { "name": "jsii-dotnet-runtime", - "version": "0.11.0", + "version": "0.11.1", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/packages/jsii-java-runtime/package-lock.json b/packages/jsii-java-runtime/package-lock.json index a13e9e943d..829134ac27 100644 --- a/packages/jsii-java-runtime/package-lock.json +++ b/packages/jsii-java-runtime/package-lock.json @@ -1,6 +1,6 @@ { "name": "jsii-java-runtime", - "version": "0.11.0", + "version": "0.11.1", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/packages/jsii-kernel/package-lock.json b/packages/jsii-kernel/package-lock.json index 0ca5db71de..42ba5857ec 100644 --- a/packages/jsii-kernel/package-lock.json +++ b/packages/jsii-kernel/package-lock.json @@ -1,6 +1,6 @@ { "name": "jsii-kernel", - "version": "0.11.0", + "version": "0.11.1", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/packages/jsii-pacmak/lib/targets/java.ts b/packages/jsii-pacmak/lib/targets/java.ts index c910b17747..0d214a1763 100644 --- a/packages/jsii-pacmak/lib/targets/java.ts +++ b/packages/jsii-pacmak/lib/targets/java.ts @@ -365,7 +365,7 @@ class JavaGenerator extends Generator { this.code.line('/**'); if (mod.readme) { for (const line of md2html(mod.readme.markdown).split('\n')) { - this.code.line(` * ${line}`); + this.code.line(` * ${line.replace(/\*\//g, '*{@literal /}')}`); } } if (mod.docs.deprecated) { diff --git a/packages/jsii-pacmak/package-lock.json b/packages/jsii-pacmak/package-lock.json index 34c457bd94..b503674ae4 100644 --- a/packages/jsii-pacmak/package-lock.json +++ b/packages/jsii-pacmak/package-lock.json @@ -1,6 +1,6 @@ { "name": "jsii-pacmak", - "version": "0.11.0", + "version": "0.11.1", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/.jsii b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/.jsii index 6bdd2f0e4d..127fca209e 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/.jsii +++ b/packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/.jsii @@ -197,7 +197,7 @@ }, "name": "jsii-calc", "readme": { - "markdown": "# jsii Calculator\n\nThis library is used to demonstrate and test the features of JSII\n\n## Sphinx\n\nThis file will be incorporated into the sphinx documentation.\n\nIf this file starts with an \"H1\" line (in our case `# jsii Calculator`), this\nheading will be used as the Sphinx topic name. Otherwise, the name of the module\n(`jsii-calc`) will be used instead.\n\n\n\n\n" + "markdown": "# jsii Calculator\n\nThis library is used to demonstrate and test the features of JSII\n\n## Sphinx\n\nThis file will be incorporated into the sphinx documentation.\n\nIf this file starts with an \"H1\" line (in our case `# jsii Calculator`), this\nheading will be used as the Sphinx topic name. Otherwise, the name of the module\n(`jsii-calc`) will be used instead.\n\n## Code Samples\n\n```ts\n/* This is totes a magic comment in here, just you wait! */\nconst foo = 'bar';\n```\n" }, "repository": { "type": "git", @@ -8604,5 +8604,5 @@ } }, "version": "0.11.1", - "fingerprint": "uCNbkp5+1duLs9lW2h4C+T4dTtV6ZArNhzgT39ChGpk=" + "fingerprint": "9L8/rsLS+UYbDYN+YX0Wb3gybgQNUCyFdD52GKTWEs0=" } diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/package-info.java b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/package-info.java index 971596537b..0fd07a89d1 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/package-info.java +++ b/packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/package-info.java @@ -6,6 +6,10 @@ *

If this file starts with an "H1" line (in our case # jsii Calculator), this * heading will be used as the Sphinx topic name. Otherwise, the name of the module * (jsii-calc) will be used instead.

+ *

Code Samples

+ *
/* This is totes a magic comment in here, just you wait! *{@literal /}
+ * const foo = 'bar';
+ * 
* */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/python/README.md b/packages/jsii-pacmak/test/expected.jsii-calc/python/README.md index dead00de9c..a1643cddc6 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/python/README.md +++ b/packages/jsii-pacmak/test/expected.jsii-calc/python/README.md @@ -10,7 +10,10 @@ If this file starts with an "H1" line (in our case `# jsii Calculator`), this heading will be used as the Sphinx topic name. Otherwise, the name of the module (`jsii-calc`) will be used instead. +## Code Samples - - +```ts +/* This is totes a magic comment in here, just you wait! */ +const foo = 'bar'; +``` diff --git a/packages/jsii-pacmak/test/expected.jsii-calc/sphinx/_jsii-calc.README.md b/packages/jsii-pacmak/test/expected.jsii-calc/sphinx/_jsii-calc.README.md index 20eea624b5..1faacccaac 100644 --- a/packages/jsii-pacmak/test/expected.jsii-calc/sphinx/_jsii-calc.README.md +++ b/packages/jsii-pacmak/test/expected.jsii-calc/sphinx/_jsii-calc.README.md @@ -9,7 +9,10 @@ If this file starts with an "H1" line (in our case `# jsii Calculator`), this heading will be used as the Sphinx topic name. Otherwise, the name of the module (`jsii-calc`) will be used instead. +## Code Samples - - +```ts +/* This is totes a magic comment in here, just you wait! */ +const foo = 'bar'; +``` diff --git a/packages/jsii-reflect/package-lock.json b/packages/jsii-reflect/package-lock.json index c7cf40abc2..bdb5912541 100644 --- a/packages/jsii-reflect/package-lock.json +++ b/packages/jsii-reflect/package-lock.json @@ -1,6 +1,6 @@ { "name": "jsii-reflect", - "version": "0.11.0", + "version": "0.11.1", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/packages/jsii-ruby-runtime/package-lock.json b/packages/jsii-ruby-runtime/package-lock.json index 1559e8a450..a5d890b52a 100644 --- a/packages/jsii-ruby-runtime/package-lock.json +++ b/packages/jsii-ruby-runtime/package-lock.json @@ -1,6 +1,6 @@ { "name": "jsii-ruby-runtime", - "version": "0.11.0", + "version": "0.11.1", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/packages/jsii-runtime/package-lock.json b/packages/jsii-runtime/package-lock.json index f0f8e75530..1fef59dffa 100644 --- a/packages/jsii-runtime/package-lock.json +++ b/packages/jsii-runtime/package-lock.json @@ -1,6 +1,6 @@ { "name": "jsii-runtime", - "version": "0.11.0", + "version": "0.11.1", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/packages/jsii-spec/package-lock.json b/packages/jsii-spec/package-lock.json index 84bafbf793..238921635a 100644 --- a/packages/jsii-spec/package-lock.json +++ b/packages/jsii-spec/package-lock.json @@ -1,6 +1,6 @@ { "name": "jsii-spec", - "version": "0.11.0", + "version": "0.11.1", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/packages/jsii/package-lock.json b/packages/jsii/package-lock.json index e761455b21..9a97ff4cbd 100644 --- a/packages/jsii/package-lock.json +++ b/packages/jsii/package-lock.json @@ -1,6 +1,6 @@ { "name": "jsii", - "version": "0.11.0", + "version": "0.11.1", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/packages/oo-ascii-tree/package-lock.json b/packages/oo-ascii-tree/package-lock.json index a688d3dac7..044a95b577 100644 --- a/packages/oo-ascii-tree/package-lock.json +++ b/packages/oo-ascii-tree/package-lock.json @@ -1,6 +1,6 @@ { "name": "oo-ascii-tree", - "version": "0.11.0", + "version": "0.11.1", "lockfileVersion": 1, "requires": true, "dependencies": {