Skip to content

Commit 1375d73

Browse files
committed
Merge branch 'master' into type-level-polymorphism-attr
2 parents b1e89ec + f7ab2ec commit 1375d73

3 files changed

Lines changed: 12 additions & 6 deletions

File tree

build/Version.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.8.0-beta
1+
0.9.0-dev

src/CommonAssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,13 @@
3535
// Major : Represents Major update like re-architecting, remove obsoleted APIs etc.
3636
// Minor : Represents Minor update like adding new feature, obsoleting APIs, fix specification issues, etc.
3737
// Build/Revision : Always 0 since CLI implementations does not care these number, so these changes cause some binding failures.
38-
[assembly: AssemblyVersion( "0.7.0.0" )]
38+
[assembly: AssemblyVersion( "0.9.0.0" )]
3939

4040
// This version represents libarary 'version' for human beings.
4141
// Major : Same as AssemblyVersion.
4242
// Minor : Same as AssemblyVersion.
4343
// Build : Bug fixes and improvements, which does not break API contract, but may break some code depends on internal implementation behaviors.
4444
// For example, some programs use reflection to retrieve private fields, analyse human readable exception messages or stack trace, or so.
4545
// Revision : Reserced. It might be used to indicate target platform or patch.
46-
[assembly: AssemblyInformationalVersion( "0.7.0-alpha2" )]
46+
[assembly: AssemblyInformationalVersion( "0.9.0-dev" )]
4747

src/MsgPack/Serialization/SerializationTarget.cs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,12 @@ namespace MsgPack.Serialization
5050
/// </summary>
5151
internal class SerializationTarget
5252
{
53+
// Type names to avoid user who doesn't embed "message pack assembly's attributes" in their code directly.
54+
private static readonly string MessagePackMemberAttributeTypeName = typeof( MessagePackMemberAttribute ).FullName;
55+
private static readonly string MessagePackIgnoreAttributeTypeName = typeof( MessagePackIgnoreAttribute ).FullName;
56+
private static readonly string MessagePackDeserializationConstructorAttributeTypeName = typeof( MessagePackDeserializationConstructorAttribute ).FullName;
57+
58+
5359
public IList<SerializingMember> Members { get; private set; }
5460
public ConstructorInfo DeserializationConstructor { get; private set; }
5561
public bool IsConstructorDeserialization
@@ -177,7 +183,7 @@ private static IEnumerable<SerializingMember> GetTargetMembers( Type type )
177183
Contract.Assert( type != null, "type != null" );
178184

179185
var members = GetDistinctMembers( type );
180-
var filtered = members.Where( item => item.IsDefined( typeof( MessagePackMemberAttribute ) ) ).ToArray();
186+
var filtered = members.Where( item => item.GetCustomAttributesData().Any( a => a.GetAttributeType().FullName == MessagePackMemberAttributeTypeName ) ).ToArray();
181187

182188
if ( filtered.Length > 0 )
183189
{
@@ -197,7 +203,7 @@ private static IEnumerable<SerializingMember> GetAnnotatedMembersWithDuplication
197203
{
198204
var duplicated =
199205
filtered.FirstOrDefault(
200-
member => member.IsDefined( typeof( MessagePackIgnoreAttribute ) )
206+
member => member.GetCustomAttributesData().Any( a => a.GetAttributeType().FullName == MessagePackIgnoreAttributeTypeName )
201207
);
202208

203209
if ( duplicated != null )
@@ -357,7 +363,7 @@ private static ConstructorInfo FindDeserializationConstructor( Type targetType )
357363

358364
private static IList<ConstructorInfo> FindExplicitDeserializationConstructors( IEnumerable<ConstructorInfo> construtors )
359365
{
360-
return construtors.Where( ctor => ctor.IsDefined( typeof( MessagePackDeserializationConstructorAttribute ) ) ).ToArray();
366+
return construtors.Where( ctor => ctor.GetCustomAttributesData().Any( a => a.GetAttributeType().FullName == MessagePackDeserializationConstructorAttributeTypeName ) ).ToArray();
361367
}
362368

363369
private static SerializationException NewTypeCannotBeSerializedException( Type targetType )

0 commit comments

Comments
 (0)