diff --git a/config/checkstyle/checkstyle.xml b/config/checkstyle/checkstyle.xml index f34d3bd2e5..abb1fc1efe 100644 --- a/config/checkstyle/checkstyle.xml +++ b/config/checkstyle/checkstyle.xml @@ -1,11 +1,17 @@ + "https://checkstyle.org/dtds/configuration_1_3.dtd"> + + + + + + @@ -22,8 +28,8 @@ - - + + @@ -33,9 +39,13 @@ + + + + diff --git a/sbe-tool/src/main/java/uk/co/real_logic/sbe/PrimitiveValue.java b/sbe-tool/src/main/java/uk/co/real_logic/sbe/PrimitiveValue.java index 0754d9a485..18b543aef6 100644 --- a/sbe-tool/src/main/java/uk/co/real_logic/sbe/PrimitiveValue.java +++ b/sbe-tool/src/main/java/uk/co/real_logic/sbe/PrimitiveValue.java @@ -308,7 +308,7 @@ public Representation representation() } /** - * Parse constant value string and set representation based on type + * Parse constant value string and set representation based on type. * * @param value expressed as a String. * @param primitiveType that this is supposed to be. @@ -367,7 +367,7 @@ public static PrimitiveValue parse(final String value, final PrimitiveType primi } /** - * Parse constant value string and set representation based on type + * Parse constant value string and set representation based on type. * * @param value expressed as a String. * @param primitiveType that this is supposed to be. @@ -392,7 +392,7 @@ public static PrimitiveValue parse( } /** - * Parse constant value string and set representation based on type, length, and characterEncoding + * Parse constant value string and set representation based on type, length, and characterEncoding. * * @param value expressed as a String. * @param length of the type. @@ -469,7 +469,7 @@ public byte[] byteArrayValue() } /** - * Return byte array value for this PrimitiveValue given a particular type + * Return byte array value for this PrimitiveValue given a particular type. * * @param type of this value. * @return value expressed as a byte array. diff --git a/sbe-tool/src/main/java/uk/co/real_logic/sbe/ValidationUtil.java b/sbe-tool/src/main/java/uk/co/real_logic/sbe/ValidationUtil.java index 74e58e3f5a..a7bb7e0d19 100644 --- a/sbe-tool/src/main/java/uk/co/real_logic/sbe/ValidationUtil.java +++ b/sbe-tool/src/main/java/uk/co/real_logic/sbe/ValidationUtil.java @@ -19,7 +19,7 @@ import java.util.regex.Pattern; /** - * Various validation utilities used across parser, IR, and generator + * Various validation utilities used across parser, IR, and generator. */ public class ValidationUtil { @@ -228,7 +228,7 @@ private static boolean isSbeCppIdentifierPart(final char c) *

* Java JLS * - * @param value to check + * @param value to check. * @return true for validity as a Java name. false if not. */ public static boolean isSbeJavaName(final String value) @@ -391,6 +391,7 @@ private static boolean isSbeGolangIdentifierPart(final char c) } /** + * C# keywords. * * C# keywords * Note this does not include the contextual keywords diff --git a/sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/c/CUtil.java b/sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/c/CUtil.java index fa0cbe1f10..518abd80b2 100644 --- a/sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/c/CUtil.java +++ b/sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/c/CUtil.java @@ -108,11 +108,11 @@ public static String formatScopedName(final CharSequence[] scope, final String v } /** - * Return the C99 formatted byte order encoding string to use for a given byte order and primitiveType + * Return the C99 formatted byte order encoding string to use for a given byte order and primitiveType. * - * @param byteOrder of the {@link uk.co.real_logic.sbe.ir.Token} - * @param primitiveType of the {@link uk.co.real_logic.sbe.ir.Token} - * @return the string formatted as the byte ordering encoding + * @param byteOrder of the {@link uk.co.real_logic.sbe.ir.Token}. + * @param primitiveType of the {@link uk.co.real_logic.sbe.ir.Token}. + * @return the string formatted as the byte ordering encoding. */ public static String formatByteOrderEncoding(final ByteOrder byteOrder, final PrimitiveType primitiveType) { diff --git a/sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/cpp/CppUtil.java b/sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/cpp/CppUtil.java index 534547a7fb..469faac27a 100644 --- a/sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/cpp/CppUtil.java +++ b/sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/cpp/CppUtil.java @@ -106,11 +106,11 @@ public static String formatClassName(final String value) } /** - * Return the Cpp98 formatted byte order encoding string to use for a given byte order and primitiveType + * Return the Cpp98 formatted byte order encoding string to use for a given byte order and primitiveType. * - * @param byteOrder of the {@link uk.co.real_logic.sbe.ir.Token} - * @param primitiveType of the {@link uk.co.real_logic.sbe.ir.Token} - * @return the string formatted as the byte ordering encoding + * @param byteOrder of the {@link uk.co.real_logic.sbe.ir.Token}. + * @param primitiveType of the {@link uk.co.real_logic.sbe.ir.Token}. + * @return the string formatted as the byte ordering encoding. */ public static String formatByteOrderEncoding(final ByteOrder byteOrder, final PrimitiveType primitiveType) { diff --git a/sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/csharp/CSharpUtil.java b/sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/csharp/CSharpUtil.java index a80ae7a295..b4fee26faf 100644 --- a/sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/csharp/CSharpUtil.java +++ b/sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/csharp/CSharpUtil.java @@ -322,11 +322,11 @@ public static String formatGetterName(final String propertyName) } /** - * Shortcut to append a line of generated code + * Shortcut to append a line of generated code. * - * @param builder string builder to which to append the line - * @param indent current text indentation - * @param line line to be appended + * @param builder string builder to which to append the line. + * @param indent current text indentation. + * @param line line to be appended. */ public static void append(final StringBuilder builder, final String indent, final String line) { diff --git a/sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/golang/flyweight/GolangFlyweightUtil.java b/sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/golang/flyweight/GolangFlyweightUtil.java index 78ac285b6c..ba03adbc3b 100644 --- a/sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/golang/flyweight/GolangFlyweightUtil.java +++ b/sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/golang/flyweight/GolangFlyweightUtil.java @@ -87,7 +87,7 @@ public static String formatClassName(final String value) } /** - * Map the name of a {@link uk.co.real_logic.sbe.PrimitiveType} to a Golang marhsalling function name. + * Map the name of a {@link uk.co.real_logic.sbe.PrimitiveType} to a Golang marshalling function name. * * @param primitiveType to map. * @return the name of the Java primitive that most closely maps. @@ -114,8 +114,8 @@ public static String formatPropertyName(final String value) { throw new IllegalStateException( "Invalid property name='" + formattedValue + - "' please correct the schema or consider setting system property: " + - SbeTool.KEYWORD_APPEND_TOKEN); + "' please correct the schema or consider setting system property: " + + SbeTool.KEYWORD_APPEND_TOKEN); } formattedValue += keywordAppendToken; @@ -142,16 +142,15 @@ public static String closingBraces(final int count) } /** - * Return the Golang formatted byte order encoding string to use to read for a given byte order and primitiveType + * Return the Golang formatted byte order encoding string to use to read for a given byte order and primitiveType. * - * @param byteOrder of the {@link uk.co.real_logic.sbe.ir.Token} - * @param primitiveType of the {@link uk.co.real_logic.sbe.ir.Token} - * @return the string formatted as the byte ordering encoding + * @param byteOrder of the {@link uk.co.real_logic.sbe.ir.Token}. + * @param primitiveType of the {@link uk.co.real_logic.sbe.ir.Token}. + * @return the string formatted as the byte ordering encoding. */ public static String formatReadBytes(final ByteOrder byteOrder, final PrimitiveType primitiveType) { - final String suffix = (byteOrder == ByteOrder.BIG_ENDIAN ? - "BigEndian" : "LittleEndian"); + final String suffix = byteOrder == ByteOrder.BIG_ENDIAN ? "BigEndian" : "LittleEndian"; switch (primitiveType) { @@ -182,16 +181,15 @@ public static String formatReadBytes(final ByteOrder byteOrder, final PrimitiveT } /** - * Return the Golang formatted byte order encoding string to use to write for a given byte order and primitiveType + * Return the Golang formatted byte order encoding string to use to write for a given byte order and primitiveType. * - * @param byteOrder of the {@link uk.co.real_logic.sbe.ir.Token} - * @param primitiveType of the {@link uk.co.real_logic.sbe.ir.Token} - * @return the string formatted as the byte ordering encoding + * @param byteOrder of the {@link uk.co.real_logic.sbe.ir.Token}. + * @param primitiveType of the {@link uk.co.real_logic.sbe.ir.Token}. + * @return the string formatted as the byte ordering encoding. */ public static String formatWriteBytes(final ByteOrder byteOrder, final PrimitiveType primitiveType) { - final String suffix = (byteOrder == ByteOrder.BIG_ENDIAN ? - "BigEndian" : "LittleEndian"); + final String suffix = byteOrder == ByteOrder.BIG_ENDIAN ? "BigEndian" : "LittleEndian"; switch (primitiveType) { @@ -220,5 +218,4 @@ public static String formatWriteBytes(final ByteOrder byteOrder, final Primitive } return ""; } - } diff --git a/sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/java/JavaUtil.java b/sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/java/JavaUtil.java index d5d3ac6693..7f885f673c 100644 --- a/sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/java/JavaUtil.java +++ b/sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/java/JavaUtil.java @@ -208,11 +208,11 @@ public static String formatClassName(final String className) } /** - * Shortcut to append a line of generated code + * Shortcut to append a line of generated code. * - * @param builder string builder to which to append the line - * @param indent current text indentation - * @param line line to be appended + * @param builder string builder to which to append the line. + * @param indent current text indentation. + * @param line line to be appended. */ public static void append(final StringBuilder builder, final String indent, final String line) { @@ -533,5 +533,4 @@ private static void escapeJavadoc(final StringBuilder sb, final String doc) } } } - } diff --git a/sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/rust/LibRsDef.java b/sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/rust/LibRsDef.java index 46897829cd..ae50c9bef7 100644 --- a/sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/rust/LibRsDef.java +++ b/sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/rust/LibRsDef.java @@ -15,6 +15,8 @@ */ package uk.co.real_logic.sbe.generation.rust; +import uk.co.real_logic.sbe.ir.Ir; + import java.io.IOException; import java.io.Writer; import java.nio.ByteOrder; @@ -23,11 +25,15 @@ import java.util.ArrayList; import java.util.LinkedHashSet; import java.util.stream.Stream; -import uk.co.real_logic.sbe.ir.Ir; import static java.nio.ByteOrder.LITTLE_ENDIAN; -import static uk.co.real_logic.sbe.generation.rust.RustGenerator.*; -import static uk.co.real_logic.sbe.generation.rust.RustUtil.*; +import static uk.co.real_logic.sbe.generation.rust.RustGenerator.BUF_LIFETIME; +import static uk.co.real_logic.sbe.generation.rust.RustGenerator.READ_BUF_TYPE; +import static uk.co.real_logic.sbe.generation.rust.RustGenerator.WRITE_BUF_TYPE; +import static uk.co.real_logic.sbe.generation.rust.RustUtil.TYPE_NAME_BY_PRIMITIVE_TYPE_MAP; +import static uk.co.real_logic.sbe.generation.rust.RustUtil.indent; +import static uk.co.real_logic.sbe.generation.rust.RustUtil.rustTypeName; +import static uk.co.real_logic.sbe.generation.rust.RustUtil.toLowerSnakeCase; /** * Generates `lib.rs` specific code. @@ -39,11 +45,11 @@ class LibRsDef private final String schemaVersionType; /** - * Create a new 'lib.rs' for the library being generated + * Create a new 'lib.rs' for the library being generated. * * @param outputManager for generating the codecs to. * @param byteOrder for the Encoding. - * @param schemaVersionType for acting_version type + * @param schemaVersionType for acting_version type. */ LibRsDef( final RustOutputManager outputManager, diff --git a/sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/rust/RustUtil.java b/sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/rust/RustUtil.java index 8f2724759f..43b9c8ba8a 100644 --- a/sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/rust/RustUtil.java +++ b/sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/rust/RustUtil.java @@ -70,7 +70,7 @@ static String generateRustLiteral(final PrimitiveType type, final String value) Verify.notNull(type, "type"); Verify.notNull(value, "value"); final String typeName = rustTypeName(type); - if (typeName == null) + if (null == typeName) { throw new IllegalArgumentException("Unknown Rust type name found for primitive " + type.primitiveName()); } @@ -178,7 +178,7 @@ static String characterEncoding(final Encoding encoding) /** * Converts to 'snake_case' but will also handle when there are multiple - * upper case characters in a row 'UPPERCase' => 'upper_case' + * upper case characters in a row 'UPPERCase' => 'upper_case'. * * @param value to be formatted * @return the string formatted to 'lower_snake_case' diff --git a/sbe-tool/src/main/java/uk/co/real_logic/sbe/ir/Token.java b/sbe-tool/src/main/java/uk/co/real_logic/sbe/ir/Token.java index 83ab2d1538..6d97572727 100644 --- a/sbe-tool/src/main/java/uk/co/real_logic/sbe/ir/Token.java +++ b/sbe-tool/src/main/java/uk/co/real_logic/sbe/ir/Token.java @@ -71,7 +71,7 @@ public class Token public static final int INVALID_ID = -1; /** - * Length not determined + * Length not determined. */ public static final int VARIABLE_LENGTH = -1; @@ -148,9 +148,9 @@ public Signal signal() } /** - * Return the name of the token + * Return the name of the token. * - * @return name of the token + * @return name of the token. */ public String name() { @@ -158,7 +158,7 @@ public String name() } /** - * Return the packageName of the token + * Return the packageName of the token. * * @return packageName of the token or null, if it was not set explicitly. */ @@ -188,9 +188,9 @@ public String description() } /** - * Return the ID of the token assigned by the specification + * Return the ID of the token assigned by the specification. * - * @return ID of the token assigned by the specification + * @return ID of the token assigned by the specification. */ public int id() { diff --git a/sbe-tool/src/main/java/uk/co/real_logic/sbe/xml/EncodedDataType.java b/sbe-tool/src/main/java/uk/co/real_logic/sbe/xml/EncodedDataType.java index 981bcaa8db..78fe6e10a0 100644 --- a/sbe-tool/src/main/java/uk/co/real_logic/sbe/xml/EncodedDataType.java +++ b/sbe-tool/src/main/java/uk/co/real_logic/sbe/xml/EncodedDataType.java @@ -55,7 +55,7 @@ public class EncodedDataType extends Type /** * Construct a new encodedDataType from XML Schema. * - * @param node from the XML Schema Parsing + * @param node from the XML Schema Parsing. */ public EncodedDataType(final Node node) { @@ -258,9 +258,9 @@ public EncodedDataType( } /** - * Return the length attribute of the type + * Return the length attribute of the type. * - * @return length attribute of the type + * @return length attribute of the type. */ public int length() { @@ -268,9 +268,9 @@ public int length() } /** - * Return the variableLength attribute of the type + * Return the variableLength attribute of the type. * - * @return variableLength boolean of the type + * @return variableLength boolean of the type. */ public boolean isVariableLength() { @@ -288,9 +288,9 @@ public void variableLength(final boolean variableLength) } /** - * Return the primitiveType attribute of the type + * Return the primitiveType attribute of the type. * - * @return primitiveType attribute of the type + * @return primitiveType attribute of the type. */ public PrimitiveType primitiveType() { @@ -318,9 +318,9 @@ public int encodedLength() } /** - * The constant value of the type if specified + * The constant value of the type if specified. * - * @return value of the constant for this type + * @return value of the constant for this type. */ public PrimitiveValue constVal() { @@ -333,9 +333,9 @@ public PrimitiveValue constVal() } /** - * The minValue of the type + * The minValue of the type. * - * @return value of the minValue + * @return value of the minValue. */ public PrimitiveValue minValue() { @@ -343,9 +343,9 @@ public PrimitiveValue minValue() } /** - * The maxValue of the type + * The maxValue of the type. * - * @return value of the maxValue + * @return value of the maxValue. */ public PrimitiveValue maxValue() { @@ -353,9 +353,9 @@ public PrimitiveValue maxValue() } /** - * The nullValue of the type + * The nullValue of the type. * - * @return value of the nullValue primitiveType or type + * @return value of the nullValue primitiveType or type. */ public PrimitiveValue nullValue() { @@ -363,9 +363,9 @@ public PrimitiveValue nullValue() } /** - * The character encoding of the type + * The character encoding of the type. * - * @return value representing the encoding + * @return value representing the encoding. */ public String characterEncoding() { diff --git a/sbe-tool/src/main/java/uk/co/real_logic/sbe/xml/EnumType.java b/sbe-tool/src/main/java/uk/co/real_logic/sbe/xml/EnumType.java index 60a9cdc66e..b2566ea787 100644 --- a/sbe-tool/src/main/java/uk/co/real_logic/sbe/xml/EnumType.java +++ b/sbe-tool/src/main/java/uk/co/real_logic/sbe/xml/EnumType.java @@ -174,9 +174,9 @@ public PrimitiveType encodingType() } /** - * The encodedLength (in octets) of the encodingType + * The encodedLength (in octets) of the encodingType. * - * @return encodedLength of the encodingType + * @return encodedLength of the encodingType. */ public int encodedLength() { @@ -191,7 +191,7 @@ public int encodedLength() /** * Get the {@link ValidValue} represented by a {@link PrimitiveValue}. * - * @param value to lookup + * @param value to lookup. * @return the {@link ValidValue} represented by a {@link PrimitiveValue} or null. */ public ValidValue getValidValue(final PrimitiveValue value) @@ -202,7 +202,7 @@ public ValidValue getValidValue(final PrimitiveValue value) /** * Get the {@link ValidValue} represented by a string name. * - * @param name to lookup + * @param name to lookup. * @return the {@link ValidValue} represented by a string name or null. */ public ValidValue getValidValue(final String name) @@ -265,8 +265,8 @@ public static class ValidValue /** * Construct a ValidValue given the XML node and the encodingType. * - * @param node that contains the validValue - * @param encodingType for the enum + * @param node that contains the validValue. + * @param encodingType for the enum. */ public ValidValue(final Node node, final PrimitiveType encodingType) { @@ -310,9 +310,9 @@ public String description() } /** - * The sinceVersion value of the {@link ValidValue} + * The sinceVersion value of the {@link ValidValue}. * - * @return the sinceVersion value of the {@link ValidValue} + * @return the sinceVersion value of the {@link ValidValue}. */ public int sinceVersion() { diff --git a/sbe-tool/src/main/java/uk/co/real_logic/sbe/xml/Message.java b/sbe-tool/src/main/java/uk/co/real_logic/sbe/xml/Message.java index 3c1e6a78f2..90695b736a 100644 --- a/sbe-tool/src/main/java/uk/co/real_logic/sbe/xml/Message.java +++ b/sbe-tool/src/main/java/uk/co/real_logic/sbe/xml/Message.java @@ -98,9 +98,9 @@ public Message(final Node messageNode, final Map typeByNameMap) th } /** - * Return the template schemaId of the message + * Return the template schemaId of the message. * - * @return schemaId of the message + * @return schemaId of the message. */ public int id() { @@ -108,9 +108,9 @@ public int id() } /** - * Return the name of the message + * Return the name of the message. * - * @return name of the message + * @return name of the message. */ public String name() { @@ -118,9 +118,9 @@ public String name() } /** - * The description of the message (if set) or null + * The description of the message (if set) or null. * - * @return description set by the message or null + * @return description set by the message or null. */ public String description() { @@ -128,9 +128,9 @@ public String description() } /** - * The semanticType of the message (if set) or null + * The semanticType of the message (if set) or null. * - * @return the semanticType of the message (if set) or null + * @return the semanticType of the message (if set) or null. */ public String semanticType() { @@ -158,9 +158,9 @@ public int deprecated() } /** - * Return the list of fields in the message + * Return the list of fields in the message. * - * @return {@link java.util.List} of the Field objects in this Message + * @return {@link java.util.List} of the Field objects in this Message. */ public List fields() { diff --git a/sbe-tool/src/main/java/uk/co/real_logic/sbe/xml/MessageSchema.java b/sbe-tool/src/main/java/uk/co/real_logic/sbe/xml/MessageSchema.java index 46dac06dfd..5203939b4d 100644 --- a/sbe-tool/src/main/java/uk/co/real_logic/sbe/xml/MessageSchema.java +++ b/sbe-tool/src/main/java/uk/co/real_logic/sbe/xml/MessageSchema.java @@ -96,7 +96,7 @@ public class MessageSchema /** * The Schema headerType for message headers. This should be a {@link CompositeType}. * - * @return the Schema headerType for message headers + * @return the Schema headerType for message headers. */ public CompositeType messageHeader() { @@ -196,7 +196,7 @@ public Collection types() } /** - * Return the byte order specified by the messageSchema + * Return the byte order specified by the messageSchema. * * @return {@link ByteOrder} of the message encoding. */ diff --git a/sbe-tool/src/main/java/uk/co/real_logic/sbe/xml/SetType.java b/sbe-tool/src/main/java/uk/co/real_logic/sbe/xml/SetType.java index fb6914774f..ff5b025ae4 100644 --- a/sbe-tool/src/main/java/uk/co/real_logic/sbe/xml/SetType.java +++ b/sbe-tool/src/main/java/uk/co/real_logic/sbe/xml/SetType.java @@ -134,9 +134,9 @@ public PrimitiveType encodingType() } /** - * The encodedLength (in octets) of the encodingType + * The encodedLength (in octets) of the encodingType. * - * @return encodedLength of the encodingType + * @return encodedLength of the encodingType. */ public int encodedLength() { @@ -146,7 +146,7 @@ public int encodedLength() /** * Get the {@link Choice} represented by a {@link PrimitiveValue}. * - * @param value to get + * @param value to get. * @return the {@link Choice} represented by a {@link PrimitiveValue} or null if not found. */ public Choice getChoice(final PrimitiveValue value) @@ -157,7 +157,7 @@ public Choice getChoice(final PrimitiveValue value) /** * Get the {@link Choice} represented by a String name. * - * @param name to get + * @param name to get. * @return the {@link Choice} represented by a String name or null if not found. */ public Choice getChoice(final String name) @@ -209,10 +209,10 @@ public static class Choice private final int deprecated; /** - * Construct a Choice given the XML node and the encodingType + * Construct a Choice given the XML node and the encodingType. * - * @param node that contains the validValue - * @param encodingType for the enum + * @param node that contains the validValue. + * @param encodingType for the enum. */ public Choice(final Node node, final PrimitiveType encodingType) { @@ -262,9 +262,9 @@ public String description() } /** - * The sinceVersion value of the {@link Choice} + * The sinceVersion value of the {@link Choice}. * - * @return the sinceVersion value of the {@link Choice} + * @return the sinceVersion value of the {@link Choice}. */ public int sinceVersion() {