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

Consider omitting all comments from generated source files by default #27

Open
zimmi opened this issue Oct 21, 2023 · 0 comments
Open
Assignees
Labels
enhancement New feature or request

Comments

@zimmi
Copy link

zimmi commented Oct 21, 2023

Hi!

Generating a new Maven project, we are greeted with a file like this:

/*
 * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
 */

package org.example;

/**
 *
 * @author zimmi
 */
public class Example {

    public static void main(String[] args) {
        System.out.println("Hello World!");
    }
}

For the target audience of javavscode (students, frontend devs taking a peek at the backend etc.), half of the lines are noise:

  1. If they are at a stage where their project requires license headers in every file, they'll search the documentation how to set it up. It's great that NetBeans makes this easy, but getting reminded of it with every new file will either lead to extra work deleting the comments every time until they get annoyed enough to figure out how to turn it off, or worse, just leaving them as is.
  2. It's arguable that the @author tag is useful at all. Especially in beginner projects with a single author, it just detracts from the important bits, the code. Therefore, it shouldn't be generated by default, IMO.

Taking this into account, the generated class should just be:

package org.example;

public class Main {

    public static void main(String[] args) {
        System.out.println("Hello World!");
    }
}

Naming the class containing the entry point Main seems to be a common practice, so I'd argue to do this as well.
The same reasoning applies to java source generated through Java: New from Template... as well:

/*
 * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
 * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
 */

package org.example2;

/**
 *
 * @author zimmi
 */
public class Test {

}

This is a fresh start, let's present Java in the best light possible.

@lahodaj lahodaj self-assigned this Oct 25, 2023
@Achal1607 Achal1607 added the In-Progress For the issues being worked on label May 8, 2024
@arvindaprameya arvindaprameya added the enhancement New feature or request label Jul 18, 2024
@Achal1607 Achal1607 removed the In-Progress For the issues being worked on label Sep 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants