Remove blank line between auto-generated ApexDoc and class declaration

Issue #2267 resolved
René Görgens created an issue

Hi Scott,

When I create a new class, a blank line is placed between the auto-generated ApexDoc and the class declaration.

  • With the blank line in place, the ApexDoc is not recognised as being connected with the class:

  • Once I remove the blank line, the ApexDoc is recognised as being connected with the class:

So with the blank line in place, inspections are not working.

Comments (5)

  1. René Görgens reporter

    I confirm that I can eliminate the blank line myself:

    I’d argue that it should be removed from the default template as well.

  2. Scott Wells repo owner

    That’s not an ApexDoc type header comment. It’s a file header comment brought in from the file header template just like the copyright header in the following that’s distinct from the class' ApexDoc comment:

    /*
     * Copyright 2017-present
     *
     * Licensed under the Apache License, Version 2.0 (the "License");
     * you may not use this file except in compliance with the License.
     * You may obtain a copy of the License at
     *
     *     http://www.apache.org/licenses/LICENSE-2.0
     *
     * Unless required by applicable law or agreed to in writing, software
     * distributed under the License is distributed on an "AS IS" BASIS,
     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     * See the License for the specific language governing permissions and
     * limitations under the License.
     */
    
    /**
     * A multi-valued <code>Map</code>. Because of limitations in Apex (inability to extend the system <code>Map</code>
     * implementation, lack of custom parameterized types, etc.), extraction of values from a multi-map requires explicit
     * casting. <code>CollectionUtil</code> provides convenience methods for working with untyped key and value collections.
     *
     * @see Map
     * @see CollectionUtil
     */
    public with sharing class MultiMap { 
    

    The blank link between the file header comment and the actual top-level type is intentional. If you want to add an ApexDoc header comment, you could do so in the respective Apex Class/Interface/Enum file template.

  3. René Görgens reporter

    Ok I see, thanks for clarifying 😁 My thinking revolved around ApexDoc so I didn’t see the difference. Now that I do, I know how to “replace” the file header comment with an ApexDoc comment according to my needs.

  4. Scott Wells repo owner

    That’s one way to do it, though that would affect all templates that import that header. The other option is to update the distinct Apex Class/Interface/Enum/Trigger file templates to include an ApexDoc type header comment, e.g.:

    That’s how I would do this, but I also always include some kind of copyright header at the top of every source file that’s separate from the comment-based documentation.

  5. Log in to comment