Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -151,13 +151,13 @@ jobs:
ExecuteOnMoreOSes: ${{ inputs.ExecuteOnMoreOSes || github.event_name == 'schedule' }}
ExecuteOnLargerJDKSet: ${{ inputs.ExecuteOnLargerJDKSet || github.ref_name == 'master' || github.event_name == 'schedule' }}
EnableLinuxTests: true
EnableWindowsTests: ${{ inputs.ExecuteOnWindows || github.ref_name == 'master' || github.event_name == 'schedule' }}
EnableMacOSTests: ${{ inputs.ExecuteOnMacOS || github.event_name == 'schedule' }}
EnableWindowsTests: ${{ inputs.EnableWindowsTests || github.ref_name == 'master' || github.event_name == 'schedule' }}
EnableMacOSTests: ${{ inputs.EnableMacOSTests || github.event_name == 'schedule' }}
ForceContinueOnError: ${{ inputs.ForceContinueOnError || false }}
EnableProcessDump: ${{ inputs.EnableProcessDump || '0' }}
ProcessDumpType: ${{ inputs.ProcessDumpType || '3' }}
EnableVerboseDiagnosticProcessDump: ${{ inputs.EnableVerboseDiagnosticProcessDump || '0' }}
secrets:
actor: ${{ github.actor }}
GITHUB_TOKEN_INHERITED: ${{ secrets.GITHUB_TOKEN }}
JCOBRIDGE_ENCODED: ${{ secrets.JCOBRIDGE_ENCODED_2_6_6 }}
JCOBRIDGE_ENCODED: ${{ secrets.JCOBRIDGE_ENCODED_2_6_7 }}
6 changes: 3 additions & 3 deletions .github/workflows/generateclasses.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
DOTNET_CreateDumpDiagnostics: 1
DOTNET_CreateDumpVerboseDiagnostics: 1
DOTNET_EnableCrashReport: 1
JCOBRIDGE_LicensePath: ${{ secrets.JCOBRIDGE_ENCODED_2_6_6 }}
JCOBRIDGE_LicensePath: ${{ secrets.JCOBRIDGE_ENCODED_2_6_7 }}

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
Expand Down Expand Up @@ -54,10 +54,10 @@ jobs:
run: mvn "-DbinFolderName=binReflector" --file ./src/jvm/jnetreflector/pom.xml --no-transfer-progress package

- name: Clear C# generated files
run: Remove-Item .\src\net\JNet\Generated\* -Recurse -Force -Exclude README.md
run: Remove-Item .\src\net\JNet\Generated\* -Recurse -Force -Exclude README.md,.editorconfig

- name: Clear Java generated files
run: Remove-Item .\src\jvm\jnet\src\main\java\org\mases\jnet\generated\* -Recurse -Force -Exclude README.md,.editorconfig
run: Remove-Item .\src\jvm\jnet\src\main\java\org\mases\jnet\generated\* -Recurse -Force -Exclude README.md

- run: dotnet build --no-incremental --configuration Release src\net\JNetReflector\JNetReflector.csproj

Expand Down
4 changes: 4 additions & 0 deletions src/net/JNet/Developed/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[*.cs]
generated_code = true
dotnet_analyzer_diagnostic.severity = none
dotnet_diagnostic.CS0108.severity = none
2 changes: 1 addition & 1 deletion src/net/JNet/JNet.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="MASES.CLIParser" Version="3.2.1" />
<PackageReference Include="MASES.JCOBridge" Version="2.6.6">
<PackageReference Include="MASES.JCOBridge" Version="2.6.7-beta6">
<IncludeAssets>All</IncludeAssets>
<PrivateAssets>None</PrivateAssets>
</PackageReference>
Expand Down
2 changes: 1 addition & 1 deletion src/net/JNet/Specific/AsyncEnumerable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public ValueTask<bool> MoveNextAsync()
/// <typeparam name="TClass">The class implementing <see cref="IJVMBridgeBase"/></typeparam>
/// <typeparam name="TObject">The type of objects to enumerate implementing <see cref="IJVMBridgeBase"/></typeparam>
public abstract class JNetAsyncEnumerable<TClass, TObject> : JVMBridgeBaseEnumerable<TClass, TObject>, IAsyncEnumerable<TObject>
where TClass : JVMBridgeBase
where TClass : class, IJVMBridgeBase
{
/// <summary>
/// Create an instance of <see cref="JNetAsyncEnumerable{TClass, TObject}"/>
Expand Down
15 changes: 9 additions & 6 deletions src/net/JNetReflector/InternalExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1421,7 +1421,7 @@ public static bool HasJVMBaseClassName(this Class entry, bool usedInGenerics, bo
}
}

