Skip to content

Commit

Permalink
enable nullable on Messages projects; fix warning
Browse files Browse the repository at this point in the history
Fixed the warning for the Group-returning IMessageFactory.Create function.  It's return value is intentionally nullable.
  • Loading branch information
gbirchmeier committed Jan 2, 2025
1 parent f1989fc commit ce08753
Show file tree
Hide file tree
Showing 23 changed files with 28 additions and 18 deletions.
2 changes: 1 addition & 1 deletion DDTool/DDTool/Generators/GenMessageFactories.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ private static string Generate(DataDictionary dd) {
" };",
" }",
"",
" public Group Create(string beginString, string msgType, int correspondingFieldId)",
" public Group? Create(string beginString, string msgType, int correspondingFieldId)",
" {"
});

Expand Down
2 changes: 1 addition & 1 deletion Messages/FIX40/MessageFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public QuickFix.Message Create(string beginString, string msgType)
};
}

public Group Create(string beginString, string msgType, int correspondingFieldId)
public Group? Create(string beginString, string msgType, int correspondingFieldId)
{
if (QuickFix.FIX40.News.MsgType.Equals(msgType))
{
Expand Down
1 change: 1 addition & 0 deletions Messages/FIX40/QuickFix.FIX40.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<PackageReadmeFile>README.md</PackageReadmeFile>
<PackageIcon>qfn-icon.png</PackageIcon>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion Messages/FIX41/MessageFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public QuickFix.Message Create(string beginString, string msgType)
};
}

public Group Create(string beginString, string msgType, int correspondingFieldId)
public Group? Create(string beginString, string msgType, int correspondingFieldId)
{
if (QuickFix.FIX41.IndicationofInterest.MsgType.Equals(msgType))
{
Expand Down
1 change: 1 addition & 0 deletions Messages/FIX41/QuickFix.FIX41.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<PackageReadmeFile>README.md</PackageReadmeFile>
<PackageIcon>qfn-icon.png</PackageIcon>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion Messages/FIX42/MessageFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public QuickFix.Message Create(string beginString, string msgType)
};
}

public Group Create(string beginString, string msgType, int correspondingFieldId)
public Group? Create(string beginString, string msgType, int correspondingFieldId)
{
if (QuickFix.FIX42.Logon.MsgType.Equals(msgType))
{
Expand Down
1 change: 1 addition & 0 deletions Messages/FIX42/QuickFix.FIX42.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<PackageReadmeFile>README.md</PackageReadmeFile>
<PackageIcon>qfn-icon.png</PackageIcon>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion Messages/FIX43/MessageFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public QuickFix.Message Create(string beginString, string msgType)
};
}

public Group Create(string beginString, string msgType, int correspondingFieldId)
public Group? Create(string beginString, string msgType, int correspondingFieldId)
{
if (QuickFix.FIX43.Logon.MsgType.Equals(msgType))
{
Expand Down
1 change: 1 addition & 0 deletions Messages/FIX43/QuickFix.FIX43.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<PackageReadmeFile>README.md</PackageReadmeFile>
<PackageIcon>qfn-icon.png</PackageIcon>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion Messages/FIX44/MessageFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public QuickFix.Message Create(string beginString, string msgType)
};
}

public Group Create(string beginString, string msgType, int correspondingFieldId)
public Group? Create(string beginString, string msgType, int correspondingFieldId)
{
if (QuickFix.FIX44.Logon.MsgType.Equals(msgType))
{
Expand Down
1 change: 1 addition & 0 deletions Messages/FIX44/QuickFix.FIX44.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<PackageReadmeFile>README.md</PackageReadmeFile>
<PackageIcon>qfn-icon.png</PackageIcon>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion Messages/FIX50/MessageFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public QuickFix.Message Create(string beginString, string msgType)
};
}

public Group Create(string beginString, string msgType, int correspondingFieldId)
public Group? Create(string beginString, string msgType, int correspondingFieldId)
{
if (QuickFix.FIX50.IOI.MsgType.Equals(msgType))
{
Expand Down
1 change: 1 addition & 0 deletions Messages/FIX50/QuickFix.FIX50.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<PackageReadmeFile>README.md</PackageReadmeFile>
<PackageIcon>qfn-icon.png</PackageIcon>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion Messages/FIX50SP1/MessageFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ public QuickFix.Message Create(string beginString, string msgType)
};
}

public Group Create(string beginString, string msgType, int correspondingFieldId)
public Group? Create(string beginString, string msgType, int correspondingFieldId)
{
if (QuickFix.FIX50SP1.IOI.MsgType.Equals(msgType))
{
Expand Down
1 change: 1 addition & 0 deletions Messages/FIX50SP1/QuickFix.FIX50SP1.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<PackageReadmeFile>README.md</PackageReadmeFile>
<PackageIcon>qfn-icon.png</PackageIcon>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion Messages/FIX50SP2/MessageFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ public QuickFix.Message Create(string beginString, string msgType)
};
}

public Group Create(string beginString, string msgType, int correspondingFieldId)
public Group? Create(string beginString, string msgType, int correspondingFieldId)
{
if (QuickFix.FIX50SP2.IOI.MsgType.Equals(msgType))
{
Expand Down
1 change: 1 addition & 0 deletions Messages/FIX50SP2/QuickFix.FIX50SP2.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<PackageReadmeFile>README.md</PackageReadmeFile>
<PackageIcon>qfn-icon.png</PackageIcon>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion Messages/FIXT11/MessageFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public QuickFix.Message Create(string beginString, string msgType)
};
}

public Group Create(string beginString, string msgType, int correspondingFieldId)
public Group? Create(string beginString, string msgType, int correspondingFieldId)
{
if (QuickFix.FIXT11.Logon.MsgType.Equals(msgType))
{
Expand Down
1 change: 1 addition & 0 deletions Messages/FIXT11/QuickFix.FIXT11.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<PackageReadmeFile>README.md</PackageReadmeFile>
<PackageIcon>qfn-icon.png</PackageIcon>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion QuickFIXn/DefaultMessageFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public Message Create(string beginString, QuickFix.Fields.ApplVerID applVerId, s
return message;
}

public Group Create(string beginString, string msgType, int groupCounterTag)
public Group? Create(string beginString, string msgType, int groupCounterTag)
{
string key = beginString;
if(beginString.Equals(FixValues.BeginString.FIXT11))
Expand Down
4 changes: 2 additions & 2 deletions QuickFIXn/IMessageFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public interface IMessageFactory
/// <param name="beginString">the FIX version (e.g. "FIX.4.2")</param>
/// <param name="msgType">message type of the enclosing message (e.g. "D" for a NewOrderSingle</param>
/// <param name="groupCounterTag">the tag of the group's counter field</param>
/// <returns>group, or null if the group can't be created</returns>
Group Create(string beginString, string msgType, int groupCounterTag);
/// <returns>A group, or null if the group can't be created</returns>
Group? Create(string beginString, string msgType, int groupCounterTag);
}
}
1 change: 1 addition & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ What's New
* #914 - Optimize MessageCracker.IsHandlerMethod (vasily-balansea)
* #742 - Improvements to HTTP web proxy (IanLeeClaxton)
* #277 - change FileStore.SetSeqNum() to dispose StreamWriter (hlibman)
* #nnn - mark IMessageFactory.Create's Group return value as nullable (gbirchmeier)

### v1.12.0

Expand Down
10 changes: 5 additions & 5 deletions UnitTests/DefaultMessageFactoryTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ public void GroupCreateTest_Fix50()
{
DefaultMessageFactory dmf = new DefaultMessageFactory(QuickFix.FixValues.ApplVerID.FIX50);

Group g44 = dmf.Create("FIX.4.4", "B", 33);
Group? g44 = dmf.Create("FIX.4.4", "B", 33);
Assert.That(g44, Is.InstanceOf<QuickFix.FIX44.News.LinesOfTextGroup>());

Group g50 = dmf.Create("FIXT.1.1", "B", 33);
Group? g50 = dmf.Create("FIXT.1.1", "B", 33);
Assert.That(g50, Is.InstanceOf<QuickFix.FIX50.News.NoLinesOfTextGroup>());

Group g50sp2 = dmf.Create("FIXT.1.1", "CD", QuickFix.Fields.Tags.NoAsgnReqs);
Group? g50sp2 = dmf.Create("FIXT.1.1", "CD", QuickFix.Fields.Tags.NoAsgnReqs);
Assert.That(g50sp2, Is.Null);
}

Expand All @@ -30,10 +30,10 @@ public void GroupCreateTest_DefaultFix50Sp2()
{
DefaultMessageFactory dmf = new DefaultMessageFactory();

Group g44 = dmf.Create("FIX.4.4", "B", 33);
Group? g44 = dmf.Create("FIX.4.4", "B", 33);
Assert.That(g44, Is.InstanceOf<QuickFix.FIX44.News.LinesOfTextGroup>());

Group g50sp2 = dmf.Create("FIXT.1.1", "CD", QuickFix.Fields.Tags.NoAsgnReqs);
Group? g50sp2 = dmf.Create("FIXT.1.1", "CD", QuickFix.Fields.Tags.NoAsgnReqs);
Assert.That(g50sp2, Is.InstanceOf<QuickFix.FIX50SP2.StreamAssignmentReport.NoAsgnReqsGroup>());
}
}
Expand Down

0 comments on commit ce08753

Please sign in to comment.