From 9de00eff3e1c9ec1d386ec78260cbefeba0a6965 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9sar=20Rom=C3=A1n?= Date: Sun, 15 Nov 2026 17:19:24 -0800 Subject: [PATCH 1/2] feat: add java.lang.System update package and stubs Source URL --- .github/workflows/pip-compile-upgrade.yml | 12 +- setup.cfg | 4 +- src/java/lang/__init__.py | 147 +++++++++++++++++++++- stubs/pyproject.toml | 2 +- stubs/stubs/java/lang/__init__.pyi | 65 +++++++++- 5 files changed, 219 insertions(+), 11 deletions(-) diff --git a/.github/workflows/pip-compile-upgrade.yml b/.github/workflows/pip-compile-upgrade.yml index 78f24e3..9bfb56d 100644 --- a/.github/workflows/pip-compile-upgrade.yml +++ b/.github/workflows/pip-compile-upgrade.yml @@ -10,7 +10,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - branch: ['8.1', '8.3'] + branch: ['17', '25'] fail-fast: false steps: - name: Checkout repo @@ -19,12 +19,12 @@ jobs: ref: ${{ matrix.branch }} - name: Upgrade package requirements - uses: coatl-dev/actions/pip-compile-upgrade@499c77f2bc6f909d372849058517ca2e39ce16d4 # v7.1.3 + uses: coatl-dev/actions/pip-compile-upgrade@c339f0299e21b3b28b42414e3ea474d33468713c # v7.1.5 with: path: requirements.txt - name: Upgrade stubs requirements - uses: coatl-dev/actions/uv-pip-compile-upgrade@499c77f2bc6f909d372849058517ca2e39ce16d4 # v7.1.3 + uses: coatl-dev/actions/uv-pip-compile-upgrade@c339f0299e21b3b28b42414e3ea474d33468713c # v7.1.5 with: path: requirements.txt python-version: '3.12' @@ -32,13 +32,13 @@ jobs: - name: Detect changes id: git-diff - uses: coatl-dev/actions/simple-git-diff@499c77f2bc6f909d372849058517ca2e39ce16d4 # v7.1.3 + uses: coatl-dev/actions/simple-git-diff@c339f0299e21b3b28b42414e3ea474d33468713c # v7.1.5 with: path: ${{ github.workspace }} - name: Import GPG key if: ${{ steps.git-diff.outputs.diff == 'true' }} - uses: coatl-dev/actions/gpg-import@499c77f2bc6f909d372849058517ca2e39ce16d4 # v7.1.3 + uses: coatl-dev/actions/gpg-import@c339f0299e21b3b28b42414e3ea474d33468713c # v7.1.5 with: passphrase: ${{ secrets.COATL_BOT_GPG_PASSPHRASE }} private-key: ${{ secrets.COATL_BOT_GPG_PRIVATE_KEY }} @@ -63,7 +63,7 @@ jobs: - name: Create pull request if: ${{ steps.git-diff.outputs.diff == 'true' }} - uses: coatl-dev/actions/pr-create@499c77f2bc6f909d372849058517ca2e39ce16d4 # v7.1.3 + uses: coatl-dev/actions/pr-create@c339f0299e21b3b28b42414e3ea474d33468713c # v7.1.5 with: gh-token: ${{ secrets.COATL_BOT_GH_TOKEN }} base-branch: '${{ matrix.branch }}' diff --git a/setup.cfg b/setup.cfg index c8c67f2..28adb0d 100644 --- a/setup.cfg +++ b/setup.cfg @@ -29,9 +29,9 @@ keywords = inductive automation java project_urls = - Documentation = https://docs.oracle.com/en/java/javase/17/docs/api/index.html + Documentation = https://docs.oracle.com/en/java/javase/25/docs/api/index.html Funding = https://github.com/sponsors/cesarcoatl - Source = https://github.com/ignition-devs/java-api/tree/main + Source = https://github.com/ignition-devs/java-api/tree/25 Tracker = https://github.com/ignition-devs/java-api/issues [options] diff --git a/src/java/lang/__init__.py b/src/java/lang/__init__.py index ec5d950..81c7083 100644 --- a/src/java/lang/__init__.py +++ b/src/java/lang/__init__.py @@ -32,6 +32,7 @@ "String", "StringBuffer", "StringBuilder", + "System", "Thread", "Throwable", "UnsupportedOperationException", @@ -40,15 +41,18 @@ import __builtin__ as builtins import array +import os import time from typing import TYPE_CHECKING, Any, List, Optional, Set, Union from java.lang.reflect import AccessFlag, Type if TYPE_CHECKING: + from java.io import InputStream, PrintStream from java.nio import CharBuffer + from java.nio.channels import Channel from java.time import Duration - from java.util import Iterator, Spliterator + from java.util import Iterator, Properties, Spliterator from java.util.concurrent import ThreadFactory from java.util.function import Consumer, Supplier from java.util.stream import IntStream, Stream @@ -714,6 +718,147 @@ def trimToSize(self): pass +class System(Object): + """The System class contains several useful class fields and + methods. + + It cannot be instantiated. Among the facilities provided by the + System class are standard input, standard output, and error output + streams; access to externally defined properties and environment + variables; a means of loading files and libraries; and a utility + method for quickly copying a portion of an array. + """ + + err = None # type: PrintStream + in_ = None # type: InputStream + out = None # type: PrintStream + + @staticmethod + def arraycopy(src, srcPos, dest, destPos, length): + # type: (Any, int, Any, int, int) -> None + dest[destPos : destPos + length] = src[srcPos : srcPos + length] + + @staticmethod + def clearProperty(key): + # type: (Union[str, unicode]) -> Union[str, unicode] + pass + + @staticmethod + def console(): + # type: () -> Any + pass + + @staticmethod + def currentTimeMillis(): + # type: () -> long + return long(time.time() * 1000) + + @staticmethod + def exit(status): + # type: (int) -> None + pass + + @staticmethod + def gc(): + # type: () -> None + pass + + @staticmethod + def getenv(name=None): + # type: (Optional[Union[str, unicode]]) -> Any + return dict(os.environ) if name is None else os.environ.get(str(name)) + + @staticmethod + def getLogger(name, bundle=None): + # type: (Union[str, unicode], Optional[Any]) -> Any + pass + + @staticmethod + def getProperties(): + # type: () -> Properties + pass + + @staticmethod + def getProperty(key, def_=None): + # type: (Union[str, unicode], Optional[Union[str, unicode]]) -> Union[str, unicode] + pass + + @staticmethod + def getSecurityManager(): + # type: () -> Any + pass + + @staticmethod + def identityHashCode(x): + # type: (Object) -> int + return id(x) + + @staticmethod + def inheritedChannel(): + # type: () -> Channel + pass + + @staticmethod + def lineSeparator(): + # type: () -> Union[str, unicode] + return os.linesep + + @staticmethod + def load(filename): + # type: (Union[str, unicode]) -> None + pass + + @staticmethod + def loadLibrary(libname): + # type: (Union[str, unicode]) -> None + pass + + @staticmethod + def mapLibraryName(libname): + # type: (Union[str, unicode]) -> Union[str, unicode] + pass + + @staticmethod + def nanoTime(): + # type: () -> long + return long(time.time() * 1000000000) + + @staticmethod + def runFinalization(): + # type: () -> None + pass + + @staticmethod + def setErr(err): + # type: (PrintStream) -> None + pass + + @staticmethod + def setIn(in_): + # type: (InputStream) -> None + pass + + @staticmethod + def setOut(out): + # type: (PrintStream) -> None + pass + + @staticmethod + def setProperties(props): + # type: (Properties) -> None + pass + + @staticmethod + def setProperty(key, value): + # type: (Union[str, unicode], Union[str, unicode]) -> Union[str, unicode] + pass + + @staticmethod + def setSecurityManager(sm): + # type: (Any) -> None + pass + + class Throwable(Object, builtins.Exception): """The Throwable class is the superclass of all errors and exceptions in the Java language. diff --git a/stubs/pyproject.toml b/stubs/pyproject.toml index 45ac853..a669509 100644 --- a/stubs/pyproject.toml +++ b/stubs/pyproject.toml @@ -38,7 +38,7 @@ classifiers = [ urls.Documentation = "https://docs.oracle.com/en/java/javase/25/docs/api/index.html" urls.Funding = "https://github.com/sponsors/cesarcoatl" urls.Homepage = "https://github.com/ignition-devs/java-api" -urls.Source = "https://github.com/ignition-devs/java-api/tree/main" +urls.Source = "https://github.com/ignition-devs/java-api/tree/25" urls.Tracker = "https://github.com/ignition-devs/java-api/issues" [tool.setuptools] diff --git a/stubs/stubs/java/lang/__init__.pyi b/stubs/stubs/java/lang/__init__.pyi index 43ede90..4220f7f 100644 --- a/stubs/stubs/java/lang/__init__.pyi +++ b/stubs/stubs/java/lang/__init__.pyi @@ -2,9 +2,11 @@ import __builtin__ as builtins from typing import Any, List, Optional, Set, Union from java.lang.reflect import AccessFlag, Type +from java.io import InputStream, PrintStream from java.nio import CharBuffer +from java.nio.channels import Channel from java.time import Duration -from java.util import Iterator, Spliterator +from java.util import Iterator, Properties, Spliterator from java.util.concurrent import ThreadFactory from java.util.function import Consumer, Supplier from java.util.stream import IntStream, Stream @@ -217,6 +219,67 @@ class StringBuilder(Object, CharSequence): def substring(self, start: int, end: int = ...) -> Union[str, unicode]: ... def trimToSize(self) -> None: ... +class System(Object): + err: PrintStream + in_: InputStream + out: PrintStream + @staticmethod + def arraycopy( + src: Any, srcPos: int, dest: Any, destPos: int, length: int + ) -> None: ... + @staticmethod + def clearProperty(key: Union[str, unicode]) -> Union[str, unicode]: ... + @staticmethod + def console() -> Any: ... + @staticmethod + def currentTimeMillis() -> long: ... + @staticmethod + def exit(status: int) -> None: ... + @staticmethod + def gc() -> None: ... + @staticmethod + def getenv(name: Optional[Union[str, unicode]] = ...) -> Any: ... + @staticmethod + def getLogger(name: Union[str, unicode], bundle: Optional[Any] = ...) -> Any: ... + @staticmethod + def getProperties() -> Properties: ... + @staticmethod + def getProperty( + key: Union[str, unicode], def_: Optional[Union[str, unicode]] = ... + ) -> Union[str, unicode]: ... + @staticmethod + def getSecurityManager() -> Any: ... + @staticmethod + def identityHashCode(x: Object) -> int: ... + @staticmethod + def inheritedChannel() -> Channel: ... + @staticmethod + def lineSeparator() -> Union[str, unicode]: ... + @staticmethod + def load(filename: Union[str, unicode]) -> None: ... + @staticmethod + def loadLibrary(libname: Union[str, unicode]) -> None: ... + @staticmethod + def mapLibraryName(libname: Union[str, unicode]) -> Union[str, unicode]: ... + @staticmethod + def nanoTime() -> long: ... + @staticmethod + def runFinalization() -> None: ... + @staticmethod + def setErr(err: PrintStream) -> None: ... + @staticmethod + def setIn(in_: InputStream) -> None: ... + @staticmethod + def setOut(out: PrintStream) -> None: ... + @staticmethod + def setProperties(props: Properties) -> None: ... + @staticmethod + def setProperty( + key: Union[str, unicode], value: Union[str, unicode] + ) -> Union[str, unicode]: ... + @staticmethod + def setSecurityManager(sm: Any) -> None: ... + class Throwable(Object, builtins.Exception): def __init__( self, message: Optional[str] = ..., cause: Optional[Throwable] = ... From d8bdfe11adbf11e333f0fdf7b82300ee0c37a186 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9sar=20Rom=C3=A1n?= Date: Sun, 15 Nov 2026 17:34:03 -0800 Subject: [PATCH 2/2] style: ignore black's slice formatting --- src/java/lang/__init__.py | 14 ++++++++++---- stubs/stubs/java/lang/__init__.pyi | 2 +- tox.ini | 2 +- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/java/lang/__init__.py b/src/java/lang/__init__.py index 81c7083..dfe4ddc 100644 --- a/src/java/lang/__init__.py +++ b/src/java/lang/__init__.py @@ -779,8 +779,11 @@ def getProperties(): pass @staticmethod - def getProperty(key, def_=None): - # type: (Union[str, unicode], Optional[Union[str, unicode]]) -> Union[str, unicode] + def getProperty( + key, # type: Union[str, unicode] + def_=None, # type: Optional[Union[str, unicode]] + ): + # type: (...) -> Union[str, unicode] pass @staticmethod @@ -849,8 +852,11 @@ def setProperties(props): pass @staticmethod - def setProperty(key, value): - # type: (Union[str, unicode], Union[str, unicode]) -> Union[str, unicode] + def setProperty( + key, # type: Union[str, unicode] + value, # type: Union[str, unicode] + ): + # type: (...) -> Union[str, unicode] pass @staticmethod diff --git a/stubs/stubs/java/lang/__init__.pyi b/stubs/stubs/java/lang/__init__.pyi index 4220f7f..4347ea9 100644 --- a/stubs/stubs/java/lang/__init__.pyi +++ b/stubs/stubs/java/lang/__init__.pyi @@ -1,8 +1,8 @@ import __builtin__ as builtins from typing import Any, List, Optional, Set, Union -from java.lang.reflect import AccessFlag, Type from java.io import InputStream, PrintStream +from java.lang.reflect import AccessFlag, Type from java.nio import CharBuffer from java.nio.channels import Channel from java.time import Duration diff --git a/tox.ini b/tox.ini index ab1923a..6756b6d 100644 --- a/tox.ini +++ b/tox.ini @@ -39,7 +39,7 @@ wrap-summaries = 72 arg-type-hints-in-docstring = False arg-type-hints-in-signature = False check-return-types = False -ignore = DOC202, E741, F821 +ignore = DOC202, E203, E741, F821 max-complexity = 10 max-doc-length = 72 max-line-length = 120