aboutsummaryrefslogtreecommitdiffhomepage
path: root/CONTRIBUTING.md
diff options
context:
space:
mode:
authorJake Potrebic <[email protected]>2023-12-02 13:52:14 -0800
committerJake Potrebic <[email protected]>2023-12-02 13:52:14 -0800
commit1d8eb1581ecdf622b9207748a1170f4edb5ee928 (patch)
treef25a2aed29e56d839c323b9cc7a708630573b454 /CONTRIBUTING.md
parent61587675995e9e68f5d7c960afe541defe628866 (diff)
downloadPaper-1d8eb1581ecdf622b9207748a1170f4edb5ee928.tar.gz
Paper-1d8eb1581ecdf622b9207748a1170f4edb5ee928.zip
[ci skip] Add mention of FQ imports (#9994)
Diffstat (limited to 'CONTRIBUTING.md')
-rw-r--r--CONTRIBUTING.md15
1 files changed, 15 insertions, 0 deletions
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 1be2d5a7e0..e72d411d50 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -236,6 +236,21 @@ There are exceptions, especially in Spigot-related files
- When in doubt or the code around your change is in a clearly different style,
use the same style as the surrounding code.
+### Imports
+When adding new imports to a class in a file not created by the current patch, use the fully qualified class name
+instead of adding a new import to the top of the file. If you are using a type a significant number of times, you
+can add an import with a comment. However, if its only used a couple of times, the FQN is preferred to prevent future
+patch conflicts in the import section of the file.
+
+```java
+import org.bukkit.event.Event;
+// don't add import here, use FQN like below
+
+public class SomeEvent extends Event {
+ public final org.bukkit.Location newLocation; // Paper - add location
+}
+```
+
## Access Transformers
Sometimes, vanilla or CraftBukkit code already contains a field, method, or type you want to access
but the visibility is too low (e.g. a private field in an entity class). Paper can use access transformers