Upgrade ErrorProne to v2.10.0
Showing 38 of 59 files from the diff.
Other files ignored by Codecov
api/src/main/java/nl/weeaboo/vn/scene/ILayer.java
has changed.
errorprone.gradle
has changed.
codecov.yml
has changed.
api/src/main/java/nl/weeaboo/vn/save/IStorage.java
has changed.
dependencies.gradle
has changed.
@@ -204,7 +204,7 @@
Loading
204 | 204 | ||
205 | 205 | private final IEnvironment env; |
|
206 | 206 | ||
207 | - | private transient FileSystemView cachedFileSystemView; |
|
207 | + | private transient @Nullable FileSystemView cachedFileSystemView; |
|
208 | 208 | ||
209 | 209 | public LuaScriptResourceLoader(IEnvironment env) { |
|
210 | 210 | super(MediaType.OTHER, env.getResourceLoadLog()); |
@@ -4,6 +4,8 @@
Loading
4 | 4 | import java.lang.reflect.Method; |
|
5 | 5 | import java.util.Arrays; |
|
6 | 6 | ||
7 | + | import javax.annotation.Nullable; |
|
8 | + | ||
7 | 9 | import nl.weeaboo.common.StringUtil; |
|
8 | 10 | import nl.weeaboo.lua2.LuaException; |
|
9 | 11 | import nl.weeaboo.lua2.lib.VarArgFunction; |
@@ -21,7 +23,7 @@
Loading
21 | 23 | ||
22 | 24 | private static final long serialVersionUID = 1L; |
|
23 | 25 | ||
24 | - | private final String tableName; |
|
26 | + | private final @Nullable String tableName; |
|
25 | 27 | ||
26 | 28 | /** |
|
27 | 29 | * @param tableName The name of the global table object to which the library functions should be added, or |
@@ -85,7 +87,7 @@
Loading
85 | 87 | private final String methodName; |
|
86 | 88 | private final Class<?>[] parameterTypes; |
|
87 | 89 | ||
88 | - | private transient Method method; |
|
90 | + | private transient @Nullable Method method; |
|
89 | 91 | ||
90 | 92 | public FunctionWrapper(LuaLib object, String methodName, Class<?>[] parameterTypes) { |
|
91 | 93 | this.name = methodName; |
@@ -119,7 +121,7 @@
Loading
119 | 121 | } |
|
120 | 122 | } |
|
121 | 123 | ||
122 | - | private String invokeErrorMessage(Varargs args, Throwable cause) { |
|
124 | + | private String invokeErrorMessage(Varargs args, @Nullable Throwable cause) { |
|
123 | 125 | String error = StringUtil.formatRoot("Error invoking Java method: %s%s", |
|
124 | 126 | methodName, args); |
|
125 | 127 | if (cause != null) { |
@@ -2,6 +2,9 @@
Loading
2 | 2 | ||
3 | 3 | import java.io.Serializable; |
|
4 | 4 | ||
5 | + | import javax.annotation.CheckForNull; |
|
6 | + | import javax.annotation.Nullable; |
|
7 | + | ||
5 | 8 | import nl.weeaboo.common.Insets2D; |
|
6 | 9 | ||
7 | 10 | /** |
@@ -64,10 +67,11 @@
Loading
64 | 67 | double getNativeHeight(); |
|
65 | 68 | ||
66 | 69 | /** Returns the current texture for the requested region. */ |
|
70 | + | @CheckForNull |
|
67 | 71 | ITexture getTexture(AreaId area); |
|
68 | 72 | ||
69 | 73 | /** Sets the texture of the specified region. */ |
|
70 | - | void setTexture(AreaId area, ITexture texture); |
|
74 | + | void setTexture(AreaId area, @Nullable ITexture texture); |
|
71 | 75 | ||
72 | 76 | /** Returns the amount of non-resizable space on the top/right/bottom/left of the 9-patch. */ |
|
73 | 77 | Insets2D getInsets(); |
@@ -3,6 +3,7 @@
Loading
3 | 3 | import javax.annotation.Nullable; |
|
4 | 4 | ||
5 | 5 | import com.badlogic.gdx.graphics.g2d.TextureRegion; |
|
6 | + | import com.google.errorprone.annotations.InlineMe; |
|
6 | 7 | ||
7 | 8 | import nl.weeaboo.vn.gdx.res.AbstractResource; |
|
8 | 9 | import nl.weeaboo.vn.gdx.res.GdxCleaner; |
@@ -36,6 +37,7 @@
Loading
36 | 37 | } |
|
37 | 38 | ||
38 | 39 | @Deprecated |
|
40 | + | @InlineMe(replacement = "false") |
|
39 | 41 | @Override |
|
40 | 42 | public boolean isDestroyed() { |
|
41 | 43 | return false; |
@@ -56,7 +56,7 @@
Loading
56 | 56 | try { |
|
57 | 57 | byte[] bytes = PixmapUtil.encodePng(pixmap); |
|
58 | 58 | ||
59 | - | @SuppressWarnings("JdkObsolete") // Use date because Android doesn't have java.time |
|
59 | + | @SuppressWarnings("JavaUtilDate") // Use date because Android doesn't have java.time |
|
60 | 60 | String timestamp = new SimpleDateFormat("yyyyMMdd-HHmmss").format(new Date()); |
|
61 | 61 | FilePath fileName = FilePath.of("screenshot-" + timestamp + ".png"); |
|
62 | 62 |
@@ -1,5 +1,7 @@
Loading
1 | 1 | package nl.weeaboo.vn.impl.scene; |
|
2 | 2 | ||
3 | + | import javax.annotation.Nullable; |
|
4 | + | ||
3 | 5 | import org.slf4j.Logger; |
|
4 | 6 | import org.slf4j.LoggerFactory; |
|
5 | 7 |
@@ -43,8 +45,8 @@
Loading
43 | 45 | ||
44 | 46 | private final IOffscreenRenderTaskBuffer offscreenRenderTaskBuffer; |
|
45 | 47 | ||
46 | - | private ILayer rootLayer; // Lazily (re-)initialized when null or destroyed |
|
47 | - | private ILayer activeLayer; // Could potentially point to a destroyed layer (minor memory leak) |
|
48 | + | private @Nullable ILayer rootLayer; // Lazily (re-)initialized when null or destroyed |
|
49 | + | private @Nullable ILayer activeLayer; // Could potentially point to a destroyed layer (minor memory leak) |
|
48 | 50 | private IRenderEnv renderEnv; |
|
49 | 51 | ||
50 | 52 | public Screen(Rect2D bounds, IRenderEnv env, IScreenTextState textState, ISkipState skipState) { |
@@ -111,7 +113,7 @@
Loading
111 | 113 | return doCreateLayer(null); |
|
112 | 114 | } |
|
113 | 115 | ||
114 | - | private ILayer doCreateLayer(ILayer parentLayer) { |
|
116 | + | private ILayer doCreateLayer(@Nullable ILayer parentLayer) { |
|
115 | 117 | ILayer layer = newLayer(parentLayer); |
|
116 | 118 | if (parentLayer != null) { |
|
117 | 119 | layer.setBounds(parentLayer.getX(), parentLayer.getY(), parentLayer.getWidth(), parentLayer.getHeight()); |
@@ -125,7 +127,7 @@
Loading
125 | 127 | * Creates a new layer. |
|
126 | 128 | * @param parentLayer If not {@code null}, creates the new layer as a sub-layer of {@code parentLayer}. |
|
127 | 129 | */ |
|
128 | - | protected ILayer newLayer(ILayer parentLayer) { |
|
130 | + | protected ILayer newLayer(@Nullable ILayer parentLayer) { |
|
129 | 131 | if (parentLayer == null) { |
|
130 | 132 | return new Layer(null); |
|
131 | 133 | } |
@@ -16,9 +16,9 @@
Loading
16 | 16 | private static final String[] stringEscapeFrom = { "\\", "\n", "\r", "\f", "\t", "\"", "\'" }; |
|
17 | 17 | private static final String[] stringEscapeTo = { "\\\\", "\\n", "\\r", "\\f", "\\t", "\\\"", "\\'" }; |
|
18 | 18 | ||
19 | - | private final Object value; |
|
19 | + | private final @Nullable Object value; |
|
20 | 20 | ||
21 | - | private StoragePrimitive(Object value) { |
|
21 | + | private StoragePrimitive(@Nullable Object value) { |
|
22 | 22 | this.value = value; |
|
23 | 23 | } |
|
24 | 24 |
@@ -34,7 +34,7 @@
Loading
34 | 34 | * @return The JSON value converted to a {@link StoragePrimitive} object, or {@code null} if the JSON |
|
35 | 35 | * value couldn't be parsed. |
|
36 | 36 | */ |
|
37 | - | public static @Nullable StoragePrimitive fromJson(String json) { |
|
37 | + | public static @Nullable StoragePrimitive fromJson(@Nullable String json) { |
|
38 | 38 | if (json == null || json.equals("undefined")) { |
|
39 | 39 | return null; |
|
40 | 40 | } |
@@ -2,6 +2,8 @@
Loading
2 | 2 | ||
3 | 3 | import java.util.Map; |
|
4 | 4 | ||
5 | + | import javax.annotation.Nullable; |
|
6 | + | ||
5 | 7 | import com.google.common.base.Preconditions; |
|
6 | 8 | import com.google.common.collect.Maps; |
|
7 | 9 |
@@ -71,7 +73,7 @@
Loading
71 | 73 | } |
|
72 | 74 | ||
73 | 75 | @Override |
|
74 | - | public void setTexture(AreaId area, ITexture texture) { |
|
76 | + | public void setTexture(AreaId area, @Nullable ITexture texture) { |
|
75 | 77 | if (texture != null) { |
|
76 | 78 | textures.put(area, texture); |
|
77 | 79 | } else { |
@@ -4,6 +4,8 @@
Loading
4 | 4 | import java.util.List; |
|
5 | 5 | import java.util.concurrent.CopyOnWriteArrayList; |
|
6 | 6 | ||
7 | + | import javax.annotation.Nullable; |
|
8 | + | ||
7 | 9 | import nl.weeaboo.common.Checks; |
|
8 | 10 | import nl.weeaboo.vn.core.IEventListener; |
|
9 | 11 |
@@ -14,7 +16,7 @@
Loading
14 | 16 | ||
15 | 17 | private static final long serialVersionUID = 1L; |
|
16 | 18 | ||
17 | - | private transient List<IEventListener> transientListeners; |
|
19 | + | private transient @Nullable List<IEventListener> transientListeners; |
|
18 | 20 | ||
19 | 21 | /** |
|
20 | 22 | * @return The internal (mutable) collection storing the transient listeners. |
@@ -2,6 +2,9 @@
Loading
2 | 2 | ||
3 | 3 | import java.io.Serializable; |
|
4 | 4 | ||
5 | + | import javax.annotation.CheckForNull; |
|
6 | + | import javax.annotation.Nullable; |
|
7 | + | ||
5 | 8 | import nl.weeaboo.common.Area2D; |
|
6 | 9 | import nl.weeaboo.common.Rect2D; |
|
7 | 10 | import nl.weeaboo.vn.image.ITexture; |
@@ -14,8 +17,7 @@
Loading
14 | 17 | ||
15 | 18 | private static final long serialVersionUID = 1L; |
|
16 | 19 | ||
17 | - | /** May be null. */ |
|
18 | - | private final ITexture texture; |
|
20 | + | private final @Nullable ITexture texture; |
|
19 | 21 | ||
20 | 22 | private final double alignX; |
|
21 | 23 | private final double alignY; |
@@ -24,16 +26,13 @@
Loading
24 | 26 | this(null, 0, 0); |
|
25 | 27 | } |
|
26 | 28 | ||
27 | - | /** |
|
28 | - | * @param texture May be null |
|
29 | - | */ |
|
30 | - | public AlignedTexture(ITexture texture, double alignX, double alignY) { |
|
29 | + | public AlignedTexture(@Nullable ITexture texture, double alignX, double alignY) { |
|
31 | 30 | this.texture = texture; |
|
32 | 31 | this.alignX = alignX; |
|
33 | 32 | this.alignY = alignY; |
|
34 | 33 | } |
|
35 | 34 | ||
36 | - | /** May be null */ |
|
35 | + | @CheckForNull |
|
37 | 36 | public ITexture getTexture() { |
|
38 | 37 | return texture; |
|
39 | 38 | } |
@@ -156,7 +156,7 @@
Loading
156 | 156 | } |
|
157 | 157 | ||
158 | 158 | @Override |
|
159 | - | public Collection<String> getKeys(String prefix) { |
|
159 | + | public Collection<String> getKeys(@Nullable String prefix) { |
|
160 | 160 | List<String> result = new ArrayList<>(); |
|
161 | 161 | for (String key : properties.keySet()) { |
|
162 | 162 | if (prefix == null || key.startsWith(prefix)) { |
@@ -133,7 +133,7 @@
Loading
133 | 133 | } |
|
134 | 134 | ||
135 | 135 | @Override |
|
136 | - | public void setTexture(ButtonViewState viewState, INinePatch tex) { |
|
136 | + | public void setTexture(ButtonViewState viewState, @Nullable INinePatch tex) { |
|
137 | 137 | if (tex == null) { |
|
138 | 138 | textures.remove(viewState); |
|
139 | 139 | } else { |
@@ -1,5 +1,7 @@
Loading
1 | 1 | package nl.weeaboo.vn.impl.scene; |
|
2 | 2 | ||
3 | + | import javax.annotation.Nullable; |
|
4 | + | ||
3 | 5 | import org.slf4j.Logger; |
|
4 | 6 | import org.slf4j.LoggerFactory; |
|
5 | 7 |
@@ -31,7 +33,7 @@
Loading
31 | 33 | protected Layer() { |
|
32 | 34 | } |
|
33 | 35 | ||
34 | - | public Layer(ILayer parent) { |
|
36 | + | public Layer(@Nullable ILayer parent) { |
|
35 | 37 | setParent(parent); |
|
36 | 38 | ||
37 | 39 | if (parent != null) { |
@@ -122,7 +124,7 @@
Loading
122 | 124 | } |
|
123 | 125 | ||
124 | 126 | @Override |
|
125 | - | public boolean containsLayer(ILayer layer) { |
|
127 | + | public boolean containsLayer(@Nullable ILayer layer) { |
|
126 | 128 | if (layer == null) { |
|
127 | 129 | return false; |
|
128 | 130 | } |
@@ -23,7 +23,6 @@
Loading
23 | 23 | * automatically determined from the pixmap's format. |
|
24 | 24 | * |
|
25 | 25 | * @see #toBufferedImage(Pixmap, int) |
|
26 | - | * @see #toBufferedImageType(Format) |
|
27 | 26 | */ |
|
28 | 27 | public static BufferedImage toBufferedImage(Pixmap pixmap) { |
|
29 | 28 | return toBufferedImage(pixmap, BufferedImageUtil.toBufferedImageType(pixmap.getFormat())); |
@@ -10,6 +10,7 @@
Loading
10 | 10 | import com.badlogic.gdx.graphics.Pixmap; |
|
11 | 11 | import com.badlogic.gdx.graphics.Texture; |
|
12 | 12 | import com.badlogic.gdx.graphics.g2d.TextureRegion; |
|
13 | + | import com.google.errorprone.annotations.InlineMe; |
|
13 | 14 | ||
14 | 15 | import nl.weeaboo.common.Checks; |
|
15 | 16 | import nl.weeaboo.io.CustomSerializable; |
@@ -62,6 +63,7 @@
Loading
62 | 63 | } |
|
63 | 64 | ||
64 | 65 | @Deprecated |
|
66 | + | @InlineMe(replacement = "false") |
|
65 | 67 | @Override |
|
66 | 68 | public boolean isDestroyed() { |
|
67 | 69 | return false; |
@@ -2,6 +2,8 @@
Loading
2 | 2 | ||
3 | 3 | import java.util.List; |
|
4 | 4 | ||
5 | + | import javax.annotation.Nullable; |
|
6 | + | ||
5 | 7 | import com.google.common.collect.ImmutableList; |
|
6 | 8 | import com.google.common.collect.Lists; |
|
7 | 9 |
@@ -29,7 +31,7 @@
Loading
29 | 31 | private final Vec2 scroll = new Vec2(); |
|
30 | 32 | ||
31 | 33 | private boolean dragging; |
|
32 | - | private Vec2 lastPointerPos; |
|
34 | + | private @Nullable Vec2 lastPointerPos; |
|
33 | 35 | private double scrollWheelAccel = 30; |
|
34 | 36 | ||
35 | 37 | @Override |
@@ -3,6 +3,8 @@
Loading
3 | 3 | import java.nio.FloatBuffer; |
|
4 | 4 | import java.util.concurrent.TimeUnit; |
|
5 | 5 | ||
6 | + | import javax.annotation.Nullable; |
|
7 | + | ||
6 | 8 | import com.badlogic.gdx.Gdx; |
|
7 | 9 | import com.badlogic.gdx.graphics.Color; |
|
8 | 10 | import com.badlogic.gdx.graphics.GL20; |
@@ -44,7 +46,7 @@
Loading
44 | 46 | private int buffered; |
|
45 | 47 | private final SpriteBatch spriteBatch = new SpriteBatch(); |
|
46 | 48 | protected GLMatrixStack matrixStack = new GLMatrixStack(spriteBatch); |
|
47 | - | private transient Mesh triangleMesh; |
|
49 | + | private transient @Nullable Mesh triangleMesh; |
|
48 | 50 | // ------------------------------------------------------------------------------------- |
|
49 | 51 | ||
50 | 52 | public GLScreenRenderer(IRenderEnv env, RenderStats stats) { |
@@ -2,6 +2,8 @@
Loading
2 | 2 | ||
3 | 3 | import java.lang.ref.WeakReference; |
|
4 | 4 | ||
5 | + | import javax.annotation.Nullable; |
|
6 | + | ||
5 | 7 | import nl.weeaboo.common.Checks; |
|
6 | 8 | ||
7 | 9 | /** |
@@ -15,8 +17,8 @@
Loading
15 | 17 | private static final long serialVersionUID = 1L; |
|
16 | 18 | ||
17 | 19 | private final IResource<S> inner; |
|
18 | - | private transient WeakReference<S> cachedOriginal; |
|
19 | - | private transient D cachedTransformed; |
|
20 | + | private transient @Nullable WeakReference<S> cachedOriginal; |
|
21 | + | private transient @Nullable D cachedTransformed; |
|
20 | 22 | ||
21 | 23 | protected TransformedResource(IResource<S> inner) { |
|
22 | 24 | this.inner = Checks.checkNotNull(inner); |
@@ -53,9 +53,7 @@
Loading
53 | 53 | ||
54 | 54 | @Override |
|
55 | 55 | protected boolean isValidFilename(FilePath filePath) { |
|
56 | - | if (filePath == null) { |
|
57 | - | return false; |
|
58 | - | } |
|
56 | + | Checks.checkNotNull(filePath); |
|
59 | 57 | FileSystemView fs = getFileSystem(); |
|
60 | 58 | return fs.getFileExists(filePath) && !fs.isFolder(filePath); |
|
61 | 59 | } |
@@ -1,5 +1,7 @@
Loading
1 | 1 | package nl.weeaboo.vn.impl.core; |
|
2 | 2 | ||
3 | + | import javax.annotation.Nullable; |
|
4 | + | ||
3 | 5 | import nl.weeaboo.common.Checks; |
|
4 | 6 | import nl.weeaboo.common.Rect2D; |
|
5 | 7 | import nl.weeaboo.vn.core.Direction; |
@@ -24,7 +26,7 @@
Loading
24 | 26 | /** |
|
25 | 27 | * Returns the relative bounds for the given texture, if aligned using the given fractional alignment. |
|
26 | 28 | */ |
|
27 | - | public static Rect2D getAlignedBounds(ITexture tex, double alignX, double alignY) { |
|
29 | + | public static Rect2D getAlignedBounds(@Nullable ITexture tex, double alignX, double alignY) { |
|
28 | 30 | if (tex == null) { |
|
29 | 31 | return getAlignedBounds(0, 0, alignX, alignY); |
|
30 | 32 | } |
@@ -1,5 +1,7 @@
Loading
1 | 1 | package nl.weeaboo.vn.math; |
|
2 | 2 | ||
3 | + | import javax.annotation.Nullable; |
|
4 | + | ||
3 | 5 | import nl.weeaboo.common.FastMath; |
|
4 | 6 | ||
5 | 7 | /** |
@@ -13,7 +15,7 @@
Loading
13 | 15 | ||
14 | 16 | private static final Matrix IDENTITY_MATRIX = new Matrix(1, 0, 0, 0, 1, 0); |
|
15 | 17 | ||
16 | - | private transient float[] glMatrix; |
|
18 | + | private transient @Nullable float[] glMatrix; |
|
17 | 19 | ||
18 | 20 | public Matrix(double m00, double m01, double m02, double m10, double m11, double m12) { |
|
19 | 21 | super(m00, m01, m02, m10, m11, m12); |
@@ -6,6 +6,8 @@
Loading
6 | 6 | import java.text.StringCharacterIterator; |
|
7 | 7 | import java.util.List; |
|
8 | 8 | ||
9 | + | import javax.annotation.Nullable; |
|
10 | + | ||
9 | 11 | import com.google.common.collect.ImmutableList; |
|
10 | 12 | import com.google.common.io.ByteStreams; |
|
11 | 13 |
@@ -122,7 +124,7 @@
Loading
122 | 124 | return findBlockEnd(itr, endChar, null); |
|
123 | 125 | } |
|
124 | 126 | ||
125 | - | static int findBlockEnd(CharacterIterator itr, char endChar, StringBuilder out) { |
|
127 | + | static int findBlockEnd(CharacterIterator itr, char endChar, @Nullable StringBuilder out) { |
|
126 | 128 | boolean inQuotes = false; |
|
127 | 129 | int brackets = 0; |
|
128 | 130 |
@@ -7,6 +7,8 @@
Loading
7 | 7 | import java.util.Comparator; |
|
8 | 8 | import java.util.Set; |
|
9 | 9 | ||
10 | + | import javax.annotation.Nullable; |
|
11 | + | ||
10 | 12 | import org.slf4j.Logger; |
|
11 | 13 | import org.slf4j.LoggerFactory; |
|
12 | 14 |
@@ -35,7 +37,7 @@
Loading
35 | 37 | private final InternalGdxFileSystem internalFileSystem; |
|
36 | 38 | ||
37 | 39 | // Cached file archives. Archives are searched in order. |
|
38 | - | private transient ImmutableList<ZipFileArchive> cachedFileArchives; |
|
40 | + | private transient @Nullable ImmutableList<ZipFileArchive> cachedFileArchives; |
|
39 | 41 | ||
40 | 42 | public DesktopGdxFileSystem(File baseFolder) { |
|
41 | 43 | this(baseFolder.toString().replace('\\', '/') + "/"); |
@@ -2,6 +2,8 @@
Loading
2 | 2 | ||
3 | 3 | import java.io.IOException; |
|
4 | 4 | ||
5 | + | import javax.annotation.Nullable; |
|
6 | + | ||
5 | 7 | import nl.weeaboo.vn.save.SaveFormatException; |
|
6 | 8 | import nl.weeaboo.vn.save.ThumbnailInfo; |
|
7 | 9 |
@@ -9,8 +11,8 @@
Loading
9 | 11 | ||
10 | 12 | public int format = 1; |
|
11 | 13 | public long creationTime; |
|
12 | - | public Storage userData; |
|
13 | - | public ThumbnailInfoJson thumbnail; |
|
14 | + | public @Nullable Storage userData; |
|
15 | + | public @Nullable ThumbnailInfoJson thumbnail; |
|
14 | 16 | ||
15 | 17 | public static SaveFileHeader decode(SaveFileHeaderJson headerJson) throws SaveFormatException, IOException { |
|
16 | 18 | if (headerJson.format != SaveFileConstants.FORMAT_VERSION) { |
@@ -28,7 +28,7 @@
Loading
28 | 28 | private static final long serialVersionUID = SceneImpl.serialVersionUID; |
|
29 | 29 | ||
30 | 30 | /** May be null */ |
|
31 | - | IVisualGroup parent; |
|
31 | + | @Nullable IVisualGroup parent; |
|
32 | 32 | ||
33 | 33 | private final SignalSupport signalSupport = new SignalSupport(); |
|
34 | 34 |
@@ -36,7 +36,7 @@
Loading
36 | 36 | private boolean visible = true; |
|
37 | 37 | private boolean destroyed; |
|
38 | 38 | ||
39 | - | private ILayoutElem layoutAdapter; |
|
39 | + | private @Nullable ILayoutElem layoutAdapter; |
|
40 | 40 | ||
41 | 41 | protected VisualElement() { |
|
42 | 42 | // Add self at index 0 |
@@ -6,6 +6,8 @@
Loading
6 | 6 | ||
7 | 7 | import javax.annotation.Nullable; |
|
8 | 8 | ||
9 | + | import com.google.errorprone.annotations.InlineMe; |
|
10 | + | ||
9 | 11 | import nl.weeaboo.common.Checks; |
|
10 | 12 | import nl.weeaboo.common.Dim; |
|
11 | 13 | import nl.weeaboo.io.CustomSerializable; |
@@ -24,7 +26,7 @@
Loading
24 | 26 | private final short z; |
|
25 | 27 | private final boolean isVolatile; |
|
26 | 28 | ||
27 | - | private transient ITextureData pixels; |
|
29 | + | private transient @Nullable ITextureData pixels; |
|
28 | 30 | private Dim screenSize = Dim.EMPTY; |
|
29 | 31 | ||
30 | 32 | protected AbstractScreenshot(short z, boolean isVolatile) { |
@@ -72,8 +74,9 @@
Loading
72 | 74 | } |
|
73 | 75 | ||
74 | 76 | @Deprecated |
|
77 | + | @InlineMe(replacement = "this.markTransient()") |
|
75 | 78 | @Override |
|
76 | - | public void makeTransient() { |
|
79 | + | public final void makeTransient() { |
|
77 | 80 | markTransient(); |
|
78 | 81 | } |
|
79 | 82 |
@@ -1,7 +1,5 @@
Loading
1 | 1 | package nl.weeaboo.vn.impl.core; |
|
2 | 2 | ||
3 | - | import javax.annotation.Nullable; |
|
4 | - | ||
5 | 3 | import nl.weeaboo.common.Checks; |
|
6 | 4 | import nl.weeaboo.common.Rect2D; |
|
7 | 5 | import nl.weeaboo.vn.core.IContextFactory; |
@@ -46,10 +44,7 @@
Loading
46 | 44 | return new Screen(rect, renderEnv, textBoxState, skipState); |
|
47 | 45 | } |
|
48 | 46 | ||
49 | - | protected @Nullable LuaScriptContext newScriptContext() { |
|
50 | - | if (scriptEnv == null) { |
|
51 | - | return null; |
|
52 | - | } |
|
47 | + | protected LuaScriptContext newScriptContext() { |
|
53 | 48 | return new LuaScriptContext(scriptEnv); |
|
54 | 49 | } |
|
55 | 50 |
@@ -39,9 +39,9 @@
Loading
39 | 39 | ||
40 | 40 | private double touchMargin; |
|
41 | 41 | private double alphaEnableThreshold = 0.9; |
|
42 | - | private IScriptFunction clickHandler; |
|
42 | + | private @Nullable IScriptFunction clickHandler; |
|
43 | 43 | ||
44 | - | private transient IEventListener rendererListener; |
|
44 | + | private transient @Nullable IEventListener rendererListener; |
|
45 | 45 | ||
46 | 46 | public Button(IScriptEventDispatcher eventDispatcher, ILoadingFontStore fontStore) { |
|
47 | 47 | this(eventDispatcher, new ButtonModel(), new ButtonRenderer(fontStore)); |
@@ -4,6 +4,8 @@
Loading
4 | 4 | import java.util.Map; |
|
5 | 5 | import java.util.Set; |
|
6 | 6 | ||
7 | + | import javax.annotation.Nullable; |
|
8 | + | ||
7 | 9 | import org.slf4j.Logger; |
|
8 | 10 | import org.slf4j.LoggerFactory; |
|
9 | 11 |
@@ -60,7 +62,7 @@
Loading
60 | 62 | private final Set<String> prefHolderClasses = Sets.newLinkedHashSet(); |
|
61 | 63 | private final boolean isSetter; |
|
62 | 64 | ||
63 | - | private transient Map<String, Preference<?>> cachedPrefs; |
|
65 | + | private transient @Nullable Map<String, Preference<?>> cachedPrefs; |
|
64 | 66 | ||
65 | 67 | public PrefsMetaFunction(boolean isSetter, StaticRef<? extends IPreferenceStore> prefStoreRef) { |
|
66 | 68 | this.isSetter = isSetter; |
@@ -28,7 +28,7 @@
Loading
28 | 28 | * @see IContext#onCurrent() |
|
29 | 29 | * @see #getCurrentContext() |
|
30 | 30 | */ |
|
31 | - | public static IContext setCurrentContext(IContext context) { |
|
31 | + | public static IContext setCurrentContext(@Nullable IContext context) { |
|
32 | 32 | IContext oldContext = getCurrentContext(); |
|
33 | 33 | currentContext.set(context); |
|
34 | 34 | if (context != null) { |
@@ -20,7 +20,7 @@
Loading
20 | 20 | */ |
|
21 | 21 | public class PremultTextureLoader extends AsynchronousAssetLoader<Texture, TextureParameter> { |
|
22 | 22 | ||
23 | - | private TextureLoaderInfo info = new TextureLoaderInfo(); |
|
23 | + | private final TextureLoaderInfo info = new TextureLoaderInfo(); |
|
24 | 24 | ||
25 | 25 | public PremultTextureLoader(FileHandleResolver resolver) { |
|
26 | 26 | super(resolver); |
@@ -34,7 +34,7 @@
Loading
34 | 34 | ||
35 | 35 | @Override |
|
36 | 36 | public void loadAsync(AssetManager manager, String fileName, FileHandle file, |
|
37 | - | TextureParameter parameter) { |
|
37 | + | @Nullable TextureParameter parameter) { |
|
38 | 38 | ||
39 | 39 | if (parameter == null || parameter.textureData == null) { |
|
40 | 40 | Format format = null; |
@@ -75,10 +75,7 @@
Loading
75 | 75 | @Nullable |
|
76 | 76 | @Override |
|
77 | 77 | public Texture loadSync(AssetManager manager, String fileName, FileHandle file, |
|
78 | - | TextureParameter parameter) { |
|
79 | - | if (info == null) { |
|
80 | - | return null; |
|
81 | - | } |
|
78 | + | @Nullable TextureParameter parameter) { |
|
82 | 79 | ||
83 | 80 | Texture texture = info.texture; |
|
84 | 81 | if (texture != null) { |
@@ -22,16 +22,12 @@
Loading
22 | 22 | ||
23 | 23 | @Override |
|
24 | 24 | public void onAttached(IEventListener cl) { |
|
25 | - | if (cl != null) { |
|
26 | - | changeHelper.addTransientListener(cl); |
|
27 | - | } |
|
25 | + | changeHelper.addTransientListener(cl); |
|
28 | 26 | } |
|
29 | 27 | ||
30 | 28 | @Override |
|
31 | 29 | public void onDetached(IEventListener cl) { |
|
32 | - | if (cl != null) { |
|
33 | - | changeHelper.removeTransientListener(cl); |
|
34 | - | } |
|
30 | + | changeHelper.removeTransientListener(cl); |
|
35 | 31 | } |
|
36 | 32 | ||
37 | 33 | @Override |
@@ -3,6 +3,8 @@
Loading
3 | 3 | import java.io.Serializable; |
|
4 | 4 | import java.util.List; |
|
5 | 5 | ||
6 | + | import javax.annotation.Nullable; |
|
7 | + | ||
6 | 8 | import com.google.common.collect.ImmutableList; |
|
7 | 9 | import com.google.common.collect.Lists; |
|
8 | 10 |
@@ -20,7 +22,7 @@
Loading
20 | 22 | private static final long serialVersionUID = 1L; |
|
21 | 23 | ||
22 | 24 | private final List<TextureEntry> entries = Lists.newArrayList(); |
|
23 | - | private Dim explicitSize; // Null if no explicit size is set |
|
25 | + | private @Nullable Dim explicitSize; // Null if no explicit size is set |
|
24 | 26 | ||
25 | 27 | public ImageCompositeConfig() { |
|
26 | 28 | } |
@@ -5,6 +5,7 @@
Loading
5 | 5 | ||
6 | 6 | import com.badlogic.gdx.utils.Array; |
|
7 | 7 | import com.badlogic.gdx.utils.Sort; |
|
8 | + | import com.google.errorprone.annotations.InlineMe; |
|
8 | 9 | ||
9 | 10 | import nl.weeaboo.common.Area2D; |
|
10 | 11 | import nl.weeaboo.common.Rect2D; |
@@ -52,6 +53,7 @@
Loading
52 | 53 | } |
|
53 | 54 | ||
54 | 55 | @Deprecated |
|
56 | + | @InlineMe(replacement = "this.drawText(dt, dx, dy, -1, textLayout, visibleGlyphs)") |
|
55 | 57 | @Override |
|
56 | 58 | public void drawText(IDrawTransform dt, double dx, double dy, ITextLayout textLayout, double visibleGlyphs) { |
|
57 | 59 | drawText(dt, dx, dy, 0xFFFFFFFF, textLayout, visibleGlyphs); |
@@ -3,6 +3,8 @@
Loading
3 | 3 | import java.util.HashMap; |
|
4 | 4 | import java.util.Map; |
|
5 | 5 | ||
6 | + | import javax.annotation.Nullable; |
|
7 | + | ||
6 | 8 | import com.badlogic.gdx.assets.AssetManager; |
|
7 | 9 | ||
8 | 10 | import nl.weeaboo.filesystem.IFileSystem; |
@@ -86,7 +88,7 @@
Loading
86 | 88 | } |
|
87 | 89 | ||
88 | 90 | /** Sets the value of a static reference. */ |
|
89 | - | public <T> void set(StaticRef<T> ref, T value) { |
|
91 | + | public <T> void set(StaticRef<T> ref, @Nullable T value) { |
|
90 | 92 | synchronized (objects) { |
|
91 | 93 | if (value == null) { |
|
92 | 94 | objects.remove(ref.getId()); |
Files | Complexity | Coverage |
---|---|---|
api/src/main/java/nl/weeaboo/vn | 91.53% | 96.76% |
buildtools/src/main/java/nl/weeaboo/vn/buildtools | 81.13% | 87.46% |
core/src/main/java/nl/weeaboo/vn | 83.34% | 87.68% |
desktop/src/main/java/nl/weeaboo/vn/desktop | 75.71% | 82.17% |
Project Totals (384 files) | 83.67% | 88.16% |
1780450064
1 |
github_checks: false |
Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file.
The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files.
The size and color of each slice is representing the number of statements and the coverage, respectively.