Skip to content

Commit

Permalink
Fix CT_CONSTRUCTOR_THROWCT spotbugs warning, make generated classes f…
Browse files Browse the repository at this point in the history
…inal
  • Loading branch information
Mi-La committed Dec 11, 2023
1 parent 9640261 commit 3b7ebb1
Show file tree
Hide file tree
Showing 81 changed files with 22 additions and 272 deletions.
2 changes: 1 addition & 1 deletion compiler/extensions/java/freemarker/Bitmask.java.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ new ${arrayableInfo.arrayTraits.name}(<#rt>
<#if withCodeComments && docComments??>
<@doc_comments docComments/>
</#if>
public class ${name} implements <#if withWriterCode>zserio.runtime.io.<#if usedInPackedArray>Packable</#if>Writer, </#if><#rt>
public final class ${name} implements <#if withWriterCode>zserio.runtime.io.<#if usedInPackedArray>Packable</#if>Writer, </#if><#rt>
<#lt>zserio.runtime.<#if usedInPackedArray>Packable</#if>SizeOf,
zserio.runtime.ZserioBitmask
{
Expand Down
2 changes: 1 addition & 1 deletion compiler/extensions/java/freemarker/Choice.java.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ ${I}}
<#if withCodeComments && docComments??>
<@doc_comments docComments/>
</#if>
public class ${name} implements <#rt>
public final class ${name} implements <#rt>
<#if withWriterCode>zserio.runtime.io.<#if isPackable && usedInPackedArray>Packable</#if>Writer, <#t>
<#lt></#if>zserio.runtime.<#if isPackable && usedInPackedArray>Packable</#if>SizeOf
{
Expand Down
2 changes: 1 addition & 1 deletion compiler/extensions/java/freemarker/Pubsub.java.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<#if withCodeComments && docComments??>
<@doc_comments docComments/>
</#if>
public class ${name}
public final class ${name}
{
<#if withCodeComments>
/**
Expand Down
2 changes: 1 addition & 1 deletion compiler/extensions/java/freemarker/SqlDatabase.java.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<#if withCodeComments && docComments??>
<@doc_comments docComments/>
</#if>
public class ${name} implements zserio.runtime.SqlDatabase<#if !withWriterCode>Reader</#if>
public final class ${name} implements zserio.runtime.SqlDatabase<#if !withWriterCode>Reader</#if>
{
<#if withValidationCode && needsParameterProvider>
<#if withCodeComments>
Expand Down
2 changes: 1 addition & 1 deletion compiler/extensions/java/freemarker/SqlTable.java.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<#if withCodeComments && docComments??>
<@doc_comments docComments/>
</#if>
public class ${name}
public final class ${name}
{
<#if needsParameterProvider>
<#if withCodeComments>
Expand Down
2 changes: 1 addition & 1 deletion compiler/extensions/java/freemarker/SqlTableRow.java.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<#if withCodeComments>
/** Class which describes one row in the table ${name?remove_ending("Row")}. */
</#if>
public class ${name}
public final class ${name}
{
<#list fields as field>
<#if withCodeComments>
Expand Down
2 changes: 1 addition & 1 deletion compiler/extensions/java/freemarker/Structure.java.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<#function extended_field_index numFields numExtendedFields fieldIndex>
<#return fieldIndex - (numFields - numExtendedFields)>
</#function>
public class ${name} implements <#rt>
public final class ${name} implements <#rt>
<#if withWriterCode>zserio.runtime.io.<#if isPackable && usedInPackedArray>Packable</#if>Writer, <#t>
<#lt></#if>zserio.runtime.<#if isPackable && usedInPackedArray>Packable</#if>SizeOf
{
Expand Down
2 changes: 1 addition & 1 deletion compiler/extensions/java/freemarker/Union.java.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<#if withCodeComments && docComments??>
<@doc_comments docComments/>
</#if>
public class ${name} implements <#rt>
public final class ${name} implements <#rt>
<#if withWriterCode>zserio.runtime.io.<#if isPackable && usedInPackedArray>Packable</#if>Writer, <#t>
<#lt></#if>zserio.runtime.<#if isPackable && usedInPackedArray>Packable</#if>SizeOf
{
Expand Down
4 changes: 0 additions & 4 deletions compiler/extensions/java/runtime/spotbugs_filter.xml
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,4 @@
</And>
</Or>
</Match>
<Match>
<!-- Be wary of letting constructors throw exceptions - Should be fixed in generated code. -->
<Bug code="CT"/>
</Match>
</FindBugsFilter>
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

package test_object;

public class ArrayBitmask implements zserio.runtime.io.PackableWriter, zserio.runtime.PackableSizeOf,
public final class ArrayBitmask implements zserio.runtime.io.PackableWriter, zserio.runtime.PackableSizeOf,
zserio.runtime.ZserioBitmask
{
public ArrayBitmask()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

package test_object;

public class ArrayHolder implements zserio.runtime.io.Writer, zserio.runtime.SizeOf
public final class ArrayHolder implements zserio.runtime.io.Writer, zserio.runtime.SizeOf
{
public ArrayHolder()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

package test_object;

public class ArrayObject implements zserio.runtime.io.PackableWriter, zserio.runtime.PackableSizeOf
public final class ArrayObject implements zserio.runtime.io.PackableWriter, zserio.runtime.PackableSizeOf
{
public static final class ZserioPackingContext extends zserio.runtime.array.PackingContext
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

package test_object;

public class CreatorBitmask implements zserio.runtime.io.Writer, zserio.runtime.SizeOf,
public final class CreatorBitmask implements zserio.runtime.io.Writer, zserio.runtime.SizeOf,
zserio.runtime.ZserioBitmask
{
public CreatorBitmask()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

package test_object;

public class CreatorNested implements zserio.runtime.io.Writer, zserio.runtime.SizeOf
public final class CreatorNested implements zserio.runtime.io.Writer, zserio.runtime.SizeOf
{
public CreatorNested(
long param_)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

package test_object;

public class CreatorObject implements zserio.runtime.io.Writer, zserio.runtime.SizeOf
public final class CreatorObject implements zserio.runtime.io.Writer, zserio.runtime.SizeOf
{
public CreatorObject()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

package test_object;

public class SerializeNested implements zserio.runtime.io.Writer, zserio.runtime.SizeOf
public final class SerializeNested implements zserio.runtime.io.Writer, zserio.runtime.SizeOf
{
public SerializeNested(
byte param_)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

package test_object;

public class SerializeObject implements zserio.runtime.io.Writer, zserio.runtime.SizeOf
public final class SerializeObject implements zserio.runtime.io.Writer, zserio.runtime.SizeOf
{
public SerializeObject()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

package test_object;

public class WalkerBitmask implements zserio.runtime.io.Writer, zserio.runtime.SizeOf,
public final class WalkerBitmask implements zserio.runtime.io.Writer, zserio.runtime.SizeOf,
zserio.runtime.ZserioBitmask
{
public WalkerBitmask()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

package test_object;

public class WalkerNested implements zserio.runtime.io.Writer, zserio.runtime.SizeOf
public final class WalkerNested implements zserio.runtime.io.Writer, zserio.runtime.SizeOf
{
public WalkerNested()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

package test_object;

public class WalkerObject implements zserio.runtime.io.Writer, zserio.runtime.SizeOf
public final class WalkerObject implements zserio.runtime.io.Writer, zserio.runtime.SizeOf
{
public WalkerObject()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

package test_object;

public class WalkerUnion implements zserio.runtime.io.Writer, zserio.runtime.SizeOf
public final class WalkerUnion implements zserio.runtime.io.Writer, zserio.runtime.SizeOf
{
public WalkerUnion()
{
Expand Down Expand Up @@ -307,6 +307,6 @@ public test_object.WalkerNested create(zserio.runtime.io.BitStreamReader in, int
}
}

private java.lang.Object objectChoice;
private int choiceTag = UNDEFINED_CHOICE;
private java.lang.Object objectChoice;
}
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ public void sqlTypeToSqliteType() throws SQLException
}
}

private static class TestSqlDatabase implements SqlDatabaseReader
private static final class TestSqlDatabase implements SqlDatabaseReader
{
public TestSqlDatabase() throws SQLException
{
Expand Down
4 changes: 0 additions & 4 deletions scripts/test_zs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -160,10 +160,6 @@ EOF
<Match>
<!-- May expose internal representation by incorporating reference to mutable object. -->
<Bug code="EI2"/>
</Match>
<Match>
<!-- Be wary of letting constructors throw exceptions - Should be fixed in generated code. -->
<Bug code="CT"/>
</Match>${SPOTBUGS_FILTER_SQLITE}
</FindBugsFilter>
EOF
Expand Down
4 changes: 0 additions & 4 deletions test/arguments/allow_implicit_arrays/spotbugs_filter.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,4 @@
<!-- May expose internal representation by incorporating reference to mutable object. -->
<Bug code="EI2"/>
</Match>
<Match>
<!-- Be wary of letting constructors throw exceptions - Should be fixed in generated code. -->
<Bug code="CT"/>
</Match>
</FindBugsFilter>
4 changes: 0 additions & 4 deletions test/arguments/set_top_level_package/spotbugs_filter.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,4 @@
<!-- May expose internal representation by incorporating reference to mutable object. -->
<Bug code="EI2"/>
</Match>
<Match>
<!-- Be wary of letting constructors throw exceptions - Should be fixed in generated code. -->
<Bug code="CT"/>
</Match>
</FindBugsFilter>
4 changes: 0 additions & 4 deletions test/arguments/with_range_check_code/spotbugs_filter.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,4 @@
<!-- May expose internal representation by returning reference to mutable object. -->
<Bug code="EI"/>
</Match>
<Match>
<!-- Be wary of letting constructors throw exceptions - Should be fixed in generated code. -->
<Bug code="CT"/>
</Match>
</FindBugsFilter>
4 changes: 0 additions & 4 deletions test/arguments/with_type_info_code/spotbugs_filter.xml
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,4 @@
<!-- May expose internal representation by incorporating reference to mutable object. -->
<Bug code="EI2"/>
</Match>
<Match>
<!-- Be wary of letting constructors throw exceptions - Should be fixed in generated code. -->
<Bug code="CT"/>
</Match>
</FindBugsFilter>
4 changes: 0 additions & 4 deletions test/arguments/with_validation_code/spotbugs_filter.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,4 @@
<!-- May expose internal representation by incorporating reference to mutable object. -->
<Bug code="EI2"/>
</Match>
<Match>
<!-- Be wary of letting constructors throw exceptions - Should be fixed in generated code. -->
<Bug code="CT"/>
</Match>
</FindBugsFilter>
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,4 @@
<!-- May expose internal representation by returning reference to mutable object. -->
<Bug code="EI"/>
</Match>
<Match>
<!-- Be wary of letting constructors throw exceptions - Should be fixed in generated code. -->
<Bug code="CT"/>
</Match>
</FindBugsFilter>
4 changes: 0 additions & 4 deletions test/arguments/without_pubsub_code/spotbugs_filter.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,4 @@
<!-- May expose internal representation by returning reference to mutable object. -->
<Bug code="EI"/>
</Match>
<Match>
<!-- Be wary of letting constructors throw exceptions - Should be fixed in generated code. -->
<Bug code="CT"/>
</Match>
</FindBugsFilter>
4 changes: 0 additions & 4 deletions test/arguments/without_service_code/spotbugs_filter.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,4 @@
<!-- May expose internal representation by returning reference to mutable object. -->
<Bug code="EI"/>
</Match>
<Match>
<!-- Be wary of letting constructors throw exceptions - Should be fixed in generated code. -->
<Bug code="CT"/>
</Match>
</FindBugsFilter>
4 changes: 0 additions & 4 deletions test/arguments/without_sql_code/spotbugs_filter.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,4 @@
<!-- May expose internal representation by returning reference to mutable object. -->
<Bug code="EI"/>
</Match>
<Match>
<!-- Be wary of letting constructors throw exceptions - Should be fixed in generated code. -->
<Bug code="CT"/>
</Match>
</FindBugsFilter>
4 changes: 0 additions & 4 deletions test/arguments/without_writer_code/spotbugs_filter.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,4 @@
<!-- May expose internal representation by incorporating reference to mutable object. -->
<Bug code="EI2"/>
</Match>
<Match>
<!-- Be wary of letting constructors throw exceptions - Should be fixed in generated code. -->
<Bug code="CT"/>
</Match>
</FindBugsFilter>
4 changes: 0 additions & 4 deletions test/language/alignment/spotbugs_filter.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,4 @@
<!-- May expose internal representation by returning reference to mutable object. -->
<Bug code="EI"/>
</Match>
<Match>
<!-- Be wary of letting constructors throw exceptions - Should be fixed in generated code. -->
<Bug code="CT"/>
</Match>
</FindBugsFilter>
4 changes: 0 additions & 4 deletions test/language/array_types/spotbugs_filter.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,4 @@
<!-- May expose internal representation by incorporating reference to mutable object. -->
<Bug code="EI2"/>
</Match>
<Match>
<!-- Be wary of letting constructors throw exceptions - Should be fixed in generated code. -->
<Bug code="CT"/>
</Match>
</FindBugsFilter>
6 changes: 0 additions & 6 deletions test/language/bitmask_types/spotbugs_filter.xml

This file was deleted.

4 changes: 0 additions & 4 deletions test/language/builtin_types/spotbugs_filter.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,4 @@
<!-- May expose internal representation by incorporating reference to mutable object. -->
<Bug code="EI2"/>
</Match>
<Match>
<!-- Be wary of letting constructors throw exceptions - Should be fixed in generated code. -->
<Bug code="CT"/>
</Match>
</FindBugsFilter>
4 changes: 0 additions & 4 deletions test/language/choice_types/spotbugs_filter.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,4 @@
<!-- May expose internal representation by incorporating reference to mutable object. -->
<Bug code="EI2"/>
</Match>
<Match>
<!-- Be wary of letting constructors throw exceptions - Should be fixed in generated code. -->
<Bug code="CT"/>
</Match>
</FindBugsFilter>
4 changes: 0 additions & 4 deletions test/language/comments/spotbugs_filter.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,4 @@
<!-- May expose internal representation by incorporating reference to mutable object. -->
<Bug code="EI2"/>
</Match>
<Match>
<!-- Be wary of letting constructors throw exceptions - Should be fixed in generated code. -->
<Bug code="CT"/>
</Match>
</FindBugsFilter>
6 changes: 0 additions & 6 deletions test/language/constants/spotbugs_filter.xml

This file was deleted.

4 changes: 0 additions & 4 deletions test/language/constraints/spotbugs_filter.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,4 @@
<!-- May expose internal representation by incorporating reference to mutable object. -->
<Bug code="EI2"/>
</Match>
<Match>
<!-- Be wary of letting constructors throw exceptions - Should be fixed in generated code. -->
<Bug code="CT"/>
</Match>
</FindBugsFilter>
4 changes: 0 additions & 4 deletions test/language/default_values/spotbugs_filter.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,4 @@
<!-- May expose internal representation by incorporating reference to mutable object. -->
<Bug code="EI2"/>
</Match>
<Match>
<!-- Be wary of letting constructors throw exceptions - Should be fixed in generated code. -->
<Bug code="CT"/>
</Match>
</FindBugsFilter>
6 changes: 0 additions & 6 deletions test/language/enumeration_types/spotbugs_filter.xml

This file was deleted.

4 changes: 0 additions & 4 deletions test/language/explicit_parameters/spotbugs_filter.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,4 @@
<!-- May expose internal representation by incorporating reference to mutable object. -->
<Bug code="EI2"/>
</Match>
<Match>
<!-- Be wary of letting constructors throw exceptions - Should be fixed in generated code. -->
<Bug code="CT"/>
</Match>
</FindBugsFilter>
Loading

0 comments on commit 3b7ebb1

Please sign in to comment.