简体   繁体   中英

How can I make sure that all the package-info files have same package level annotation?

I want to check if the package-info file has certain annotation. For eg: in my package-info file I have:

@ParametersAreNonnullByDefault

package com.sushmita;

import javax.annotation.ParametersAreNonnullByDefault;

I need a checkstyle to check if all the package-info files in the project have same annotation or not. I tried searching for a Checkstyle/pmd/Findbugs check but I could not find which would fulfill this requirement.

In what ways can I achieve this?

The workaround in intelliJ:

Go to File->Settings->Editor->Templates->Click on package-info

Make your own default contents in the file on the right hand side.

Now when ever I create a package-info, I get the template just like asked in the question.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM