Skip to content

Add @Documented to all annotations in org.python.expose.#415

Merged
Stewori merged 8 commits into
jython:masterfrom
Stewori:exposed_annotations_documented
May 26, 2026
Merged

Add @Documented to all annotations in org.python.expose.#415
Stewori merged 8 commits into
jython:masterfrom
Stewori:exposed_annotations_documented

Conversation

@Stewori

@Stewori Stewori commented Mar 4, 2026

Copy link
Copy Markdown
Member

Closes #388

@Stewori

Stewori commented Mar 4, 2026

Copy link
Copy Markdown
Member Author

This should be a safe one. (heard that before^^, little did they know)
However, tests support this opinion. I'll leave it here for others to take a look for typos @jeff5 @ohumbel
Will merge in a couple of days if nobody speaks up.

@ohumbel

ohumbel commented Mar 9, 2026

Copy link
Copy Markdown
Contributor

I checked the changes very carefully and could not spot any typos...
Looks safe to me.

@jeff5

jeff5 commented Apr 17, 2026

Copy link
Copy Markdown
Member

Yes to @Documented in general, but I see you've tidied up some Javadoc, so I'll read carefully.

Comment thread src/org/python/expose/ExposedNew.java Outdated
* that object. See {@link PyInteger#int_new} for an example of this type of ExposedNew.
*<p>
* {@code PyNewWrapper new_, boolean init, PyType subtype, PyObject[] args, String[] keywords}.
* In this case, the method has full responsibility for creating and initiating the object and

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
* In this case, the method has full responsibility for creating and initiating the object and
* In this case, the method has full responsibility for creating and initialising the object and

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Except of course now we run into US vs UK English. (I won't object to either.)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I suppose, AE is more in line with PSF standard, so "initializing" it will be. Also, my dict says it's somewhat acceptable in BE unlike the other way round.

Comment thread src/org/python/expose/ExposedNew.java Outdated
* that object. See {@link PyInteger#int_new} for an example of this type of ExposedNew.
*<p>
* {@code PyNewWrapper new_, boolean init, PyType subtype, PyObject[] args, String[] keywords}.
* In this case, the method has full responsibility for creating and initiating the object and

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Except of course now we run into US vs UK English. (I won't object to either.)

Comment thread src/org/python/expose/ExposedType.java Outdated
Comment on lines +27 to +28
* @return the base type of this type. Must be another class annotated with {@code ExposedType}.
* If unspecified, the base is set to {@code object}, or {@code PyObject.class}.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

If the @return has to be qualified I would probably give the full version in the Javadoc body, and a minimal one in the @return.

@Stewori Stewori May 21, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yes, that's the typical way. My intention was to keep changes minimal and to bring everything into consistent form. Since some class used plainly @return ... without prior main-body doc, while other classes used Returns ... I decided to use the @return way consistently. If no body html is present, but only @return ... block, APIdia employs @return ... content also as main body prefixed with Returns: and as @return ... block tag. So this leads to a proper doc. I used to think Javadoc would do it similarly. However, in conventional Javadoc, this became possible just with Java 16 which introduced the inline {@return ...} tag:

https://bugs.openjdk.org/browse/JDK-8075778?page=com.atlassian.jira.plugin.system.issuetabpanels%3Aall-tabpanel

So, if we would build with e.g. Java 17 or later, The solution would be using inline {@return ...}.

Comment thread src/org/python/expose/ExposedType.java Outdated
Comment on lines +27 to +28
* @return the base type of this type. Must be another class annotated with {@code ExposedType}.
* If unspecified, the base is set to {@code object}, or {@code PyObject.class}.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
* @return the base type of this type. Must be another class annotated with {@code ExposedType}.
* If unspecified, the base is set to {@code object}, or {@code PyObject.class}.
* Return the base type of this type. This must be another class annotated with {@code ExposedType}.
* If not specified (or {@code Object.class} is given), the base is set to Python {@code object}, that is {@code PyObject.class}.
* @return the base type of this type.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yes, this makes sense for the long description of base(). However the principle does not fit naturally to the other methods which have very short doc.

@jeff5 jeff5 added this to the 2.7.5 milestone Apr 17, 2026
@Stewori Stewori changed the title Added @Documented to all annotations in org.python.expose. Add @Documented to all annotations in org.python.expose. May 21, 2026
Comment thread src/org/python/expose/ExposedType.java Outdated

/**
* Returns the __doc__ String for this type.
* @return the {@code __doc__} string for this type.

@Stewori Stewori May 21, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@jeff5 You see, here I changed it just for consistency. The previous method isBaseType() uses plainly @return in the first place. If we cannot use {@return ...}, maybe it would be best to make them all consistently Returns .... Then, at least it's always readable in the summary, also in older Javadoc.

…be the only content. Change initiate to initialize.
@Stewori

Stewori commented May 26, 2026

Copy link
Copy Markdown
Member Author

Okay, to move on and - I think doc-related concerns have been addressed, I'll merge this one now.

@Stewori Stewori merged commit 83ca45e into jython:master May 26, 2026
8 checks passed
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.

@ExposedType annotation should be @Documented

3 participants