Skip to content

Commit

Permalink
making all classes in util nullness aware
Browse files Browse the repository at this point in the history
  • Loading branch information
mattulbrich committed Jun 26, 2023
1 parent 2cf9325 commit 763b442
Show file tree
Hide file tree
Showing 39 changed files with 40 additions and 2 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ subprojects {
"org.checkerframework.checker.nullness.NullnessChecker",
]
extraJavacArgs = [
"-AonlyDefs=^org\\.key_project\\.util\\.lookup",
"-AonlyDefs=^org\\.key_project\\.util",
"-Xmaxerrs", "10000",
"-Werror",
"-Aversion",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
*
* @author Arne Keller
*/
@SuppressWarnings("nullness")
public final class EqualsModProofIrrelevancyUtil {
private EqualsModProofIrrelevancyUtil() {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
* @param <T> type to wrap
* @author Arne Keller
*/
@SuppressWarnings("nullness")
public class EqualsModProofIrrelevancyWrapper<T extends EqualsModProofIrrelevancy> {
/**
* The wrapped object.
Expand Down
1 change: 1 addition & 0 deletions key.util/src/main/java/org/key_project/util/ExtList.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
* Extends java.util.LinkedList in order to collect elements according to their type.
* Has facilities to get elements of a certain type ({@link #get(Class)}, {@link #collect(Class)}).
*/
@SuppressWarnings("nullness")
public class ExtList extends LinkedList<Object> {

private static final long serialVersionUID = 9182017368310263908L;
Expand Down
1 change: 1 addition & 0 deletions key.util/src/main/java/org/key_project/util/Filenames.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
* @author Alexander Weigl
* @version 1 (29.03.19)
*/
@SuppressWarnings("nullness")
public class Filenames {
// =======================================================
// Methods operating on Strings
Expand Down
1 change: 1 addition & 0 deletions key.util/src/main/java/org/key_project/util/LRUCache.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
/**
* Simple realisation of an LRU cache.
*/
@SuppressWarnings("nullness")
public class LRUCache<K, V> extends LinkedHashMap<K, V> {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
* @author Alexander Weigl
* @version 1 (06.12.18)
*/
@SuppressWarnings("nullness")
public class RandomName {
private static final Random random = new Random();

Expand Down
1 change: 1 addition & 0 deletions key.util/src/main/java/org/key_project/util/Streams.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import java.io.IOException;
import java.io.InputStream;

@SuppressWarnings("nullness")
public class Streams {

private Streams() {
Expand Down
2 changes: 2 additions & 0 deletions key.util/src/main/java/org/key_project/util/Strings.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.key_project.util;

import org.jspecify.annotations.NullMarked;
import org.key_project.util.java.StringUtil;

/**
Expand All @@ -8,6 +9,7 @@
* @author Alexander Weigl
* @version 1 (29.03.19)
*/
@NullMarked
public class Strings {
/**
* @deprecated This class has been merged with {@link org.key_project.util.java.StringUtil}.
Expand Down
1 change: 1 addition & 0 deletions key.util/src/main/java/org/key_project/util/bean/Bean.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
* @author Martin Hentschel
* @see IBean
*/
@SuppressWarnings("nullness")
public class Bean implements IBean {
/**
* The used {@link PropertyChangeSupport}.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
*
* @author Dominic Scheurer
*/
@SuppressWarnings("nullness")
public class ImmutableFixedLengthBitSet {

private boolean[] bitSet = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
*
* @author Arne Keller
*/
@SuppressWarnings("nullness")
public class DefaultEdge implements GraphEdge {
/**
* Source node of this edge.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
* This class implements ImmMap<S,T> and provides a persistent Map. It is a simple implementation
* like lists
*/
@SuppressWarnings("nullness")
public class DefaultImmutableMap<S, T> implements ImmutableMap<S, T> {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*
* @param <T> type of object to store
*/
@SuppressWarnings("nullness")
public class DefaultImmutableSet<T> implements ImmutableSet<T> {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
* @param <E> edge type
* @author Arne Keller
*/
@SuppressWarnings("nullness")
public class DirectedGraph<V, E extends GraphEdge> implements Graph<V, E> {
/**
* Set of vertices in this graph.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import java.util.stream.StreamSupport;
import javax.annotation.Nonnull;

@SuppressWarnings("nullness")
public class ImmutableArray<S> implements java.lang.Iterable<S>, java.io.Serializable {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
* This class implements the leftist heap, see &quot;Functional Data Structures&quot; by Chris
* Okasaki
*/
@SuppressWarnings("nullness")
public abstract class ImmutableLeftistHeap<T extends Comparable<T>> implements ImmutableHeap<T> {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
* and head with amortized O(1). This will be done later (if necessary).
*/

@SuppressWarnings("unchecked")
@SuppressWarnings({"unchecked", "nullness"})
public abstract class ImmutableSLList<T> implements ImmutableList<T> {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
* offer a public static final variable .<called>nil()
*/

@SuppressWarnings("nullness")
public interface ImmutableSet<T> extends Iterable<T>, java.io.Serializable {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
*
* @author Mattias Ulbrich
*/
@SuppressWarnings("nullness")
public final class Immutables {

private Immutables() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
* @author Alexander Weigl
* @version 1 (29.03.19)
*/
@SuppressWarnings("nullness")
public class KeYCollections {
// =======================================================
// Methods operating on Arrays
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@


/** thrown if a duplicate is being added via addUnique() */
@SuppressWarnings("nullness")
public class NotUniqueException extends Exception {

private static final long serialVersionUID = 6565515240836947955L;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import java.nio.charset.StandardCharsets;
import java.util.Properties;

@SuppressWarnings("nullness")
public class PropertiesUtil {

private PropertiesUtil() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
* @author Alexander Weigl
* @version 1 (13.02.19)
*/
@SuppressWarnings("nullness")
public final class FindResources {
/**
* List directory contents for a resource folder. Not recursive. This is basically a brute-force
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import java.io.IOException;
import java.nio.charset.StandardCharsets;

@SuppressWarnings("nullness")
public class HelperClassForUtilityTests {
public static final File RESOURCE_DIRECTORY = FindResources.getTestResourcesDirectory();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
*
* @author Martin Hentschel
*/
@SuppressWarnings("nullness")
public final class ArrayUtil {
/**
* Forbid instances by this private constructor.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
*
* @author Martin Hentschel
*/
@SuppressWarnings("nullness")
public class CollectionUtil {
/**
* The default separator.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
*
* @author Martin Hentschel
*/
@SuppressWarnings("nullness")
public final class IOUtil {
/**
* The size of used buffers.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.key_project.util.java;

@SuppressWarnings("nullness")
public final class IntegerUtil {
/**
* Forbid instances.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
*
* @author lanzinger
*/
@SuppressWarnings("nullness")
public final class MapUtil {

private MapUtil() {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
*
* @author Martin Hentschel
*/
@SuppressWarnings("nullness")
public class NumberUtil {
/**
* The maximal number of digits of an integer value.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
*
* @author Mattias Ulbrich, Mar 2021
*/
@SuppressWarnings("nullness")
public class WrapUtils {

/*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
*
* @author Martin Hentschel
*/
@SuppressWarnings("nullness")
public final class XMLUtil {
/**
* Attribute name to store encodings.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
* @author Martin Hentschel
* @see IRunnableWithResult
*/
@SuppressWarnings("nullness")
public abstract class AbstractRunnableWithException implements IRunnableWithException {
/**
* An occurred exception.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
* @author Martin Hentschel
* @see IRunnableWithResult
*/
@SuppressWarnings("nullness")
public abstract class AbstractRunnableWithResult<T> extends AbstractRunnableWithException
implements IRunnableWithResult<T> {
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* @author Alexander Weigl
* @version 1 (13.01.19)
*/
@SuppressWarnings("nullness")
public class InjectionException extends RuntimeException {
private static final long serialVersionUID = 119998955722036861L;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
* @version 1 (15.03.19)
*/
@NullMarked
@SuppressWarnings("nullness")
public class Lookup {
public static final Lookup DEFAULT = new Lookup();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
* @see IClassLoader
* @see JavaApplicationClassLoader
*/
@SuppressWarnings("nullness")
public class ClassLoaderUtil {
/**
* The {@link IClassLoader} instance to use.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
*
* @author Martin Hentschel
*/
@SuppressWarnings("nullness")
public class JavaApplicationClassLoader implements IClassLoader {
/**
* {@inheritDoc}
Expand Down

0 comments on commit 763b442

Please sign in to comment.