Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@ tasks
.withType<JavaCompile>()
.matching { it.name == "compileJava" || it.name == "compileTestJava" }
.configureEach {
// TODO: re-enable this-escape when ANTLR suppresses it properly
val disabledLint = listOf(
"processing", "path", "fallthrough", "serial", "overloads", "this-escape",
"processing", "path", "fallthrough", "serial", "overloads",
)
options.release.set(25)
options.compilerArgs.addAll(listOf("-Xlint:all") + disabledLint.map { "-Xlint:-$it" })
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ public static PermissionsResolverManager getInstance() {
FlatFilePermissionsResolver.class,
};

@SuppressWarnings("this-escape")
protected PermissionsResolverManager(Plugin plugin) {
this.server = plugin.getServer();
new ServerListener().register(plugin); // Register the events
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ public abstract class CoreMcPlatform extends AbstractPlatform implements MultiUs
private boolean hookingEvents = false;
private CoreMcPermissionsProvider permissionsProvider;

@SuppressWarnings("this-escape")
protected CoreMcPlatform(CoreMcMod mod, Lifecycled<MinecraftServer> server) {
this.mod = mod;
this.dataFixer = new CoreMcDataFixer(this, getDataVersion());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,7 @@ public CoreMcPlayer(CoreMcPlatform platform, ServerPlayer player) {
this.platform = platform;
this.player = player;

if (getUniqueId() == null) {
throw new AssertionError("Player UUID cannot be null");
}

ThreadSafeCache.getInstance().getOnlineIds().add(getUniqueId());
ThreadSafeCache.getInstance().getOnlineIds().add(player.getUUID());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ public SkullBlock(BlockState state) {
* @param blockState BlockState to set
* @param owner name of player
*/
@SuppressWarnings("this-escape")
public SkullBlock(BlockState blockState, String owner) {
super(blockState);
this.setOwner(owner);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,13 @@ public ParserContext() {
* @param other the other instance
*/
public ParserContext(ParserContext other) {
setExtent(other.getExtent());
setSession(other.getSession());
setWorld(other.getWorld());
setActor(other.getActor());
setRestricted(other.isRestricted());
setPreferringWildcard(other.isPreferringWildcard());
setTryLegacy(other.isTryingLegacy());
this.extent = other.extent;
this.session = other.session;
this.world = other.world;
this.actor = other.actor;
this.restricted = other.restricted;
this.tryLegacy = other.tryLegacy;
this.preferringWildcard = other.preferringWildcard;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,15 @@
public abstract class AbstractPlatform implements Platform {

private final ResourceLoader resourceLoader = new WorldEditResourceLoader(WorldEdit.getInstance());
@SuppressWarnings("this-escape")
private final LazyReference<ArchiveUnpacker> archiveUnpacker = LazyReference.from(() -> {
try {
return new ArchiveUnpacker(getConfiguration().getWorkingDirectoryPath().resolve(".archive-unpack"));
} catch (IOException e) {
throw new UncheckedIOException(e);
}
});
@SuppressWarnings("this-escape")
private final LazyReference<TranslationManager> translationManager = LazyReference.from(() -> {
try {
return new TranslationManager(archiveUnpacker.getValue(), getResourceLoader());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ public class PlatformManager {
*
* @param worldEdit the WorldEdit instance
*/
@SuppressWarnings("this-escape")
public PlatformManager(WorldEdit worldEdit) {
checkNotNull(worldEdit);
this.worldEdit = worldEdit;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@
*/
public class BlockArrayClipboard implements Clipboard {

private static BlockVector3 getDimensions(Region region) {
return region.getMaximumPoint().subtract(region.getMinimumPoint()).add(1, 1, 1);
}

private final Region region;
private BlockVector3 origin;
/**
Expand Down Expand Up @@ -73,7 +77,7 @@ public BlockArrayClipboard(Region region) {
this.region = region.clone();
this.origin = region.getMinimumPoint();

BlockVector3 dimensions = getDimensions();
BlockVector3 dimensions = getDimensions(region);
blocks = new BaseBlock[dimensions.x() * dimensions.y() * dimensions.z()];
yStride = dimensions.x();
zStride = yStride * dimensions.y();
Expand All @@ -100,7 +104,7 @@ public void setOrigin(BlockVector3 origin) {

@Override
public BlockVector3 getDimensions() {
return region.getMaximumPoint().subtract(region.getMinimumPoint()).add(1, 1, 1);
return getDimensions(region);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public abstract class AbstractExtentMask extends AbstractMask {
* @param extent the extent
*/
protected AbstractExtentMask(Extent extent) {
setExtent(extent);
this.extent = extent;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@
*/
public class NoiseFilter extends AbstractMask {

private static void checkDensity(double density) {
checkArgument(density >= 0, "density must be >= 0");
checkArgument(density <= 1, "density must be <= 1");
}

private NoiseGenerator noiseGenerator;
private double density;

Expand All @@ -43,8 +48,9 @@ public class NoiseFilter extends AbstractMask {
* @param density the density
*/
public NoiseFilter(NoiseGenerator noiseGenerator, double density) {
setNoiseGenerator(noiseGenerator);
setDensity(density);
checkDensity(density);
this.noiseGenerator = noiseGenerator;
this.density = density;
}

/**
Expand Down Expand Up @@ -79,8 +85,7 @@ public double getDensity() {
* Set the probability of passing as a number between 0 and 1 (inclusive).
*/
public void setDensity(double density) {
checkArgument(density >= 0, "density must be >= 0");
checkArgument(density <= 1, "density must be <= 1");
checkDensity(density);
this.density = density;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@
*/
public class NoiseFilter2D extends AbstractMask2D {

private static void checkDensity(double density) {
checkArgument(density >= 0, "density must be >= 0");
checkArgument(density <= 1, "density must be <= 1");
}

private NoiseGenerator noiseGenerator;
private double density;

Expand All @@ -41,8 +46,9 @@ public class NoiseFilter2D extends AbstractMask2D {
* @param density the density
*/
public NoiseFilter2D(NoiseGenerator noiseGenerator, double density) {
setNoiseGenerator(noiseGenerator);
setDensity(density);
checkDensity(density);
this.noiseGenerator = noiseGenerator;
this.density = density;
}

/**
Expand Down Expand Up @@ -77,8 +83,7 @@ public double getDensity() {
* Set the probability of passing as a number between 0 and 1 (inclusive).
*/
public void setDensity(double density) {
checkArgument(density >= 0, "density must be >= 0");
checkArgument(density <= 1, "density must be <= 1");
checkDensity(density);
this.density = density;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public class RegionMask extends AbstractMask {
* @param region the region
*/
public RegionMask(Region region) {
setRegion(region);
this.region = region;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,12 @@
package com.sk89q.worldedit.function.operation;

import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.util.formatting.text.Component;

import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Deque;
import java.util.List;
Expand All @@ -36,14 +37,15 @@
*/
public class OperationQueue implements Operation {

private final List<Operation> operations = Lists.newArrayList();
private final List<Operation> operations;
private final Deque<Operation> queue = new ArrayDeque<>();
private Operation current;

/**
* Create a new queue containing no operations.
*/
public OperationQueue() {
this.operations = new ArrayList<>();
}

/**
Expand All @@ -53,22 +55,17 @@ public OperationQueue() {
*/
public OperationQueue(Collection<Operation> operations) {
checkNotNull(operations);
for (Operation operation : operations) {
offer(operation);
}
this.operations.addAll(operations);
this.queue.addAll(operations);
this.operations = new ArrayList<>(operations);
}

/**
* Create a new queue with operations from the given array.
*
* @param operation an array of operations
* @param operations an array of operations
*/
public OperationQueue(Operation... operation) {
checkNotNull(operation);
for (Operation o : operation) {
offer(o);
}
public OperationQueue(Operation... operations) {
this(Arrays.asList(operations));
}

/**
Expand All @@ -79,6 +76,7 @@ public OperationQueue(Operation... operation) {
public void offer(Operation operation) {
checkNotNull(operation);
queue.offer(operation);
operations.add(operation);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public class BlockPattern extends AbstractPattern {
* @param block the block
*/
public BlockPattern(BlockStateHolder<?> block) {
setBlock(block);
this.block = block.toBaseBlock();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ public class RepeatingExtentPattern extends AbstractExtentPattern {
*/
public RepeatingExtentPattern(Extent extent, BlockVector3 origin, BlockVector3 offset) {
super(extent);
setOrigin(origin);
setOffset(offset);
this.origin = origin;
this.offset = offset;
size = extent.getMaximumPoint().subtract(extent.getMinimumPoint()).add(1, 1, 1);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public class FlatRegionOffset implements FlatRegionFunction {
*/
public FlatRegionOffset(BlockVector2 offset, FlatRegionFunction function) {
checkNotNull(function);
setOffset(offset);
this.offset = offset;
this.function = function;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public class RegionOffset implements RegionFunction {
*/
public RegionOffset(BlockVector3 offset, RegionFunction function) {
checkNotNull(function);
setOffset(offset);
this.offset = offset;
this.function = function;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ public abstract class BreadthFirstSearch implements Operation {
*
* @param function the function to apply to visited blocks
*/
@SuppressWarnings("this-escape")
protected BreadthFirstSearch(RegionFunction function) {
checkNotNull(function);
this.function = function;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ public class DownwardVisitor extends RecursiveVisitor {
* @param function the function
* @param baseY the base Y
*/
@SuppressWarnings("this-escape")
public DownwardVisitor(Mask mask, RegionFunction function, int baseY) {
super(mask, function);
checkNotNull(mask);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public class NonRisingVisitor extends RecursiveVisitor {
* @param mask the mask
* @param function the function
*/
@SuppressWarnings("this-escape")
public NonRisingVisitor(Mask mask, RegionFunction function) {
super(mask, function);
Collection<BlockVector3> directions = getDirections();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ public class KochanekBartelsInterpolation implements Interpolation {
private Vector3[] coeffD;
private double scaling;

@SuppressWarnings("this-escape")
public KochanekBartelsInterpolation() {
setNodes(Collections.emptyList());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ public CuboidRegion(BlockVector3 pos1, BlockVector3 pos2) {
* @param pos1 the first position
* @param pos2 the second position
*/
@SuppressWarnings("this-escape")
public CuboidRegion(World world, BlockVector3 pos1, BlockVector3 pos2) {
super(world);
checkNotNull(pos1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ public CylinderRegion(World world) {
* @param minY the minimum Y, inclusive
* @param maxY the maximum Y, inclusive
*/
@SuppressWarnings("this-escape")
public CylinderRegion(World world, BlockVector3 center, Vector2 radius, int minY, int maxY) {
super(world);
setCenter(center.toBlockVector2());
Expand All @@ -91,6 +92,7 @@ public CylinderRegion(World world, BlockVector3 center, Vector2 radius, int minY
* @param minY the minimum Y, inclusive
* @param maxY the maximum Y, inclusive
*/
@SuppressWarnings("this-escape")
public CylinderRegion(BlockVector3 center, Vector2 radius, int minY, int maxY) {
super(null);
setCenter(center.toBlockVector2());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ public EllipsoidRegion(BlockVector3 pos1, Vector3 pos2) {
* @param center the center
* @param radius the radius
*/
@SuppressWarnings("this-escape")
public EllipsoidRegion(World world, BlockVector3 center, Vector3 radius) {
super(world);
this.center = center;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ public Polygonal2DRegion(World world) {
* @param minY minimum Y
* @param maxY maximum Y
*/
@SuppressWarnings("this-escape")
public Polygonal2DRegion(World world, List<BlockVector2> points, int minY, int maxY) {
super(world);
this.points = new ArrayList<>(points);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public class FlatRegionIterator implements Iterator<BlockVector2> {
private int nextX;
private int nextZ;

@SuppressWarnings("this-escape")
public FlatRegionIterator(Region region) {
checkNotNull(region);

Expand Down
Loading
Loading