Skip to content

Commit 2600d41

Browse files
jpobstjonpryor
authored andcommitted
[generator] Use [Obsolete(error:true)] for *InterfaceConsts classes (#490)
Context: #436 The `*InterfaceConsts` classes we've been generating for ages have been marked as `[Obsolete]` for at least 3 years: [Obsolete ("Use the 'MyInterface' type. This type will be removed in a future release.")] public abstract class MyInterfaceConsts : MyInterface { } It's time to tighten the screws a little bit and make this an error: [Obsolete ("Use the 'MyInterface' type. This type will be removed in a future release.", error: true)] public abstract class MyInterfaceConsts : MyInterface { }
1 parent dceda33 commit 2600d41

File tree

8 files changed

+8
-8
lines changed

8 files changed

+8
-8
lines changed

tools/generator/Java.Interop.Tools.Generator.CodeGeneration/CodeGenerator.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -747,7 +747,7 @@ public void WriteInterfaceImplementedMembersAlternative (InterfaceGen @interface
747747

748748
if (!@interface.HasManagedName) {
749749
writer.WriteLine ("{0}[Register (\"{1}\"{2}, DoNotGenerateAcw=true)]", indent, @interface.RawJniName, @interface.AdditionalAttributeString ());
750-
writer.WriteLine ("{0}[global::System.Obsolete (\"Use the '{1}' type. This type will be removed in a future release.\")]", indent, name);
750+
writer.WriteLine ("{0}[global::System.Obsolete (\"Use the '{1}' type. This type will be removed in a future release.\", error: true)]", indent, name);
751751
writer.WriteLine ("{0}public abstract class {1}Consts : {1} {{", indent, name);
752752
writer.WriteLine ();
753753
writer.WriteLine ("{0}\tprivate {1}Consts ()", indent, name);

tools/generator/Tests/Unit-Tests/CodeGeneratorExpectedResults/JavaInterop1/WriteInterface.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public abstract class MyInterface : Java.Lang.Object {
2020
}
2121

2222
[Register ("java/code/IMyInterface", DoNotGenerateAcw=true)]
23-
[global::System.Obsolete ("Use the 'MyInterface' type. This type will be removed in a future release.")]
23+
[global::System.Obsolete ("Use the 'MyInterface' type. This type will be removed in a future release.", error: true)]
2424
public abstract class MyInterfaceConsts : MyInterface {
2525

2626
private MyInterfaceConsts ()

tools/generator/Tests/Unit-Tests/CodeGeneratorExpectedResults/JavaInterop1/WriteStaticInterfaceMethod.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public abstract class MyInterface : Java.Lang.Object {
2020
}
2121

2222
[Register ("java/code/IMyInterface", DoNotGenerateAcw=true)]
23-
[global::System.Obsolete ("Use the 'MyInterface' type. This type will be removed in a future release.")]
23+
[global::System.Obsolete ("Use the 'MyInterface' type. This type will be removed in a future release.", error: true)]
2424
public abstract class MyInterfaceConsts : MyInterface {
2525

2626
private MyInterfaceConsts ()

tools/generator/Tests/Unit-Tests/CodeGeneratorExpectedResults/XAJavaInterop1/WriteInterface.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public abstract class MyInterface : Java.Lang.Object {
2020
}
2121

2222
[Register ("java/code/IMyInterface", DoNotGenerateAcw=true)]
23-
[global::System.Obsolete ("Use the 'MyInterface' type. This type will be removed in a future release.")]
23+
[global::System.Obsolete ("Use the 'MyInterface' type. This type will be removed in a future release.", error: true)]
2424
public abstract class MyInterfaceConsts : MyInterface {
2525

2626
private MyInterfaceConsts ()

tools/generator/Tests/Unit-Tests/CodeGeneratorExpectedResults/XAJavaInterop1/WriteStaticInterfaceMethod.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public abstract class MyInterface : Java.Lang.Object {
2020
}
2121

2222
[Register ("java/code/IMyInterface", DoNotGenerateAcw=true)]
23-
[global::System.Obsolete ("Use the 'MyInterface' type. This type will be removed in a future release.")]
23+
[global::System.Obsolete ("Use the 'MyInterface' type. This type will be removed in a future release.", error: true)]
2424
public abstract class MyInterfaceConsts : MyInterface {
2525

2626
private MyInterfaceConsts ()

tools/generator/Tests/Unit-Tests/CodeGeneratorExpectedResults/XamarinAndroid/WriteInterface.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public abstract class MyInterface : Java.Lang.Object {
2222
}
2323

2424
[Register ("java/code/IMyInterface", DoNotGenerateAcw=true)]
25-
[global::System.Obsolete ("Use the 'MyInterface' type. This type will be removed in a future release.")]
25+
[global::System.Obsolete ("Use the 'MyInterface' type. This type will be removed in a future release.", error: true)]
2626
public abstract class MyInterfaceConsts : MyInterface {
2727

2828
private MyInterfaceConsts ()

tools/generator/Tests/expected.ji/TestInterface/Test.ME.ITestInterface.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ internal TestInterface ()
3232
}
3333

3434
[Register ("test/me/TestInterface", DoNotGenerateAcw=true)]
35-
[global::System.Obsolete ("Use the 'TestInterface' type. This type will be removed in a future release.")]
35+
[global::System.Obsolete ("Use the 'TestInterface' type. This type will be removed in a future release.", error: true)]
3636
public abstract class TestInterfaceConsts : TestInterface {
3737

3838
private TestInterfaceConsts ()

tools/generator/Tests/expected/TestInterface/Test.ME.ITestInterface.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ internal TestInterface ()
3232
}
3333

3434
[Register ("test/me/TestInterface", DoNotGenerateAcw=true)]
35-
[global::System.Obsolete ("Use the 'TestInterface' type. This type will be removed in a future release.")]
35+
[global::System.Obsolete ("Use the 'TestInterface' type. This type will be removed in a future release.", error: true)]
3636
public abstract class TestInterfaceConsts : TestInterface {
3737

3838
private TestInterfaceConsts ()

0 commit comments

Comments
 (0)