Skip to content

Commit

Permalink
Update template to add management of abstract classes
Browse files Browse the repository at this point in the history
  • Loading branch information
masesdevelopers committed Jan 17, 2024
1 parent e311cda commit 706ca68
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/net/JNetReflector/InternalMethods.cs
Original file line number Diff line number Diff line change
Expand Up @@ -628,7 +628,7 @@ static void PrepareSingleClass(this Class jClass, IEnumerable<Class> classDefini
bool isClassInterface = jClass.IsInterface();
bool isClassStatic = jClass.IsStatic();

if (isClassInterface) stubClass = Template.GetTemplate(Template.AllPackageClassesStubClassInterfaceTemplate);
if (isClassInterface || isClassAbstract) stubClass = Template.GetTemplate(Template.AllPackageClassesStubClassInterfaceOrAbstractTemplate);

string template = jClassIsListener ? stubListener : stubClass;
bool isMainClass = false;
Expand Down
4 changes: 2 additions & 2 deletions src/net/JNetReflector/JNetReflector.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
<None Remove="AllPackageClassesStubClass.template" />
<None Remove="AllPackageClassesStubNestedClass.template" />
<None Remove="SingleClass.template" />
<None Remove="Templates\AllPackageClassesStubClassInterface.template" />
<None Remove="Templates\AllPackageClassesStubClassInterfaceOrAbstract.template" />
<None Remove="Templates\AllPackageClassesStubClassListener.template" />
<None Remove="Templates\AllPackageClassesStubClassMainClass.template" />
<None Remove="Templates\AllPackageClassesStubException.template" />
Expand Down Expand Up @@ -129,7 +129,7 @@
<Compile Include="..\JNet\Specific\AsyncEnumerable.cs" Link="Specific\AsyncEnumerable.cs" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Templates\AllPackageClassesStubClassInterface.template" />
<EmbeddedResource Include="Templates\AllPackageClassesStubClassInterfaceOrAbstract.template" />
<EmbeddedResource Include="Templates\AllPackageClassesStubClassMainClass.template" />
<EmbeddedResource Include="Templates\AllPackageClassesStubClassListener.template" />
<EmbeddedResource Include="Templates\AllPackageClassesStubException.template" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,13 @@ public partial class ALLPACKAGE_CLASSES_STUB_CLASS_PLACEHOLDER : ALLPACKAGE_CLAS
/// <summary>
/// Default constructor: even if the corresponding Java class does not have one, it is mandatory for JCOBridge
/// </summary>
[System.Obsolete("ALLPACKAGE_CLASSES_STUB_SIMPLECLASS_PLACEHOLDER class represents in .NET an instance of a JVM interface. The public initializer is needed for JCOBridge internal use, other uses can produce unidentible behaviors.")]
[System.Obsolete("ALLPACKAGE_CLASSES_STUB_SIMPLECLASS_PLACEHOLDER class represents, in .NET, an instance of a JVM interface or abstract class. This public initializer is needed for JCOBridge internal use, other uses can produce unidentible behaviors.")]
public ALLPACKAGE_CLASSES_STUB_SIMPLECLASS_PLACEHOLDER() { }
/// <summary>
/// Generic constructor: it is useful for JCOBridge when there is a derived class which needs to pass arguments to the highest JVMBridgeBase class
/// </summary>
[System.Obsolete("ALLPACKAGE_CLASSES_STUB_SIMPLECLASS_PLACEHOLDER class represents, in .NET, an instance of a JVM interface or abstract class. This public initializer is needed for JCOBridge internal use, other uses can produce unidentible behaviors.")]
public ALLPACKAGE_CLASSES_STUB_SIMPLECLASS_PLACEHOLDER(params object[] args) : base(args) { }

private static readonly IJavaType LocalBridgeClazz = ClazzOf(_bridgeClassName);

Expand Down
4 changes: 2 additions & 2 deletions src/net/JNetReflector/Templates/Templates.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public class Template
{
AllPackageClassesTemplate,
AllPackageClassesStubClassTemplate,
AllPackageClassesStubClassInterfaceTemplate,
AllPackageClassesStubClassInterfaceOrAbstractTemplate,
AllPackageClassesStubClassListenerTemplate,
AllPackageClassesStubClassMainClassTemplate,
AllPackageClassesStubExceptionTemplate,
Expand Down Expand Up @@ -79,7 +79,7 @@ public static string GetTemplate(string templateName)

public const string AllPackageClassesTemplate = "AllPackageClasses.template";
public const string AllPackageClassesStubClassTemplate = "AllPackageClassesStubClass.template";
public const string AllPackageClassesStubClassInterfaceTemplate = "AllPackageClassesStubClassInterface.template";
public const string AllPackageClassesStubClassInterfaceOrAbstractTemplate = "AllPackageClassesStubClassInterfaceOrAbstract.template";
public const string AllPackageClassesStubClassListenerTemplate = "AllPackageClassesStubClassListener.template";
public const string AllPackageClassesStubClassMainClassTemplate = "AllPackageClassesStubClassMainClass.template";
public const string AllPackageClassesStubExceptionTemplate = "AllPackageClassesStubException.template";
Expand Down

0 comments on commit 706ca68

Please sign in to comment.