public static string JVMBaseClassName(this Class entry, bool usedInGenerics, bool isListener, bool camel, out bool baseClassIsJVMBridgeBase)
public static string JVMBaseClassName(this Class entry, bool isClassCloseable, bool usedInGenerics, bool isListener, bool camel, out bool baseClassIsJVMBridgeBase)
{
baseClassIsJVMBridgeBase = false;
if (isListener)
Expand All @@ -1436,7 +1436,8 @@ public static string JVMBaseClassName(this Class entry, bool usedInGenerics, boo
{
baseClassIsJVMBridgeBase = true;
string className = entry.JVMClassName(null, usedInGenerics, false);
return string.Format("MASES.JCOBridge.C2JBridge.JVMBridgeBase<{0}>", className);
return isClassCloseable ? $"MASES.JCOBridge.C2JBridge.JVMBridgeBase<{className}>"
: $"MASES.JCOBridge.C2JBridge.JVMBridgeBaseCore<{className}>";
}
try
{
Expand Down Expand Up @@ -1513,7 +1514,8 @@ public static string JVMBaseClassName(this Class entry, bool usedInGenerics, boo
{
baseClassIsJVMBridgeBase = true;
string innerName = entry.JVMClassName(null, usedInGenerics, false);
return string.Format("MASES.JCOBridge.C2JBridge.JVMBridgeBase<{0}>", innerName);
return isClassCloseable ? $"MASES.JCOBridge.C2JBridge.JVMBridgeBase<{innerName}>"
: $"MASES.JCOBridge.C2JBridge.JVMBridgeBaseCore<{innerName}>";
}
}
else if ((usedInGenerics || !entry.IsJVMGenericClass()) && superCls.IsJVMGenericClass())
Expand All @@ -1526,15 +1528,16 @@ public static string JVMBaseClassName(this Class entry, bool usedInGenerics, boo
{
baseClassIsJVMBridgeBase = true;
string className = entry.JVMClassName(null, usedInGenerics, false);
return string.Format("MASES.JCOBridge.C2JBridge.JVMBridgeBase<{0}>", className);
return isClassCloseable ? $"MASES.JCOBridge.C2JBridge.JVMBridgeBase<{className}>"
: $"MASES.JCOBridge.C2JBridge.JVMBridgeBaseCore<{className}>";
}
}

public static string JVMBaseInterfaceName(this Class entry, bool usedInGenerics, bool isListener, bool camel)
public static string JVMBaseInterfaceName(this Class entry, bool isClassCloseable, bool usedInGenerics, bool isListener, bool camel)
{
if (!entry.HasJVMBaseClassName(usedInGenerics, isListener, camel)) return string.Empty;

var fName = entry.JVMBaseClassName(usedInGenerics, isListener, camel, out _);
var fName = entry.JVMBaseClassName(isClassCloseable, usedInGenerics, isListener, camel, out _);
return ToFullQualifiedInterfaceName(fName, camel);
}

Expand Down
8 changes: 4 additions & 4 deletions src/net/JNetReflector/InternalMethods.cs
Original file line number Diff line number Diff line change
Expand Up @@ -766,7 +766,7 @@ static void PrepareSingleClass(this Class jClass, IEnumerable<Class> classDefini
.Replace(AllPackageClasses.ClassStub.SIMPLECLASS, jClass.JVMClassName(null, false, false))
.Replace(AllPackageClasses.ClassStub.CLASS, jClass.JVMClassName(null, isGeneric, false))
.Replace(AllPackageClasses.ClassStub.HELP, jClass.JavadocHrefUrl(JNetReflectorCore.UseCamel))
.Replace(AllPackageClasses.ClassStub.BASECLASS, jClass.JVMBaseClassName(isGeneric, false, JNetReflectorCore.UseCamel, out _))
.Replace(AllPackageClasses.ClassStub.BASECLASS, jClass.JVMBaseClassName(isClassCloseable, isGeneric, false, JNetReflectorCore.UseCamel, out _))
.Replace(AllPackageClasses.ClassStub.WHERECLAUSES, string.Empty);
}
else
Expand All @@ -779,7 +779,7 @@ static void PrepareSingleClass(this Class jClass, IEnumerable<Class> classDefini
.Replace(AllPackageClasses.ClassStub.CLASS, jClass.JVMClassName(new List<KeyValuePair<string, string>>(), isGeneric, false))
.Replace(AllPackageClasses.ClassStub.CLASS_DIRECT, jClass.JVMClassName(new List<KeyValuePair<string, string>>(), isGeneric, true))
.Replace(AllPackageClasses.ClassStub.HELP, jClass.JavadocHrefUrl(JNetReflectorCore.UseCamel))
.Replace(AllPackageClasses.ClassStub.BASECLASS, jClass.JVMBaseClassName(isGeneric, jClassIsListener, JNetReflectorCore.UseCamel, out bool baseClassIsJVMBridgeBase) + (isMainClass ? SpecialNames.MainClassPlaceHolder : string.Empty))
.Replace(AllPackageClasses.ClassStub.BASECLASS, jClass.JVMBaseClassName(isClassCloseable, isGeneric, jClassIsListener, JNetReflectorCore.UseCamel, out bool baseClassIsJVMBridgeBase) + (isMainClass ? SpecialNames.MainClassPlaceHolder : string.Empty))
.Replace(AllPackageClasses.ClassStub.WHERECLAUSES, jClass.WhereClauses(isGeneric, JNetReflectorCore.UseCamel))
.Replace(AllPackageClasses.ClassStub.ISABSTRACT, isClassAbstract ? "true" : "false")
.Replace(AllPackageClasses.ClassStub.ISCLOSEABLE, isClassCloseable ? "true" : "false")
Expand All @@ -796,6 +796,7 @@ static void PrepareSingleClass(this Class jClass, IEnumerable<Class> classDefini
}
else
{
constructorClassBlock = jClass.AnalyzeConstructors(classDefinitions, isGeneric, true, baseClassIsJVMBridgeBase).AddTabLevel(1);
if (jClass.IsJVMClassWithCallbacks())
{
operatorClassBlock = jClass.AnalyzeOperators(classDefinitions, isGeneric, true).AddTabLevel(1);
Expand All @@ -818,7 +819,7 @@ static void PrepareSingleClass(this Class jClass, IEnumerable<Class> classDefini
singleInterfaceStr = string.Empty;
if (createInterfaceData)
{
string baseInterface = jClass.JVMBaseInterfaceName(isGeneric, jClassIsListener, JNetReflectorCore.UseCamel);
string baseInterface = jClass.JVMBaseInterfaceName(isClassCloseable, isGeneric, jClassIsListener, JNetReflectorCore.UseCamel);
if (!string.IsNullOrWhiteSpace(baseInterface))
{
baseInterface = " : " + baseInterface;
Expand Down Expand Up @@ -949,7 +950,6 @@ static string AnalyzeConstructors(this Class classDefinition, IEnumerable<Class>
var paramCount = constructor.ParameterCount;
var methodNameOrigin = constructor.Name;

if (paramCount == 0) continue; // default constructor managed from AllClasses template as default for any JCOBridge reflected class
bool isDeprecated = constructor.IsDeprecated();
if (!JNetReflectorCore.ReflectDeprecated && isDeprecated)
{
Expand Down
2 changes: 1 addition & 1 deletion src/net/JNetReflector/JNetReflector.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="MASES.CLIParser" Version="3.2.1" />
<PackageReference Include="MASES.JCOBridge" Version="2.6.6">
<PackageReference Include="MASES.JCOBridge" Version="2.6.7-beta6">
<IncludeAssets>All</IncludeAssets>
<PrivateAssets>None</PrivateAssets>
</PackageReference>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@ public partial class ALLPACKAGE_CLASSES_STUB_CLASS_PLACEHOLDER : ALLPACKAGE_CLAS
{
const string _bridgeClassName = "ALLPACKAGE_CLASSES_STUB_JAVACLASS_PLACEHOLDER";
/// <summary>
/// Default constructor: even if the corresponding Java class does not have one, it is mandatory for JCOBridge
/// </summary>
public ALLPACKAGE_CLASSES_STUB_SIMPLECLASS_PLACEHOLDER() { }
/// <summary>
/// Internal constructor: used internally from JCOBridge
/// </summary>
[global::System.Obsolete("This public initializer is needed for JCOBridge internal use, other uses can produce unidentible behaviors.")]
Expand All @@ -18,7 +14,7 @@ public partial class ALLPACKAGE_CLASSES_STUB_CLASS_PLACEHOLDER : ALLPACKAGE_CLAS
public ALLPACKAGE_CLASSES_STUB_SIMPLECLASS_PLACEHOLDER(params object[] args) : base(args) { }

private static readonly global::System.Exception _LocalBridgeClazzException = null;
private static readonly MASES.JCOBridge.C2JBridge.JVMInterop.IJavaType _LocalBridgeClazz = JVMBridgeBase.ClazzOf(_bridgeClassName, out _LocalBridgeClazzException, false);
private static readonly MASES.JCOBridge.C2JBridge.JVMInterop.IJavaType _LocalBridgeClazz = JVMBridgeBaseCore.ClazzOf(_bridgeClassName, out _LocalBridgeClazzException, false);
private static MASES.JCOBridge.C2JBridge.JVMInterop.IJavaType LocalBridgeClazz => _LocalBridgeClazz ?? throw _LocalBridgeClazzException ?? new global::System.InvalidOperationException($"Class {_bridgeClassName} was not found.");

/// <inheritdoc/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,6 @@ public partial class ALLPACKAGE_CLASSES_STUB_CLASS_PLACEHOLDER : ALLPACKAGE_CLAS
{
const string _bridgeClassName = "ALLPACKAGE_CLASSES_STUB_JAVACLASS_PLACEHOLDER";
/// <summary>
/// Default constructor: even if the corresponding Java class does not have one, it is mandatory for JCOBridge
/// </summary>
[global::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>
/// Internal constructor: used internally from JCOBridge
/// </summary>
[global::System.Obsolete("This public initializer is needed for JCOBridge internal use, other uses can produce unidentible behaviors.")]
Expand All @@ -20,7 +15,7 @@ public partial class ALLPACKAGE_CLASSES_STUB_CLASS_PLACEHOLDER : ALLPACKAGE_CLAS
public ALLPACKAGE_CLASSES_STUB_SIMPLECLASS_PLACEHOLDER(params object[] args) : base(args) { }

private static readonly global::System.Exception _LocalBridgeClazzException = null;
private static readonly MASES.JCOBridge.C2JBridge.JVMInterop.IJavaType _LocalBridgeClazz = JVMBridgeBase.ClazzOf(_bridgeClassName, out _LocalBridgeClazzException, false);
private static readonly MASES.JCOBridge.C2JBridge.JVMInterop.IJavaType _LocalBridgeClazz = JVMBridgeBaseCore.ClazzOf(_bridgeClassName, out _LocalBridgeClazzException, false);
private static MASES.JCOBridge.C2JBridge.JVMInterop.IJavaType LocalBridgeClazz => _LocalBridgeClazz ?? throw _LocalBridgeClazzException ?? new global::System.InvalidOperationException($"Class {_bridgeClassName} was not found.");

/// <inheritdoc/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@
ALLPACKAGE_CLASSES_STUB_CLASS_DECORATION_PLACEHOLDER
public partial class ALLPACKAGE_CLASSES_STUB_CLASS_PLACEHOLDER : ALLPACKAGE_CLASSES_STUB_BASECLASS_PLACEHOLDER
{
/// <summary>
/// Default constructor: even if the corresponding Java class does not have one, it is mandatory for JCOBridge
/// </summary>
public ALLPACKAGE_CLASSES_STUB_SIMPLECLASS_PLACEHOLDER() { InitializeHandlers(); }
/// <summary>
/// Internal constructor: used internally from JCOBridge
/// </summary>
Expand All @@ -28,15 +24,15 @@ ALLPACKAGE_CLASSES_STUB_LISTENER_CLASS_PLACEHOLDER
/// </summary>
public partial class ALLPACKAGE_CLASSES_STUB_CLASS_DIRECT_PLACEHOLDER : ALLPACKAGE_CLASSES_STUB_CLASS_PLACEHOLDER
{
/// <summary>
/// Default constructor: even if the corresponding Java class does not have one, it is mandatory for JCOBridge
/// </summary>
public ALLPACKAGE_CLASSES_STUB_SIMPLECLASS_PLACEHOLDERDirect() { }
/// <summary>
/// Internal constructor: used internally from JCOBridge
/// </summary>
[global::System.Obsolete("This public initializer is needed for JCOBridge internal use, other uses can produce unidentible behaviors.")]
public ALLPACKAGE_CLASSES_STUB_SIMPLECLASS_PLACEHOLDERDirect(IJVMBridgeBaseInitializer initializer) : base(initializer) { }
/// <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>
public ALLPACKAGE_CLASSES_STUB_SIMPLECLASS_PLACEHOLDERDirect(params object[] args) : base(args) { }

/// <inheritdoc/>
public override bool AutoInit => false;
Expand All @@ -46,7 +42,7 @@ public partial class ALLPACKAGE_CLASSES_STUB_CLASS_DIRECT_PLACEHOLDER : ALLPACKA

const string _bridgeClassName = "ALLPACKAGE_CLASSES_STUB_JAVACLASS_DIRECT_PLACEHOLDER";
private static readonly global::System.Exception _LocalBridgeClazzException = null;
private static readonly MASES.JCOBridge.C2JBridge.JVMInterop.IJavaType _LocalBridgeClazz = JVMBridgeBase.ClazzOf(_bridgeClassName, out _LocalBridgeClazzException, false);
private static readonly MASES.JCOBridge.C2JBridge.JVMInterop.IJavaType _LocalBridgeClazz = JVMBridgeBaseCore.ClazzOf(_bridgeClassName, out _LocalBridgeClazzException, false);
private static MASES.JCOBridge.C2JBridge.JVMInterop.IJavaType LocalBridgeClazz => _LocalBridgeClazz ?? throw _LocalBridgeClazzException ?? new global::System.InvalidOperationException($"Class {_bridgeClassName} was not found.");

/// <inheritdoc/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ public partial class ALLPACKAGE_CLASSES_STUB_CLASS_PLACEHOLDER : MASES.JCOBridge
{
const string _bridgeClassName = "ALLPACKAGE_CLASSES_STUB_JAVACLASS_PLACEHOLDER";
/// <summary>
/// Initialize a new <see cref="ALLPACKAGE_CLASSES_STUB_CLASS_PLACEHOLDER"/>
/// </summary>
public ALLPACKAGE_CLASSES_STUB_CLASS_PLACEHOLDER() { }
/// <summary>
/// Internal constructor: used internally from JCOBridge
/// </summary>
[global::System.Obsolete("This public initializer is needed for JCOBridge internal use, other uses can produce unidentible behaviors.")]
public ALLPACKAGE_CLASSES_STUB_CLASS_PLACEHOLDER(IJVMBridgeBaseInitializer initializer) : base(initializer) { }
/// <summary>
/// Initialize a new <see cref="ALLPACKAGE_CLASSES_STUB_CLASS_PLACEHOLDER"/>
/// </summary>
public ALLPACKAGE_CLASSES_STUB_CLASS_PLACEHOLDER(params object[] args) : base(args) { }

/// <inheritdoc/>
public override string BridgeClassName => _bridgeClassName;
Expand Down
2 changes: 1 addition & 1 deletion src/net/JNetReflector/Templates/Templates.cs
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ public class ClassStub

public static string LISTENER_CLASS_BLOCK = " const string _bridgeClassName = \"ALLPACKAGE_CLASSES_STUB_JAVACLASS_PLACEHOLDER\";" + Environment.NewLine
+ " private static readonly global::System.Exception _LocalBridgeClazzException = null;" + Environment.NewLine
+ " private static readonly MASES.JCOBridge.C2JBridge.JVMInterop.IJavaType _LocalBridgeClazz = JVMBridgeBase.ClazzOf(_bridgeClassName, out _LocalBridgeClazzException, false);" + Environment.NewLine
+ " private static readonly MASES.JCOBridge.C2JBridge.JVMInterop.IJavaType _LocalBridgeClazz = JVMBridgeBaseCore.ClazzOf(_bridgeClassName, out _LocalBridgeClazzException, false);" + Environment.NewLine
+ " private static MASES.JCOBridge.C2JBridge.JVMInterop.IJavaType LocalBridgeClazz => _LocalBridgeClazz ?? throw _LocalBridgeClazzException ?? new global::System.InvalidOperationException($\"Class {_bridgeClassName} was not found.\");" + Environment.NewLine
+ " " + Environment.NewLine
+ " /// <inheritdoc />" + Environment.NewLine
Expand Down
Loading