`@NonNull`

Co-authored-by: Vincent Latombe <vincent@latombe.net>
This commit is contained in:
Jesse Glick 2025-04-14 11:13:30 -04:00 committed by GitHub
parent 1660806fc1
commit d908e18855
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 5 additions and 2 deletions

View File

@ -235,6 +235,7 @@ public abstract class Label extends Actionable implements Comparable<Label>, Mod
} }
@Restricted(DoNotUse.class) // Jelly @Restricted(DoNotUse.class) // Jelly
@NonNull
public Collection<? extends IComputer> getComputers() { public Collection<? extends IComputer> getComputers() {
return ExtensionList.lookupFirst(LabelComputerSource.class).get(this).stream().sorted(Comparator.comparing(IComputer::getName)).toList(); return ExtensionList.lookupFirst(LabelComputerSource.class).get(this).stream().sorted(Comparator.comparing(IComputer::getName)).toList();
} }
@ -245,14 +246,16 @@ public abstract class Label extends Actionable implements Comparable<Label>, Mod
*/ */
@Restricted(Beta.class) @Restricted(Beta.class)
public interface LabelComputerSource extends ExtensionPoint { public interface LabelComputerSource extends ExtensionPoint {
Collection<? extends IComputer> get(Label label); @NonNull
Collection<? extends IComputer> get(@NonNull Label label);
} }
@Extension(ordinal = -1) @Extension(ordinal = -1)
@Restricted(DoNotUse.class) @Restricted(DoNotUse.class)
public static class LabelComputerSourceImpl implements LabelComputerSource { public static class LabelComputerSourceImpl implements LabelComputerSource {
@Override @Override
public Collection<? extends IComputer> get(Label label) { @NonNull
public Collection<? extends IComputer> get(@NonNull Label label) {
return label.getNodes().stream().map(Node::toComputer).filter(Objects::nonNull).toList(); return label.getNodes().stream().map(Node::toComputer).filter(Objects::nonNull).toList();
} }
} }