Skip to content

Commit 4e7ea98

Browse files
RomainMullerrix0rrr
authored andcommitted
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.
1 parent 7ffa98d commit 4e7ea98

File tree

21 files changed

+38
-25
lines changed

21 files changed

+38
-25
lines changed

packages/codemaker/package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/jsii-calc/README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ If this file starts with an "H1" line (in our case `# jsii Calculator`), this
1010
heading will be used as the Sphinx topic name. Otherwise, the name of the module
1111
(`jsii-calc`) will be used instead.
1212

13+
## Code Samples
1314

14-
15-
15+
```ts
16+
/* This is totes a magic comment in here, just you wait! */
17+
const foo = 'bar';
18+
```

packages/jsii-calc/test/assembly.jsii

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@
197197
},
198198
"name": "jsii-calc",
199199
"readme": {
200-
"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"
200+
"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"
201201
},
202202
"repository": {
203203
"type": "git",
@@ -8604,5 +8604,5 @@
86048604
}
86058605
},
86068606
"version": "0.11.1",
8607-
"fingerprint": "uCNbkp5+1duLs9lW2h4C+T4dTtV6ZArNhzgT39ChGpk="
8607+
"fingerprint": "9L8/rsLS+UYbDYN+YX0Wb3gybgQNUCyFdD52GKTWEs0="
86088608
}

packages/jsii-diff/package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/jsii-dotnet-jsonmodel/package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/jsii-dotnet-runtime-test/package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/jsii-dotnet-runtime/package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/jsii-java-runtime/package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/jsii-kernel/package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/jsii-pacmak/lib/targets/java.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ class JavaGenerator extends Generator {
365365
this.code.line('/**');
366366
if (mod.readme) {
367367
for (const line of md2html(mod.readme.markdown).split('\n')) {
368-
this.code.line(` * ${line}`);
368+
this.code.line(` * ${line.replace(/\*\//g, '*{@literal /}')}`);
369369
}
370370
}
371371
if (mod.docs.deprecated) {

packages/jsii-pacmak/package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/jsii-pacmak/test/expected.jsii-calc/dotnet/Amazon.JSII.Tests.CalculatorPackageId/.jsii

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@
197197
},
198198
"name": "jsii-calc",
199199
"readme": {
200-
"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"
200+
"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"
201201
},
202202
"repository": {
203203
"type": "git",
@@ -8604,5 +8604,5 @@
86048604
}
86058605
},
86068606
"version": "0.11.1",
8607-
"fingerprint": "uCNbkp5+1duLs9lW2h4C+T4dTtV6ZArNhzgT39ChGpk="
8607+
"fingerprint": "9L8/rsLS+UYbDYN+YX0Wb3gybgQNUCyFdD52GKTWEs0="
86088608
}

packages/jsii-pacmak/test/expected.jsii-calc/java/src/main/java/software/amazon/jsii/tests/calculator/package-info.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66
* <p>If this file starts with an &quot;H1&quot; line (in our case <code># jsii Calculator</code>), this
77
* heading will be used as the Sphinx topic name. Otherwise, the name of the module
88
* (<code>jsii-calc</code>) will be used instead.</p>
9+
* <h2>Code Samples</h2>
10+
* <pre><code class="language-ts">/* This is totes a magic comment in here, just you wait! *{@literal /}
11+
* const foo = 'bar';
12+
* </code></pre>
913
*
1014
*/
1115
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)

packages/jsii-pacmak/test/expected.jsii-calc/python/README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@ If this file starts with an "H1" line (in our case `# jsii Calculator`), this
1010
heading will be used as the Sphinx topic name. Otherwise, the name of the module
1111
(`jsii-calc`) will be used instead.
1212

13+
## Code Samples
1314

14-
15-
15+
```ts
16+
/* This is totes a magic comment in here, just you wait! */
17+
const foo = 'bar';
18+
```
1619

packages/jsii-pacmak/test/expected.jsii-calc/sphinx/_jsii-calc.README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@ If this file starts with an "H1" line (in our case `# jsii Calculator`), this
99
heading will be used as the Sphinx topic name. Otherwise, the name of the module
1010
(`jsii-calc`) will be used instead.
1111

12+
## Code Samples
1213

13-
14-
14+
```ts
15+
/* This is totes a magic comment in here, just you wait! */
16+
const foo = 'bar';
17+
```
1518

packages/jsii-reflect/package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/jsii-ruby-runtime/package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/jsii-runtime/package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/jsii-spec/package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/jsii/package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/oo-ascii-tree/package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)