Use our own firstNonNull to maintain back-compat.

Fixes WORLDEDIT-3567.
Dieser Commit ist enthalten in:
wizjany 2017-05-22 16:00:50 -04:00
Ursprung 3cf018f14a
Commit 46dff16a97
7 geänderte Dateien mit 41 neuen und 7 gelöschten Zeilen

Datei anzeigen

@ -21,7 +21,7 @@ buildscript {
configurations.all {
resolutionStrategy {
force 'com.google.guava:guava:17.0'
force 'com.google.guava:guava:21.0'
}
}

Datei anzeigen

@ -5,7 +5,7 @@ dependencies {
compile 'de.schlichtherle:truezip:6.8.3'
compile 'rhino:js:1.7R2'
compile 'org.yaml:snakeyaml:1.9'
compile 'com.google.guava:guava:17.0'
compile 'com.google.guava:guava:21.0'
compile 'com.sk89q:jchronic:0.2.4a'
compile 'com.google.code.findbugs:jsr305:1.3.9'
compile 'com.thoughtworks.paranamer:paranamer:2.6'

Datei anzeigen

@ -30,7 +30,8 @@ import com.sk89q.worldedit.function.pattern.Pattern;
import com.sk89q.worldedit.util.command.argument.CommandArgs;
import com.sk89q.worldedit.util.command.composition.SimpleCommand;
import static com.google.common.base.Objects.firstNonNull;
import static com.sk89q.worldedit.util.GuavaUtil.firstNonNull;
public class ReplaceParser extends SimpleCommand<Contextual<? extends RegionFunction>> {

Datei anzeigen

@ -27,8 +27,8 @@ import com.sk89q.worldedit.function.visitor.RegionVisitor;
import com.sk89q.worldedit.regions.NullRegion;
import com.sk89q.worldedit.regions.Region;
import static com.google.common.base.Objects.firstNonNull;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.sk89q.worldedit.util.GuavaUtil.firstNonNull;
public class Apply implements Contextual<Operation> {

Datei anzeigen

@ -19,7 +19,6 @@
package com.sk89q.worldedit.function.factory;
import com.google.common.base.Objects;
import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.Vector;
import com.sk89q.worldedit.WorldEditException;
@ -36,6 +35,7 @@ import com.sk89q.worldedit.regions.Region;
import java.util.List;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.sk89q.worldedit.util.GuavaUtil.firstNonNull;
public class Deform implements Contextual<Operation> {
@ -123,7 +123,7 @@ public class Deform implements Contextual<Operation> {
final Vector zero;
Vector unit;
Region region = Objects.firstNonNull(context.getRegion(), this.region);
Region region = firstNonNull(context.getRegion(), this.region);
switch (mode) {
case UNIT_CUBE:

Datei anzeigen

@ -33,9 +33,9 @@ import com.sk89q.worldedit.math.noise.RandomNoise;
import com.sk89q.worldedit.regions.NullRegion;
import com.sk89q.worldedit.regions.Region;
import static com.google.common.base.Objects.firstNonNull;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.sk89q.worldedit.regions.Regions.*;
import static com.sk89q.worldedit.util.GuavaUtil.firstNonNull;
public class Paint implements Contextual<Operation> {

Datei anzeigen

@ -0,0 +1,33 @@
/*
* WorldEdit, a Minecraft world manipulation toolkit
* Copyright (C) sk89q <http://www.sk89q.com>
* Copyright (C) WorldEdit team and contributors
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by the
* Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.sk89q.worldedit.util;
import javax.annotation.Nullable;
import static com.google.common.base.Preconditions.checkNotNull;
public final class GuavaUtil {
private GuavaUtil() {}
public static <T> T firstNonNull(@Nullable T first, @Nullable T second) {
return first != null ? first : checkNotNull(second);
}
}