Skip to content

Commit

Permalink
Merge pull request #740 from theigl/standard-modifier-order
Browse files Browse the repository at this point in the history
Use recommended sort order for modifiers
  • Loading branch information
magro authored Jul 10, 2020
2 parents fd8bf00 + b5439e9 commit 5723ffe
Show file tree
Hide file tree
Showing 55 changed files with 316 additions and 316 deletions.
8 changes: 4 additions & 4 deletions src/com/esotericsoftware/kryo/Kryo.java
Original file line number Diff line number Diff line change
Expand Up @@ -127,11 +127,11 @@
/** Maps classes to serializers so object graphs can be serialized automatically.
* @author Nathan Sweet */
public class Kryo implements Poolable {
static public final byte NULL = 0;
static public final byte NOT_NULL = 1;
public static final byte NULL = 0;
public static final byte NOT_NULL = 1;

static private final int REF = -1;
static private final int NO_REF = -2;
private static final int REF = -1;
private static final int NO_REF = -2;

private SerializerFactory defaultSerializer = new FieldSerializerFactory();
private final ArrayList<DefaultSerializerEntry> defaultSerializers = new ArrayList(67);
Expand Down
4 changes: 2 additions & 2 deletions src/com/esotericsoftware/kryo/Serializer.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public Serializer (boolean acceptsNull, boolean immutable) {
* This method should not be called directly, instead this serializer can be passed to {@link Kryo} write methods that accept a
* serialier.
* @param object May be null if {@link #getAcceptsNull()} is true. */
abstract public void write (Kryo kryo, Output output, T object);
public abstract void write (Kryo kryo, Output output, T object);

/** Reads bytes and returns a new object of the specified concrete type.
* <p>
Expand All @@ -58,7 +58,7 @@ public Serializer (boolean acceptsNull, boolean immutable) {
* This method should not be called directly, instead this serializer can be passed to {@link Kryo} read methods that accept a
* serialier.
* @return May be null if {@link #getAcceptsNull()} is true. */
abstract public T read (Kryo kryo, Input input, Class<? extends T> type);
public abstract T read (Kryo kryo, Input input, Class<? extends T> type);

public boolean getAcceptsNull () {
return acceptsNull;
Expand Down
16 changes: 8 additions & 8 deletions src/com/esotericsoftware/kryo/SerializerFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public interface SerializerFactory<T extends Serializer> {
public boolean isSupported (Class type);

/** A serializer factory which always returns true for {@link #isSupported(Class)}. */
static public abstract class BaseSerializerFactory<T extends Serializer> implements SerializerFactory<T> {
public abstract static class BaseSerializerFactory<T extends Serializer> implements SerializerFactory<T> {
@Override
public boolean isSupported (Class type) {
return true;
Expand All @@ -54,7 +54,7 @@ public boolean isSupported (Class type) {
* {@link Class} as its only argument, or take no arguments. If several of the described constructors are found, the first
* found constructor is used, in the order they were just described.
* @author Rafael Winterhalter <rafael.wth@web.de> */
static public class ReflectionSerializerFactory<T extends Serializer> extends BaseSerializerFactory<T> {
public static class ReflectionSerializerFactory<T extends Serializer> extends BaseSerializerFactory<T> {
private final Class<T> serializerClass;

public ReflectionSerializerFactory (Class<T> serializerClass) {
Expand All @@ -68,7 +68,7 @@ public T newSerializer (Kryo kryo, Class type) {

/** Creates a new instance of the specified serializer for serializing the specified class. Serializers must have a zero
* argument constructor or one that takes (Kryo), (Class), or (Kryo, Class). */
static public <T extends Serializer> T newSerializer (Kryo kryo, Class<T> serializerClass, Class type) {
public static <T extends Serializer> T newSerializer (Kryo kryo, Class<T> serializerClass, Class type) {
try {
try {
return serializerClass.getConstructor(Kryo.class, Class.class).newInstance(kryo, type);
Expand All @@ -93,7 +93,7 @@ static public <T extends Serializer> T newSerializer (Kryo kryo, Class<T> serial
/** A serializer factory that always returns a given serializer instance rather than creating new serializer instances. It can
* be used when multiple types should be serialized by the same serializer.
* @author Rafael Winterhalter <rafael.wth@web.de> */
static public class SingletonSerializerFactory<T extends Serializer> extends BaseSerializerFactory<T> {
public static class SingletonSerializerFactory<T extends Serializer> extends BaseSerializerFactory<T> {
private final T serializer;

public SingletonSerializerFactory (T serializer) {
Expand All @@ -108,7 +108,7 @@ public T newSerializer (Kryo kryo, Class type) {

/** A serializer factory that returns new, configured {@link FieldSerializer} instances.
* @author Nathan Sweet */
static public class FieldSerializerFactory extends BaseSerializerFactory<FieldSerializer> {
public static class FieldSerializerFactory extends BaseSerializerFactory<FieldSerializer> {
private final FieldSerializerConfig config;

public FieldSerializerFactory () {
Expand All @@ -131,7 +131,7 @@ public FieldSerializer newSerializer (Kryo kryo, Class type) {

/** A serializer factory that returns new, configured {@link TaggedFieldSerializer} instances.
* @author Nathan Sweet */
static public class TaggedFieldSerializerFactory extends BaseSerializerFactory<TaggedFieldSerializer> {
public static class TaggedFieldSerializerFactory extends BaseSerializerFactory<TaggedFieldSerializer> {
private final TaggedFieldSerializerConfig config;

public TaggedFieldSerializerFactory () {
Expand All @@ -154,7 +154,7 @@ public TaggedFieldSerializer newSerializer (Kryo kryo, Class type) {

/** A serializer factory that returns new, configured {@link VersionFieldSerializer} instances.
* @author Nathan Sweet */
static public class VersionFieldSerializerFactory extends BaseSerializerFactory<VersionFieldSerializer> {
public static class VersionFieldSerializerFactory extends BaseSerializerFactory<VersionFieldSerializer> {
private final VersionFieldSerializerConfig config;

public VersionFieldSerializerFactory () {
Expand All @@ -177,7 +177,7 @@ public VersionFieldSerializer newSerializer (Kryo kryo, Class type) {

/** A serializer factory that returns new, configured {@link CompatibleFieldSerializer} instances.
* @author Nathan Sweet */
static public class CompatibleFieldSerializerFactory extends BaseSerializerFactory<CompatibleFieldSerializer> {
public static class CompatibleFieldSerializerFactory extends BaseSerializerFactory<CompatibleFieldSerializer> {
private final CompatibleFieldSerializerConfig config;

public CompatibleFieldSerializerFactory () {
Expand Down
2 changes: 1 addition & 1 deletion src/com/esotericsoftware/kryo/io/ByteBufferInput.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
* @author Roman Levenstein <romixlev@gmail.com>
* @author Nathan Sweet */
public class ByteBufferInput extends Input {
static private final ByteOrder nativeOrder = ByteOrder.nativeOrder();
private static final ByteOrder nativeOrder = ByteOrder.nativeOrder();

protected ByteBuffer byteBuffer;
private byte[] tempBuffer;
Expand Down
2 changes: 1 addition & 1 deletion src/com/esotericsoftware/kryo/io/ByteBufferOutput.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
* @author Roman Levenstein <romixlev@gmail.com>
* @author Nathan Sweet */
public class ByteBufferOutput extends Output {
static private final ByteOrder nativeOrder = ByteOrder.nativeOrder();
private static final ByteOrder nativeOrder = ByteOrder.nativeOrder();

protected ByteBuffer byteBuffer;

Expand Down
4 changes: 2 additions & 2 deletions src/com/esotericsoftware/kryo/io/Output.java
Original file line number Diff line number Diff line change
Expand Up @@ -921,7 +921,7 @@ public void writeBooleans (boolean[] array, int offset, int count) throws KryoEx
//

/** Returns the number of bytes that would be written with {@link #writeVarInt(int, boolean)}. */
static public int varIntLength (int value, boolean optimizePositive) {
public static int varIntLength (int value, boolean optimizePositive) {
if (!optimizePositive) value = (value << 1) ^ (value >> 31);
if (value >>> 7 == 0) return 1;
if (value >>> 14 == 0) return 2;
Expand All @@ -931,7 +931,7 @@ static public int varIntLength (int value, boolean optimizePositive) {
}

/** Returns the number of bytes that would be written with {@link #writeVarLong(long, boolean)}. */
static public int varLongLength (long value, boolean optimizePositive) {
public static int varLongLength (long value, boolean optimizePositive) {
if (!optimizePositive) value = (value << 1) ^ (value >> 63);
if (value >>> 7 == 0) return 1;
if (value >>> 14 == 0) return 2;
Expand Down
18 changes: 9 additions & 9 deletions src/com/esotericsoftware/kryo/serializers/AsmField.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public void copy (Object original, Object copy) {
}
}

final static class IntAsmField extends CachedField {
static final class IntAsmField extends CachedField {
public IntAsmField (Field field) {
super(field);
}
Expand All @@ -86,7 +86,7 @@ public void copy (Object original, Object copy) {
}
}

final static class FloatAsmField extends CachedField {
static final class FloatAsmField extends CachedField {
public FloatAsmField (Field field) {
super(field);
}
Expand All @@ -107,7 +107,7 @@ public void copy (Object original, Object copy) {
}
}

final static class ShortAsmField extends CachedField {
static final class ShortAsmField extends CachedField {
public ShortAsmField (Field field) {
super(field);
}
Expand All @@ -128,7 +128,7 @@ public void copy (Object original, Object copy) {
}
}

final static class ByteAsmField extends CachedField {
static final class ByteAsmField extends CachedField {
public ByteAsmField (Field field) {
super(field);
}
Expand All @@ -149,7 +149,7 @@ public void copy (Object original, Object copy) {
}
}

final static class BooleanAsmField extends CachedField {
static final class BooleanAsmField extends CachedField {
public BooleanAsmField (Field field) {
super(field);
}
Expand All @@ -170,7 +170,7 @@ public void copy (Object original, Object copy) {
}
}

final static class CharAsmField extends CachedField {
static final class CharAsmField extends CachedField {
public CharAsmField (Field field) {
super(field);
}
Expand All @@ -191,7 +191,7 @@ public void copy (Object original, Object copy) {
}
}

final static class LongAsmField extends CachedField {
static final class LongAsmField extends CachedField {
public LongAsmField (Field field) {
super(field);
}
Expand All @@ -218,7 +218,7 @@ public void copy (Object original, Object copy) {
}
}

final static class DoubleAsmField extends CachedField {
static final class DoubleAsmField extends CachedField {
public DoubleAsmField (Field field) {
super(field);
}
Expand All @@ -239,7 +239,7 @@ public void copy (Object original, Object copy) {
}
}

final static class StringAsmField extends CachedField {
static final class StringAsmField extends CachedField {
public StringAsmField (Field field) {
super(field);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
* @author Nathan Sweet */
public class BlowfishSerializer extends Serializer {
private final Serializer serializer;
static private SecretKeySpec keySpec;
private static SecretKeySpec keySpec;

public BlowfishSerializer (Serializer serializer, byte[] key) {
this.serializer = serializer;
Expand Down Expand Up @@ -74,7 +74,7 @@ public Object copy (Kryo kryo, Object original) {
return serializer.copy(kryo, original);
}

static private Cipher getCipher (int mode) {
private static Cipher getCipher (int mode) {
try {
Cipher cipher = Cipher.getInstance("Blowfish");
cipher.init(mode, keySpec);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@
public class ClosureSerializer extends Serializer {
/** Marker class used to find the class {@link Registration} for closure instances.
* @see Kryo#isClosure(Class) */
static public class Closure {
public static class Closure {
}

static private Method readResolve;
private static Method readResolve;

public ClosureSerializer () {
if (readResolve == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
* {@link CompatibleFieldSerializerConfig#setExtendedFieldNames(boolean)} must be true.
* @author Nathan Sweet */
public class CompatibleFieldSerializer<T> extends FieldSerializer<T> {
static private final int binarySearchThreshold = 32;
private static final int binarySearchThreshold = 32;

private CompatibleFieldSerializerConfig config;

Expand Down Expand Up @@ -246,7 +246,7 @@ public CompatibleFieldSerializerConfig getCompatibleFieldSerializerConfig () {
}

/** Configuration for CompatibleFieldSerializer instances. */
static public class CompatibleFieldSerializerConfig extends FieldSerializerConfig {
public static class CompatibleFieldSerializerConfig extends FieldSerializerConfig {
boolean readUnknownFieldData = true, chunked;
int chunkSize = 1024;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
* default}.
* @author Nathan Sweet */
public class DefaultArraySerializers {
static public class ByteArraySerializer extends Serializer<byte[]> {
public static class ByteArraySerializer extends Serializer<byte[]> {
{
setAcceptsNull(true);
}
Expand Down Expand Up @@ -63,7 +63,7 @@ public byte[] copy (Kryo kryo, byte[] original) {
}
}

static public class IntArraySerializer extends Serializer<int[]> {
public static class IntArraySerializer extends Serializer<int[]> {
{
setAcceptsNull(true);
}
Expand Down Expand Up @@ -93,7 +93,7 @@ public int[] copy (Kryo kryo, int[] original) {
}
}

static public class FloatArraySerializer extends Serializer<float[]> {
public static class FloatArraySerializer extends Serializer<float[]> {
{
setAcceptsNull(true);
}
Expand Down Expand Up @@ -123,7 +123,7 @@ public float[] copy (Kryo kryo, float[] original) {
}
}

static public class LongArraySerializer extends Serializer<long[]> {
public static class LongArraySerializer extends Serializer<long[]> {
{
setAcceptsNull(true);
}
Expand Down Expand Up @@ -153,7 +153,7 @@ public long[] copy (Kryo kryo, long[] original) {
}
}

static public class ShortArraySerializer extends Serializer<short[]> {
public static class ShortArraySerializer extends Serializer<short[]> {
{
setAcceptsNull(true);
}
Expand Down Expand Up @@ -183,7 +183,7 @@ public short[] copy (Kryo kryo, short[] original) {
}
}

static public class CharArraySerializer extends Serializer<char[]> {
public static class CharArraySerializer extends Serializer<char[]> {
{
setAcceptsNull(true);
}
Expand Down Expand Up @@ -213,7 +213,7 @@ public char[] copy (Kryo kryo, char[] original) {
}
}

static public class DoubleArraySerializer extends Serializer<double[]> {
public static class DoubleArraySerializer extends Serializer<double[]> {
{
setAcceptsNull(true);
}
Expand Down Expand Up @@ -243,7 +243,7 @@ public double[] copy (Kryo kryo, double[] original) {
}
}

static public class BooleanArraySerializer extends Serializer<boolean[]> {
public static class BooleanArraySerializer extends Serializer<boolean[]> {
{
setAcceptsNull(true);
}
Expand Down Expand Up @@ -277,7 +277,7 @@ public boolean[] copy (Kryo kryo, boolean[] original) {
}
}

static public class StringArraySerializer extends Serializer<String[]> {
public static class StringArraySerializer extends Serializer<String[]> {
{
setAcceptsNull(true);
}
Expand Down Expand Up @@ -323,7 +323,7 @@ public String[] copy (Kryo kryo, String[] original) {
}
}

static public class ObjectArraySerializer extends Serializer<Object[]> {
public static class ObjectArraySerializer extends Serializer<Object[]> {
private boolean elementsAreSameType;
private boolean elementsCanBeNull = true;
private final Class type;
Expand Down
Loading

0 comments on commit 5723ffe

Please sign in to comment.