aws / aws/jsii

Java pacmak breaks if docstring contains `\u` character string

Open
#3,302 0 comments 0 reactions 0 assignees View on GitHub
bug p1
Dominant language
TypeScript
Stars
2.9k
Forks
267
Avg merge
1d 25m
Merged PRs (30d)
14

Description

## :bug: Bug Report

### Affected Languages
- [ ] `TypeScript` or `Javascript`
- [ ] `Python`
- [x] `Java`
- [ ] .NET (`C#`, `F#`, ...)
- [ ] `Go`

### General Information
* **JSII Version:** 1.50.0

### What is the problem?

If the docstring for an element contains the string `\u`, the Java build fails:

```
#STDOUT> [ERROR] /tmp/npm-pack6Fz26z/_aws-cdk_aws-lex/src/main/java/software/amazon/awscdk/services/lex/CfnBot.java:[11584,39] illegal unicode escape
#STDOUT> [ERROR] /tmp/npm-pack6Fz26z/_aws-cdk_aws-lex/src/main/java/software/amazon/awscdk/services/lex/CfnBot.java:[13,1] illegal unicode escape
#STDOUT> [ERROR] /tmp/npm-pack6Fz26z/_aws-cdk_aws-lex/src/main/java/software/amazon/awscdk/services/lex/CfnBot.java:[11621,58] illegal unicode escape
#STDOUT> [ERROR] /tmp/npm-pack6Fz26z/_aws-cdk_aws-lex/src/main/java/software/amazon/awscdk/services/lex/CfnBot.java:[17,32] illegal unicode escape
```

Code in question:

```java
/**
* A regular expression used to validate the value of a slot.
*


* Use a standard regular expression. Amazon Lex supports the following characters in the regular expression:
*


*


    *
  • A-Z, a-z
  • *
  • 0-9

  • *
  • Unicode characters ("\u")

  • *

*


* Represent Unicode characters with four digits, for example "]u0041" or "\u005A".
*


* The following regular expression operators are not supported:
*


*


    *
  • Infinite repeaters: *, +, or {x,} with no upper bound

  • *
  • Wild card (.)

  • *

*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
@org.jetbrains.annotations.NotNull java.lang.String getPattern();
```

The correct rendering should be `\\u`.

Contributor guide

Open the contributing guide

Research direction

Start by tracing the Java pacmak rendering path for docstrings and reproduce the failure with a docstring containing the literal `\u`. Compare the generated Java documentation with the expected escaped `\\u` rendering, then run the relevant Java generation or packaging tests if present; done means the generated Java build succeeds for this case.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, typescript
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.