Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Function to create safe java class ids #276

Open
6 tasks
MeAmAnUsername opened this issue Mar 24, 2022 · 0 comments
Open
6 tasks

Function to create safe java class ids #276

MeAmAnUsername opened this issue Mar 24, 2022 · 0 comments
Labels
Component: code base The code quality of the project (does not affect functionality) Component: code generation Something that concerns the generated code Priority: low Status: proposal Enhancement in the proposal stage Type: bug Something isn't working Type: enhancement New feature or request

Comments

@MeAmAnUsername
Copy link
Owner

Summary
Create a function that correctly generates safe java class ids and use it everywhere.

Todo

  • implement rules that transform to safe java class ids
    • regular names
    • dashes
    • keywords/java reserved words
    • Use type arguments for injected classes
  • Use function everywhere (search for _ and - to find some uses)

Reason
Currently does not handle keywords, and much of the logic for escaping dashes and keywords is duplicated across multiple places.

Implementation
There is already a strategy pie-sanitize-class-id, but it is not used everywhere, and only handles dashes. To handle keywords, it could add specific rules that provide specific outputs, e.g. pie-sanitize-class-id: "super" -> "$super" (note: check if this works with strings with annotations).
To handle type arguments, it could additionally take a list of type arguments and stringify them too.

Related issues
None

@MeAmAnUsername MeAmAnUsername added Type: bug Something isn't working Type: enhancement New feature or request Status: proposal Enhancement in the proposal stage Component: code generation Something that concerns the generated code Component: code base The code quality of the project (does not affect functionality) Priority: low labels Mar 24, 2022
MeAmAnUsername added a commit that referenced this issue Mar 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: code base The code quality of the project (does not affect functionality) Component: code generation Something that concerns the generated code Priority: low Status: proposal Enhancement in the proposal stage Type: bug Something isn't working Type: enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant