mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-26 22:40:21 +01:00
[ci skip] Add mention of FQ imports (#9994)
This commit is contained in:
parent
6158767599
commit
1d8eb1581e
1 changed files with 15 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue