Code reuse, licenses, attribution
Key Takeaways
-
Code written by a human is automatically copyrighted.
Copyright exists from the moment the code is created; no registration is required. -
Copyright means you cannot automatically copy, modify, or redistribute someone else’s code.
The copyright owner must give you permission, usually through a software licence. -
A licence does not create copyright, it gives permissions under copyright.
The author keeps copyright but chooses what other people are allowed to do with the code. -
Publicly available code is not automatically licensed for reuse.
Being able to see or download code does not mean you have permission to copy, modify, or redistribute it. Always check the licence. -
No licence ≠ public domain.
If a repository has no licence, the default is effectively all rights reserved. Do not copy, modify, or redistribute the code. -
Always check the licence before using third-party code including adding it as a dependency in your code.
Also check for special exceptions or additional conditions, the exact licence text matters (e.g., JavaFX classpath exception). -
MIT and Apache 2.0 are permissive licences.
They generally allow use in open-source, closed-source, and commercial projects as long as their conditions, such as notices and attribution, are followed. -
GPL is a strong copyleft licence.
If GPL obligations are triggered when you distribute software combined with GPL code, you also need to distribute the resulting work under GPL-compatible terms and provide source code. -
LGPL is more flexible for libraries.
It can allow proprietary applications to link to an LGPL library without requiring the whole application to become open source, provided the LGPL conditions are followed. -
AGPL extends copyleft to network use.
Unlike standard GPL, making modified AGPL software available to users through a network or SaaS service can trigger source-code obligations. -
Distribution/shipping is a key trigger for copyleft obligations.
Under the standard GPL, you can generally use, copy, modify, and link GPL-licensed code internally without being required to release your own source code. The copyleft obligations are typically triggered when you distribute or ship the resulting software to someone outside your organisation—for example as a.jar, executable, mobile app, container image, or embedded device.
If you do not distribute the software, you generally do not have to open-source your own code under the GPL.
The important exception is AGPL, where allowing external users to interact with the software over a network can also trigger source-code obligations. -
Dependencies save development time, but they also introduce risk.
When you use a library, you inherit its bugs, vulnerabilities, maintenance problems, dependencies, and licence obligations. -
Transitive dependencies matter too.
Your project may depend on many libraries that you never explicitly selected. Use:./mvnw dependency:treeto understand what is actually included in your project.
-
Prefer using a library as a dependency instead of copying its source code.
For Java projects, declare appropriate libraries inpom.xmlrather than copying their implementation into your project. -
Creative Commons licences are mainly for creative works, not software.
They are commonly used for text, images, music, and other media. Software should normally use a recognised software licence such as MIT, Apache, GPL, or LGPL. -
If you copy substantial code, attribution may be required.
For SOFTENG206, copied Stack Overflow code of 5 or more lines should be attributed, and you should state what you changed. -
Pure AI-generated code is treated differently across countries.
US/EU view, copyright normally requires human authorship, so purely AI-generated output without sufficient human creative contribution may not receive copyright protection. -
New Zealand has a different rule for computer-generated works.
Under the NZ Copyright Act, copyright in a computer-generated work can belong to “the person by whom the arrangements necessary for the creation of the work are undertaken.”
For generative AI, whether this person is the human writing the prompt, the AI provider, or someone else has not yet been definitively decided by a New Zealand court.
In practice, many AI providers state in their terms that they assign to the user any rights they may have in the generated output. This means the human using the AI will often have the strongest practical claim to the output, although the exact legal position under NZ copyright law remains unsettled. -
Human contributions to AI-assisted code can still be copyrighted.
Code you write yourself, your architecture and design, and substantial human modifications to AI-generated code can be protected even where purely AI-generated material is not. -
You are still responsible for AI-generated code.
AI may generate incorrect, insecure, inefficient, or potentially problematic code. You must understand, test, and be able to explain the code you include in your project. -
Keep a clear record of third-party and AI-assisted work.
UseCREDITS.mdto document sources, authors, licences, AI tools/models, prompts, dates, and modifications. This is a recommendation, not something assessed in SOFTENG206.
Main rule:
Before using code you did not write, ask: Who owns it? What licence applies? What am I allowed to do with it? What must I do in return?
