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

Documentation adding and editing #5490

Closed
wants to merge 10 commits into from
Closed

Conversation

TheMarvelFan
Copy link

@TheMarvelFan TheMarvelFan commented Oct 7, 2023

Referencing issue #1876
Added documentation for methods that I found undocumented, and also added param and return annotation for methods that didn't have them (referencing issue #3923), along with improving some present documentation that seemed unclear. This is a work in progress and I will keep adding commits to it, but I wanted someone to review whether this pull request so I can make sure whether this is the right way/standard to do it.
Thanks.

@TheMarvelFan
Copy link
Author

@MartinWitt @SirYwell Hi has anyone looked at this PR yet?

Copy link
Contributor

@algomaster99 algomaster99 left a comment

Choose a reason for hiding this comment

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

Thanks for the PR! And sorry for the delay.

Comment on lines 57 to 61
/**
* This method retrieves a list of variables from a given parent CtElement instance.
* @param parent The parent element from which to retrieve variables.
* @return A list of variables found within the parent element.
*/
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
/**
* This method retrieves a list of variables from a given parent CtElement instance.
* @param parent The parent element from which to retrieve variables.
* @return A list of variables found within the parent element.
*/

We can skip documentation for private methods.

Comment on lines 67 to 70

/*
* This class scans for variables within a given element.
*/
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
/*
* This class scans for variables within a given element.
*/

We can skip for package-private class as well.

Comment on lines 143 to 145
/**
* Appends tabs or spaces to a StringBuilder based on the environment settings.
*/
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
/**
* Appends tabs or spaces to a StringBuilder based on the environment settings.
*/

Comment on lines 160 to 163
/**
* Writes tabs if the condition is met.
* This method checks if tabs should be written, and if so, it writes them and resets the flag.
*/
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
/**
* Writes tabs if the condition is met.
* This method checks if tabs should be written, and if so, it writes them and resets the flag.
*/

Comment on lines 229 to 232
/**
* @param c Character that needs to be checked for being space/line-break character
* @return true if character is space/line-break character
*/
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
/**
* @param c Character that needs to be checked for being space/line-break character
* @return true if character is space/line-break character
*/

Comment on lines 72 to 76

/**
* This method visits a list of statements and adds any variables it finds to the list.
* @param e The list of statements to visit.
*/
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
/**
* This method visits a list of statements and adds any variables it finds to the list.
* @param e The list of statements to visit.
*/

I think we can remove all the docstring in the overridden methods in this class as they are not part of the public API. They are just public.

Copy link
Author

@TheMarvelFan TheMarvelFan Nov 13, 2023

Choose a reason for hiding this comment

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

Alright. Thanks for pointing out these corrections. I will rectify these and add new javadocs based your suggestions.

@algomaster99
Copy link
Contributor

algomaster99 commented Nov 13, 2023

@monperrus you can merge it after approving the workflow.

@MartinWitt
Copy link
Collaborator

Hey,

We had some internal discussion about this PR. Could you reduce this PR to at max 3 methods to make it easier to review? There are some Javadoc comments which seem wrong, and we can discuss them in depth easier if there are only a few changes.

@TheMarvelFan
Copy link
Author

Hi @MartinWitt ,

I apologize if any of the comments seem wrong. I will work on reducing the number of methods covered by the javadocs down to 3, but I was curious if you want any specific methods or any specific class's methods to be a part of those 3.

@MartinWitt
Copy link
Collaborator

Hey @TheMarvelFan,

Please have no hesitation to choose any method you like. Every added documentation is awesome.

Methods whose documentation was retained:
AstParentConsistencyChecker.java: scan()
CacheBasedConflictFinder.java: hasNestedTypeConflict(), hasFieldConflict()
Copy link
Collaborator

@MartinWitt MartinWitt left a comment

Choose a reason for hiding this comment

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

Also please minimize the changes in other places/files where you dont add new doc.

@@ -13,6 +13,11 @@
public class AstParentConsistencyChecker extends CtScanner {

private CtElement parent;

/**
* Scans a CtElement in the abstract syntax tree (AST) and enforces reference sharing across the AST.
Copy link
Collaborator

Choose a reason for hiding this comment

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

I dont get where this method enforces references sharing.

Copy link
Author

Choose a reason for hiding this comment

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

This method does not exactly enforce sharing references, but allows sharing reference across the Abstract Syntax Tree. I will correct this.

@@ -28,7 +28,11 @@ public class CacheBasedConflictFinder {
typeRef = type.getReference();
}

/** returns true if the given name is a field name */
/**
* Checks if a field with the given name conflicts with fields in the type's scope.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Explain what a conflict is.

Copy link
Author

Choose a reason for hiding this comment

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

I will add the suggested changes.

@I-Al-Istannen
Copy link
Collaborator

Thank you for your contribution, but we do not believe that the documentation change in this PR is worth it at this stage.

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.

4 participants