diff --git a/packages/jsii-pacmak/lib/targets/java.ts b/packages/jsii-pacmak/lib/targets/java.ts index b512d40d4f..9760f410b6 100644 --- a/packages/jsii-pacmak/lib/targets/java.ts +++ b/packages/jsii-pacmak/lib/targets/java.ts @@ -2418,7 +2418,9 @@ class JavaGenerator extends Generator { tagLines.push(`@return ${docs.returns}`); } if (docs.see) { - tagLines.push(`@see ${docs.see}`); + tagLines.push( + `@see ${escape(docs.see)}`, + ); } if (docs.deprecated) { tagLines.push(`@deprecated ${docs.deprecated}`); @@ -3260,3 +3262,10 @@ function splitNamespace(ns: string): [string, string] { } return [ns.slice(0, dot), ns.slice(dot + 1)]; } + +/** + * Escape a string for dropping into JavaDoc + */ +function escape(s: string) { + return s.replace(/["\\<>&]/g, (c) => `&#${c.charCodeAt(0)};`); +} diff --git a/packages/jsii-pacmak/test/generated-code/__snapshots__/target-java.test.js.snap b/packages/jsii-pacmak/test/generated-code/__snapshots__/target-java.test.js.snap index 2b42f0ff15..037c417b61 100644 --- a/packages/jsii-pacmak/test/generated-code/__snapshots__/target-java.test.js.snap +++ b/packages/jsii-pacmak/test/generated-code/__snapshots__/target-java.test.js.snap @@ -2350,7 +2350,7 @@ package software.amazon.jsii.tests.calculator.lib; * from a dependent module. Since Go "reimplments" this method, it will also need * to include an "import" statement for the calc-base module. *

- * @see https://github.com/aws/jsii/issues/2647 + * @see https://github.com/aws/jsii/issues/2647 */ @javax.annotation.Generated(value = "jsii-pacmak") @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Deprecated) @@ -6695,7 +6695,7 @@ package software.amazon.jsii.tests.calculator; * } * *

- * @see https://aws.amazon.com/ + * @see https://aws.amazon.com/ */ @javax.annotation.Generated(value = "jsii-pacmak") @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) @@ -6870,7 +6870,7 @@ package software.amazon.jsii.tests.calculator; /** * This tries to confuse Jackson by having overloaded property setters. *

- * @see https://github.com/aws/aws-cdk/issues/4080 + * @see https://github.com/aws/aws-cdk/issues/4080 */ @javax.annotation.Generated(value = "jsii-pacmak") @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) @@ -7626,7 +7626,7 @@ package software.amazon.jsii.tests.calculator; /** * A class named "Default". *

- * @see https://github.com/aws/jsii/issues/2637 + * @see https://github.com/aws/jsii/issues/2637 */ @javax.annotation.Generated(value = "jsii-pacmak") @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) @@ -15374,7 +15374,7 @@ package software.amazon.jsii.tests.calculator; /** * Docstrings with period. *

- * @see https://github.com/aws/jsii/issues/2638 + * @see https://github.com/aws/jsii/issues/2638 */ @javax.annotation.Generated(value = "jsii-pacmak") @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) @@ -16178,7 +16178,7 @@ package software.amazon.jsii.tests.calculator; /** * Make sure structs are un-decorated on the way in. *

- * @see https://github.com/aws/aws-cdk/issues/5066 + * @see https://github.com/aws/aws-cdk/issues/5066 */ @javax.annotation.Generated(value = "jsii-pacmak") @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) @@ -18220,7 +18220,7 @@ exports[`Generated code for "jsii-calc": /java/src/main/java/software/am package software.amazon.jsii.tests.calculator; /** - * @see https://github.com/aws/jsii/issues/903 + * @see https://github.com/aws/jsii/issues/903 */ @javax.annotation.Generated(value = "jsii-pacmak") @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) @@ -19002,7 +19002,7 @@ package software.amazon.jsii.tests.calculator; * Helps ensure the JSII kernel & runtime cooperate correctly when an un-exported instance of a class is returned with a declared type that is an exported interface, and the instance inherits from an exported class. *

* @return an instance of an un-exported class that extends \`ExportedBaseClass\`, declared as \`IPrivatelyImplemented\`. - * @see https://github.com/aws/jsii/issues/320 + * @see https://github.com/aws/jsii/issues/320 */ @javax.annotation.Generated(value = "jsii-pacmak") @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) @@ -22275,7 +22275,7 @@ package software.amazon.jsii.tests.calculator; /** * In TypeScript it is possible to have two methods with the same name but different capitalization. *

- * @see https://github.com/aws/jsii/issues/2508 + * @see https://github.com/aws/jsii/issues/2508 */ @javax.annotation.Generated(value = "jsii-pacmak") @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) @@ -22348,7 +22348,7 @@ package software.amazon.jsii.tests.calculator; /** * Checks the current file permissions are cool (no funky UMASK down-scoping happened). *

- * @see https://github.com/aws/jsii/issues/1765 + * @see https://github.com/aws/jsii/issues/1765 */ @javax.annotation.Generated(value = "jsii-pacmak") @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) @@ -23150,7 +23150,7 @@ package software.amazon.jsii.tests.calculator.cdk16625.donotimport; * that all types available in the assembly can be resolved by the runtime * library, regardless of whether they were explicitly referenced or not. *

- * @see https://github.com/aws/aws-cdk/issues/16625 + * @see https://github.com/aws/aws-cdk/issues/16625 */ @javax.annotation.Generated(value = "jsii-pacmak") @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) @@ -23690,7 +23690,7 @@ package software.amazon.jsii.tests.calculator.module2530; /** * Verifies a method with parameters "_" can be generated. *

- * @see https://github.com/aws/jsii/issues/2530 + * @see https://github.com/aws/jsii/issues/2530 */ @javax.annotation.Generated(value = "jsii-pacmak") @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) @@ -23774,7 +23774,7 @@ package software.amazon.jsii.tests.calculator.module2647; /** * This class falls into the category of "multiple bases" from a different module from a go code gen perspective. *

- * @see https://github.com/aws/jsii/issues/2647 + * @see https://github.com/aws/jsii/issues/2647 */ @javax.annotation.Generated(value = "jsii-pacmak") @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) @@ -25726,7 +25726,7 @@ package software.amazon.jsii.tests.calculator.submodule; /** * A struct named "Default". *

- * @see https://github.com/aws/jsii/issues/2637 + * @see https://github.com/aws/jsii/issues/2637 */ @javax.annotation.Generated(value = "jsii-pacmak") @software.amazon.jsii.Jsii(module = software.amazon.jsii.tests.calculator.$Module.class, fqn = "jsii-calc.submodule.Default") @@ -26325,7 +26325,7 @@ package software.amazon.jsii.tests.calculator.submodule.child; /** * Checks that classes can self-reference during initialization. *

- * @see : https://github.com/aws/jsii/pull/1706 + * @see : https://github.com/aws/jsii/pull/1706 */ @javax.annotation.Generated(value = "jsii-pacmak") @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)