Writing new code
Open source projects vary regarding whether they have "file-by-file" legal notices or global notices (or both). There are pluses and minuses to all approaches, and because it is not absolutely clear that one approach is best, it is left to the discretion of each project lead. That said, most JBoss Community projects have used "file-by-file" notices, and at least some such projects have a clear preference for this on policy grounds.
If you use a file-by-file approach, each time you create a Java source file containing new code (code that you don't copy from another place) you should include an appropriate copyright notice followed by a license notice as a comment at the top of the source file.
For example, if the source file in question is being licensed under the Apache License 2.0, you can adapt the standard license notice recommended in that license (although other ways of wording the notice may be acceptable):
/* * Copyright <YEAR> <COPYRIGHT HOLDER NAME> * * 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. */
Whether you use a file-by-file approach or not, you should globally indicate the license applicable to a given set of source files, and ensure that such license information is preserved in any builds of the software in some appropriate way. This includes providing a copy of the license text. If you are including additional license texts for third-party dependencies, as should typically be the case, you should make clear that those dependency license texts do not govern your code (assuming that is the case).
If you are adding more than a trivial amount of code to an existing Java source file, and the file has a licene notice in it, you can add a copyright notice above or below the existing notice. The best way to do this will vary with the circumstances. You should usually not supplement the indicated license of the existing file
Important: You should never remove existing copyright statements, and in nearly all cases you should never alter them.
The following guidance regarding use of @author tags is preserved here, but it should not be considered a legal requirement.
If you're making a modification to an existing Java source file then you should use the @author JavaDoc tag to indicate who owns the copyright to your contribution.
* @author Firstname Lastname <address @ example.com> (C) <YEAR> <Company Name>
Note: Replace <YEAR> with the correct value. If it's an individual contribution then you don't need to include <Company Name>.
Examples: To be added