Skip to content

Dedicated chapter about code generation configuration #1850

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

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

vmikhailenko
Copy link
Contributor

@vmikhailenko vmikhailenko commented May 15, 2025

Introduces chapter to describe switches in Java Code generator. Previously that was documented in the Maven Plugin. This chapter somewhat repeats that documentation and aims to improve the visibility of said switches.

@@ -63,3 +63,151 @@ properties:
:::warning SAP Business Application Studio
If you develop your application in SAP Business Application Studio and Java 21 is not available there, use the Java 17, instead.
:::

## Configuring Code Generation for Typed Access {#codegen-config}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe rather put this whole paragraph into the "Building Applications" section?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Order was to do it here. :) I thought that we need introduce new top-level chapter: there is much more stuff that needs to be documented.

@BraunMatthias @agoerler ??


Moreover, it doesn't change the way how event contexts and entities, delivered by CAP, look like. Such interfaces from CAP are always modelled in the default JavaBeans style.

### Code Generation Features
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this doc already reflecting the 4.0.0 state regarding defaults of these parameters?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whatever remains available in 4.0 is described, except stuff that is not intended for POM at all.


- Names from CDS model that are Java keywords are prefixed with `_`.
- Names from CDS model that use characters that are not valid as Java identifiers, are replaced by `_`. This, however, might lead to a conflicts between names that yield same name in Java.
- Characters `/` and `$` behave just like `_`: they used to provide camel-cased name and provide better support for models coming from ABAP systems.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

they used to provide camel-cased name and provide better support for models coming from ABAP systems.

Can you clarify that. I am not sure if I understand that sentence.

EDIT: Ah I think I got it, they are not replaced by "" but behave like a "" would. Maybe it would be beneficial to explain how a "_" behaves. This is not explicitly explained here at the moment.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I rather use something more generic to avoid deep dives in the implementation details.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well I think it is helpful that these rules are explained. They are very visible and I wouldn't consider it an implementation detail.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To which extent?

Comment on lines +181 to +184
:::warning Check migration guides!
In major releases of CAP Java, some of these switches can be made new default and some other switches might be removed. This might introduce compile errors
in your application that needs to be fixed.
:::
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this warning is not really required here. We should always document the latest version. All things related to major versions can be mentioned in the migration guides. I don't think we need to emphasize that here explicitly.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was intended as a reminder to someone who comes here from search and somehow confused why some switch is no longer mentioned or why they have compile errors now.

@vmikhailenko vmikhailenko marked this pull request as ready for review May 16, 2025 14:35
@vmikhailenko vmikhailenko requested a review from smahati as a code owner May 16, 2025 14:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants