Skip to content

Commit

Permalink
Review class generation to avoid the file AllPackageClasses.cs in eac…
Browse files Browse the repository at this point in the history
…h namespace (masesgroup#520)

* Most exceptions and errors in java.lang will be reflected

* Changes by GitHub action (masesgroup#517)

* Update generated classes after commit ffb10bc

* Project update

---------

Co-authored-by: masesdevelopers <94312179+masesdevelopers@users.noreply.github.com>

* Moved files to accomplish the JNetCore

* Update workflows

* Update

* Artifact update

* Update generation

* Update to generate PRs in any case

* Update generated classes after commit bfa59c9 (#1)

Co-authored-by: masesdevelopers <94312179+masesdevelopers@users.noreply.github.com>

* Moves class definition in the same file of class implementation trying to avoid the AllPackageClasses.cs

* Update generated classes after commit a3ab3a6 (#2)

Co-authored-by: masesdevelopers <94312179+masesdevelopers@users.noreply.github.com>

* Remove extra files

* Update code generation

* Update generated classes after commit 0a732e7 (#3)

Co-authored-by: masesdevelopers <94312179+masesdevelopers@users.noreply.github.com>

* Update templates

* Update generated classes after commit 7aa9f2e (#4)

Co-authored-by: masesdevelopers <94312179+masesdevelopers@users.noreply.github.com>

* Update generated classes after commit a7871a3 (#5)

Co-authored-by: masesdevelopers <94312179+masesdevelopers@users.noreply.github.com>

* Return back to single JAR

* Cleanup

* Class name alignment to JNetReflector one for nested classes

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
  • Loading branch information
masesdevelopers and github-actions[bot] authored Sep 4, 2024
1 parent f35bfd1 commit 2b20dfe
Show file tree
Hide file tree
Showing 3,538 changed files with 178,943 additions and 184,347 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
2 changes: 1 addition & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ jobs:
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} # Value of the GPG private key to import
gpg-passphrase: MAVEN_GPG_PASSPHRASE # env variable for GPG private key passphrase

- name: Create Jars
- name: Create Jars for JNet
run: mvn --file ./src/jvm/jnet/pom.xml --no-transfer-progress package
env:
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} # Value of the GPG private key to import
gpg-passphrase: MAVEN_GPG_PASSPHRASE # env variable for GPG private key passphrase

- name: Create Jars
- name: Create Jars for JNet
run: mvn --file ./src/jvm/jnet/pom.xml --no-transfer-progress package
env:
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
Expand Down
10 changes: 6 additions & 4 deletions .github/workflows/generateclasses.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} # Value of the GPG private key to import
gpg-passphrase: MAVEN_GPG_PASSPHRASE # env variable for GPG private key passphrase

- name: Create Jars
- name: Create Jars for JNet
run: mvn "-Djcobridgepath=../../../binReflector/net8.0/JCOBridge.jar" --file ./src/jvm/jnet/pom.xml --no-transfer-progress package
env:
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
Expand All @@ -58,7 +58,9 @@ jobs:
run: Remove-Item .\src\net\JNet\Generated\* -Recurse -Force -Exclude README.md

- name: Clear Java generated files
run: Remove-Item .\src\jvm\jnet\src\main\java\org\mases\jnet\generated\* -Recurse -Force -Exclude README.md
run: |
Remove-Item .\src\jvm\jnetcore\src\main\java\org\mases\jnet\generated\* -Recurse -Force -Exclude README.md
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 All @@ -75,13 +77,13 @@ jobs:
run: dotnet build --no-incremental --configuration Release /p:Platform="Any CPU" /p:NoWarn="0108%3B1030%3B0618" src\net\JNet.sln

- name: Extract commit SHA
if: ${{ github.repository_owner == 'masesgroup' && inputs.GeneratePR == true }}
if: ${{ inputs.GeneratePR == true }}
run: |
echo "GITHUB_COMMIT_MESSAGE=$(echo $GITHUB_SHA | cut -c 1-7)" >> $GITHUB_ENV
shell: bash

- name: Request a PR to commit changes
if: ${{ github.repository_owner == 'masesgroup' && inputs.GeneratePR == true }} #do not push any changes outside main repo or GeneratePR is false
if: ${{ inputs.GeneratePR == true }}
uses: peter-evans/create-pull-request@v6
with:
branch-suffix: short-commit-hash
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/pullrequest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ jobs:
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} # Value of the GPG private key to import
gpg-passphrase: MAVEN_GPG_PASSPHRASE # env variable for GPG private key passphrase

- name: Create Jars
- name: Create Jars for JNet
run: mvn --file ./src/jvm/jnet/pom.xml --no-transfer-progress package
env:
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
Expand Down Expand Up @@ -139,7 +139,7 @@ jobs:
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} # Value of the GPG private key to import
gpg-passphrase: MAVEN_GPG_PASSPHRASE # env variable for GPG private key passphrase

- name: Create Jars
- name: Create Jars for JNet
run: mvn --file ./src/jvm/jnet/pom.xml --no-transfer-progress package
env:
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} # Value of the GPG private key to import
gpg-passphrase: MAVEN_GPG_PASSPHRASE # env variable for GPG private key passphrase

- name: Create Jars
- name: Create Jars for JNet
run: mvn --file ./src/jvm/jnet/pom.xml --no-transfer-progress package
env:
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@
import org.mases.jcobridge.JCObject;

/**
* The {@link UncaughtExceptionHandler} class represents a generic implementation of
* The {@link Thread_UncaughtExceptionHandler} class represents a generic implementation of
* {@link Thread.UncaughtExceptionHandler}
*/
public class UncaughtExceptionHandler extends JCListener implements Thread.UncaughtExceptionHandler {
public UncaughtExceptionHandler(String key) throws JCNativeException {
public class Thread_UncaughtExceptionHandler extends JCListener implements Thread.UncaughtExceptionHandler {
public Thread_UncaughtExceptionHandler(String key) throws JCNativeException {
super(key);
}

Expand Down
3 changes: 3 additions & 0 deletions src/jvm/jnet/src/main/java/org/mases/jnet/generated/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## Java Generated classes

This folder contains the Java classes generated using JNetReflector at the same version of JNet.
2 changes: 1 addition & 1 deletion src/net/JNet/Developed/Java/Lang/Reflect/WildcardType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,5 @@ public partial class WildcardType
{

#endif
}
}
}
2 changes: 1 addition & 1 deletion src/net/JNet/Developed/Java/Lang/Thread.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public class UncaughtExceptionHandler : JVMBridgeListener
/// <summary>
/// <see href="https://www.jcobridge.com/api-clr/html/P_MASES_JCOBridge_C2JBridge_JVMBridgeListener_BridgeClassName.htm"/>
/// </summary>
public override string BridgeClassName => "org.mases.jnet.developed.java.lang.UncaughtExceptionHandler";
public override string BridgeClassName => "org.mases.jnet.developed.java.lang.Thread_UncaughtExceptionHandler";

/// <summary>
/// The <see cref="Action{Thread, JVMBridgeException}"/> to be executed
Expand Down
30 changes: 0 additions & 30 deletions src/net/JNet/Generated/Java/Applet/AllPackageClasses.cs

This file was deleted.

19 changes: 18 additions & 1 deletion src/net/JNet/Generated/Java/Awt/AWTError.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,24 @@

namespace Java.Awt
{
#region AWTError
#region AWTError declaration
/// <summary>
/// <see href="https://docs.oracle.com/en/java/javase/11/docs/api/java.desktop/java/awt/AWTError.html"/>
/// </summary>
public partial class AWTError : Java.Lang.Error
{
const string _bridgeClassName = "java.awt.AWTError";
/// <summary>
/// <see href="https://www.jcobridge.com/api-clr/html/P_MASES_JCOBridge_C2JBridge_JVMBridgeException_BridgeClassName.htm"/>
/// </summary>
public override string BridgeClassName => _bridgeClassName;

// TODO: complete the class

}
#endregion

#region AWTError implementation
public partial class AWTError
{
#region Constructors
Expand Down
49 changes: 48 additions & 1 deletion src/net/JNet/Generated/Java/Awt/AWTEvent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,54 @@

namespace Java.Awt
{
#region AWTEvent
#region AWTEvent declaration
/// <summary>
/// <see href="https://docs.oracle.com/en/java/javase/11/docs/api/java.desktop/java/awt/AWTEvent.html"/>
/// </summary>
public partial class AWTEvent : Java.Util.EventObject
{
const string _bridgeClassName = "java.awt.AWTEvent";
/// <summary>
/// Default constructor: even if the corresponding Java class does not have one, it is mandatory for JCOBridge
/// </summary>
[global::System.Obsolete("AWTEvent 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 AWTEvent() { }
/// <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>
[global::System.Obsolete("AWTEvent 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 AWTEvent(params object[] args) : base(args) { }

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

/// <summary>
/// <see href="https://www.jcobridge.com/api-clr/html/P_MASES_JCOBridge_C2JBridge_JVMBridgeBase_BridgeClassName.htm"/>
/// </summary>
public override string BridgeClassName => _bridgeClassName;
/// <summary>
/// <see href="https://www.jcobridge.com/api-clr/html/P_MASES_JCOBridge_C2JBridge_JVMBridgeBase_IsBridgeAbstract.htm"/>
/// </summary>
public override bool IsBridgeAbstract => true;
/// <summary>
/// <see href="https://www.jcobridge.com/api-clr/html/P_MASES_JCOBridge_C2JBridge_JVMBridgeBase_IsBridgeCloseable.htm"/>
/// </summary>
public override bool IsBridgeCloseable => false;
/// <summary>
/// <see href="https://www.jcobridge.com/api-clr/html/P_MASES_JCOBridge_C2JBridge_JVMBridgeBase_IsBridgeInterface.htm"/>
/// </summary>
public override bool IsBridgeInterface => false;
/// <summary>
/// <see href="https://www.jcobridge.com/api-clr/html/P_MASES_JCOBridge_C2JBridge_JVMBridgeBase_IsBridgeStatic.htm"/>
/// </summary>
public override bool IsBridgeStatic => false;

// TODO: complete the class

}
#endregion

#region AWTEvent implementation
public partial class AWTEvent
{
#region Constructors
Expand Down
47 changes: 46 additions & 1 deletion src/net/JNet/Generated/Java/Awt/AWTEventMulticaster.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,52 @@

namespace Java.Awt
{
#region AWTEventMulticaster
#region AWTEventMulticaster declaration
/// <summary>
/// <see href="https://docs.oracle.com/en/java/javase/11/docs/api/java.desktop/java/awt/AWTEventMulticaster.html"/>
/// </summary>
public partial class AWTEventMulticaster : MASES.JCOBridge.C2JBridge.JVMBridgeBase<AWTEventMulticaster>
{
const string _bridgeClassName = "java.awt.AWTEventMulticaster";
/// <summary>
/// Default constructor: even if the corresponding Java class does not have one, it is mandatory for JCOBridge
/// </summary>
public AWTEventMulticaster() { }
/// <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 AWTEventMulticaster(params object[] args) : base(args) { }

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

/// <summary>
/// <see href="https://www.jcobridge.com/api-clr/html/P_MASES_JCOBridge_C2JBridge_JVMBridgeBase_BridgeClassName.htm"/>
/// </summary>
public override string BridgeClassName => _bridgeClassName;
/// <summary>
/// <see href="https://www.jcobridge.com/api-clr/html/P_MASES_JCOBridge_C2JBridge_JVMBridgeBase_IsBridgeAbstract.htm"/>
/// </summary>
public override bool IsBridgeAbstract => false;
/// <summary>
/// <see href="https://www.jcobridge.com/api-clr/html/P_MASES_JCOBridge_C2JBridge_JVMBridgeBase_IsBridgeCloseable.htm"/>
/// </summary>
public override bool IsBridgeCloseable => false;
/// <summary>
/// <see href="https://www.jcobridge.com/api-clr/html/P_MASES_JCOBridge_C2JBridge_JVMBridgeBase_IsBridgeInterface.htm"/>
/// </summary>
public override bool IsBridgeInterface => false;
/// <summary>
/// <see href="https://www.jcobridge.com/api-clr/html/P_MASES_JCOBridge_C2JBridge_JVMBridgeBase_IsBridgeStatic.htm"/>
/// </summary>
public override bool IsBridgeStatic => false;

// TODO: complete the class

}
#endregion

#region AWTEventMulticaster implementation
public partial class AWTEventMulticaster
{
#region Constructors
Expand Down
19 changes: 18 additions & 1 deletion src/net/JNet/Generated/Java/Awt/AWTException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,24 @@

namespace Java.Awt
{
#region AWTException
#region AWTException declaration
/// <summary>
/// <see href="https://docs.oracle.com/en/java/javase/11/docs/api/java.desktop/java/awt/AWTException.html"/>
/// </summary>
public partial class AWTException : Java.Lang.Exception
{
const string _bridgeClassName = "java.awt.AWTException";
/// <summary>
/// <see href="https://www.jcobridge.com/api-clr/html/P_MASES_JCOBridge_C2JBridge_JVMBridgeException_BridgeClassName.htm"/>
/// </summary>
public override string BridgeClassName => _bridgeClassName;

// TODO: complete the class

}
#endregion

#region AWTException implementation
public partial class AWTException
{
#region Constructors
Expand Down
47 changes: 46 additions & 1 deletion src/net/JNet/Generated/Java/Awt/AWTKeyStroke.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,52 @@

namespace Java.Awt
{
#region AWTKeyStroke
#region AWTKeyStroke declaration
/// <summary>
/// <see href="https://docs.oracle.com/en/java/javase/11/docs/api/java.desktop/java/awt/AWTKeyStroke.html"/>
/// </summary>
public partial class AWTKeyStroke : Java.Io.Serializable
{
const string _bridgeClassName = "java.awt.AWTKeyStroke";
/// <summary>
/// Default constructor: even if the corresponding Java class does not have one, it is mandatory for JCOBridge
/// </summary>
public AWTKeyStroke() { }
/// <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 AWTKeyStroke(params object[] args) : base(args) { }

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

/// <summary>
/// <see href="https://www.jcobridge.com/api-clr/html/P_MASES_JCOBridge_C2JBridge_JVMBridgeBase_BridgeClassName.htm"/>
/// </summary>
public override string BridgeClassName => _bridgeClassName;
/// <summary>
/// <see href="https://www.jcobridge.com/api-clr/html/P_MASES_JCOBridge_C2JBridge_JVMBridgeBase_IsBridgeAbstract.htm"/>
/// </summary>
public override bool IsBridgeAbstract => false;
/// <summary>
/// <see href="https://www.jcobridge.com/api-clr/html/P_MASES_JCOBridge_C2JBridge_JVMBridgeBase_IsBridgeCloseable.htm"/>
/// </summary>
public override bool IsBridgeCloseable => false;
/// <summary>
/// <see href="https://www.jcobridge.com/api-clr/html/P_MASES_JCOBridge_C2JBridge_JVMBridgeBase_IsBridgeInterface.htm"/>
/// </summary>
public override bool IsBridgeInterface => false;
/// <summary>
/// <see href="https://www.jcobridge.com/api-clr/html/P_MASES_JCOBridge_C2JBridge_JVMBridgeBase_IsBridgeStatic.htm"/>
/// </summary>
public override bool IsBridgeStatic => false;

// TODO: complete the class

}
#endregion

#region AWTKeyStroke implementation
public partial class AWTKeyStroke
{
#region Constructors
Expand Down
Loading

0 comments on commit 2b20dfe

Please sign in to comment.