Skip to content

Commit

Permalink
[crc64] Change the hash prefix back to crc64 (#628)
Browse files Browse the repository at this point in the history
Context: 9b88ce7
Context: 7fe3a11

7fe3a11 fixed the new CRC64 calculation algorithm so that it properly
processes all the data, which had the (expected) effect of generating
the same checksums for the same data as those generated before
commit 9b88ce7.

However, 7fe3a11 missed changing the new `c64r2` hash prefix back to
`crc64`, thus this commit to make the change.

The change will remove any backward incompatibility with code that may
rely on the old hash format, including Xamarin.Android tests.
  • Loading branch information
grendello authored Apr 16, 2020
1 parent 7fe3a11 commit 6d7266d
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class JniTypeName
public
#endif
static class JavaNativeTypeManager {
const string CRC_PREFIX = "c64r2";
const string CRC_PREFIX = "crc64";

public static PackageNamingPolicy PackageNamingPolicy { get; set; } = PackageNamingPolicy.LowercaseCrc64;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ public void GenerateIndirectApplication (
)
{
var actual = Generate (typeof (IndirectApplication), applicationJavaClass);
var expected = @"package c64r2197ae30a36756915;
var expected = @"package crc64197ae30a36756915;
public class IndirectApplication
Expand Down Expand Up @@ -175,7 +175,7 @@ public void monodroidClearReferences ()
public void GenerateExportedMembers ()
{
var actual = Generate (typeof (ExportsMembers));
var expected = @"package c64r2197ae30a36756915;
var expected = @"package crc64197ae30a36756915;
public class ExportsMembers
Expand All @@ -187,7 +187,7 @@ extends java.lang.Object
public static final String __md_methods;
static {
__md_methods =
""n_GetInstance:()Lc64r2197ae30a36756915/ExportsMembers;:__export__\n"" +
""n_GetInstance:()Lcrc64197ae30a36756915/ExportsMembers;:__export__\n"" +
""n_GetValue:()Ljava/lang/String;:__export__\n"" +
""n_methodNamesNotMangled:()V:__export__\n"" +
""n_CompletelyDifferentName:(Ljava/lang/String;I)Ljava/lang/String;:__export__\n"" +
Expand All @@ -198,17 +198,17 @@ extends java.lang.Object
}
public static c64r2197ae30a36756915.ExportsMembers STATIC_INSTANCE = GetInstance ();
public static crc64197ae30a36756915.ExportsMembers STATIC_INSTANCE = GetInstance ();
public java.lang.String VALUE = GetValue ();
public static c64r2197ae30a36756915.ExportsMembers GetInstance ()
public static crc64197ae30a36756915.ExportsMembers GetInstance ()
{
return n_GetInstance ();
}
private static native c64r2197ae30a36756915.ExportsMembers n_GetInstance ();
private static native crc64197ae30a36756915.ExportsMembers n_GetInstance ();
public java.lang.String GetValue ()
{
Expand Down Expand Up @@ -271,7 +271,7 @@ public void monodroidClearReferences ()
public void GenerateInnerClass ()
{
var actual = Generate (typeof (ExampleOuterClass));
var expected = @"package c64r2197ae30a36756915;
var expected = @"package crc64197ae30a36756915;
public class ExampleOuterClass
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public void TearDown ()
public void Crc64 ()
{
JavaNativeTypeManager.PackageNamingPolicy = PackageNamingPolicy.LowercaseCrc64;
Assert.AreEqual ("c64r2b74743e9328eed0a", JavaNativeTypeManager.GetPackageName (typeof (string)));
Assert.AreEqual ("crc64b74743e9328eed0a", JavaNativeTypeManager.GetPackageName (typeof (string)));
}

[Test]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,12 @@ public void WriteJavaToManaged ()
"value-offset=" + offset + "\u0000" +
GetJ2MEntryLine (typeof (ActivityName), "activity/Name", offset, length) +
GetJ2MEntryLine (typeof (ApplicationName), "application/Name", offset, length) +
GetJ2MEntryLine (typeof (DefaultName), "c64r2197ae30a36756915/DefaultName", offset, length) +
GetJ2MEntryLine (typeof (DefaultName.A), "c64r2197ae30a36756915/DefaultName_A", offset, length) +
GetJ2MEntryLine (typeof (DefaultName.A.B), "c64r2197ae30a36756915/DefaultName_A_B", offset, length) +
GetJ2MEntryLine (typeof (DefaultName.C.D), "c64r2197ae30a36756915/DefaultName_C_D", offset, length) +
GetJ2MEntryLine (typeof (ExampleOuterClass), "c64r2197ae30a36756915/ExampleOuterClass", offset, length) +
GetJ2MEntryLine (typeof (ExampleOuterClass.ExampleInnerClass), "c64r2197ae30a36756915/ExampleOuterClass$ExampleOuterClass_ExampleInnerClass", offset, length) +
GetJ2MEntryLine (typeof (DefaultName), "crc64197ae30a36756915/DefaultName", offset, length) +
GetJ2MEntryLine (typeof (DefaultName.A), "crc64197ae30a36756915/DefaultName_A", offset, length) +
GetJ2MEntryLine (typeof (DefaultName.A.B), "crc64197ae30a36756915/DefaultName_A_B", offset, length) +
GetJ2MEntryLine (typeof (DefaultName.C.D), "crc64197ae30a36756915/DefaultName_C_D", offset, length) +
GetJ2MEntryLine (typeof (ExampleOuterClass), "crc64197ae30a36756915/ExampleOuterClass", offset, length) +
GetJ2MEntryLine (typeof (ExampleOuterClass.ExampleInnerClass), "crc64197ae30a36756915/ExampleOuterClass$ExampleOuterClass_ExampleInnerClass", offset, length) +
GetJ2MEntryLine (typeof (InstrumentationName), "instrumentation/Name", offset, length) +
GetJ2MEntryLine (typeof (AbstractClass), "my/AbstractClass", offset, length) +
GetJ2MEntryLine (typeof (ExampleActivity), "my/ExampleActivity", offset, length) +
Expand Down Expand Up @@ -139,14 +139,14 @@ public void WriteManagedToJava ()
GetM2JEntryLine (typeof (AbstractClassInvoker), "my/AbstractClass", offset, length) +
GetM2JEntryLine (typeof (ActivityName), "activity/Name", offset, length) +
GetM2JEntryLine (typeof (ApplicationName), "application/Name", offset, length) +
GetM2JEntryLine (typeof (DefaultName.A.B), "c64r2197ae30a36756915/DefaultName_A_B", offset, length) +
GetM2JEntryLine (typeof (DefaultName.A), "c64r2197ae30a36756915/DefaultName_A", offset, length) +
GetM2JEntryLine (typeof (DefaultName.C.D), "c64r2197ae30a36756915/DefaultName_C_D", offset, length) +
GetM2JEntryLine (typeof (DefaultName), "c64r2197ae30a36756915/DefaultName", offset, length) +
GetM2JEntryLine (typeof (DefaultName.A.B), "crc64197ae30a36756915/DefaultName_A_B", offset, length) +
GetM2JEntryLine (typeof (DefaultName.A), "crc64197ae30a36756915/DefaultName_A", offset, length) +
GetM2JEntryLine (typeof (DefaultName.C.D), "crc64197ae30a36756915/DefaultName_C_D", offset, length) +
GetM2JEntryLine (typeof (DefaultName), "crc64197ae30a36756915/DefaultName", offset, length) +
GetM2JEntryLine (typeof (ExampleActivity), "my/ExampleActivity", offset, length) +
GetM2JEntryLine (typeof (ExampleInstrumentation), "my/ExampleInstrumentation", offset, length) +
GetM2JEntryLine (typeof (ExampleOuterClass.ExampleInnerClass), "c64r2197ae30a36756915/ExampleOuterClass$ExampleOuterClass_ExampleInnerClass", offset, length) +
GetM2JEntryLine (typeof (ExampleOuterClass), "c64r2197ae30a36756915/ExampleOuterClass", offset, length) +
GetM2JEntryLine (typeof (ExampleOuterClass.ExampleInnerClass), "crc64197ae30a36756915/ExampleOuterClass$ExampleOuterClass_ExampleInnerClass", offset, length) +
GetM2JEntryLine (typeof (ExampleOuterClass), "crc64197ae30a36756915/ExampleOuterClass", offset, length) +
GetM2JEntryLine (typeof (InstrumentationName), "instrumentation/Name", offset, length) +
GetM2JEntryLine (typeof (NonStaticOuterClass.NonStaticInnerClass), "register/NonStaticOuterClass$NonStaticInnerClass", offset, length) +
GetM2JEntryLine (typeof (NonStaticOuterClass), "register/NonStaticOuterClass", offset, length) +
Expand Down

0 comments on commit 6d7266d

Please sign in to comment.