├── .github
├── FUNDING.yml
└── workflows
│ ├── [A] build and test, release if requested.yml
│ ├── [A] update documentation.yml
│ └── [M] build and test, release if requested.yml
├── .gitignore
├── LICENSE
├── README.md
├── docs
├── _config.yml
├── _layouts
│ └── default.html
├── assets
│ ├── css
│ │ └── style.scss
│ └── fonts
│ │ ├── AldoPro-Black.ttf
│ │ ├── AldoPro-Black.woff
│ │ ├── AldoPro-Black.woff2
│ │ ├── AldoPro-Bold.ttf
│ │ ├── AldoPro-Bold.woff
│ │ ├── AldoPro-Bold.woff2
│ │ ├── AldoPro-Book.ttf
│ │ ├── AldoPro-Book.woff
│ │ ├── AldoPro-Book.woff2
│ │ ├── AldoPro-Hairline.ttf
│ │ ├── AldoPro-Hairline.woff
│ │ ├── AldoPro-Hairline.woff2
│ │ ├── AldoPro-Light.ttf
│ │ ├── AldoPro-Light.woff
│ │ ├── AldoPro-Light.woff2
│ │ ├── AldoPro-Medium.ttf
│ │ ├── AldoPro-Medium.woff
│ │ ├── AldoPro-Medium.woff2
│ │ ├── AldoPro-Regular.ttf
│ │ ├── AldoPro-Regular.woff
│ │ ├── AldoPro-Regular.woff2
│ │ ├── AldoPro-Thin.ttf
│ │ ├── AldoPro-Thin.woff
│ │ └── AldoPro-Thin.woff2
└── index.md
├── java
├── pom.xml
├── sa-pom.xml
└── src
│ ├── main
│ ├── java
│ │ ├── module-info.java
│ │ └── org
│ │ │ └── burningwave
│ │ │ └── jvm
│ │ │ ├── DynamicDriver.java
│ │ │ ├── HybridDriver.java
│ │ │ ├── NativeDriver.java
│ │ │ ├── NativeExecutor.java
│ │ │ ├── function
│ │ │ └── catalog
│ │ │ │ ├── AllocateInstanceFunction.java
│ │ │ │ ├── ConsulterSupplier.java
│ │ │ │ ├── ConsulterSupplyFunction.java
│ │ │ │ ├── GetFieldValueFunction.java
│ │ │ │ ├── GetLoadedClassesRetrieverFunction.java
│ │ │ │ ├── GetLoadedPackagesFunction.java
│ │ │ │ ├── SetAccessibleFunction.java
│ │ │ │ └── SetFieldValueFunction.java
│ │ │ └── util
│ │ │ ├── Files.java
│ │ │ ├── Libraries.java
│ │ │ └── TempFileHolder.java
│ └── resources
│ │ └── jvm-driver.properties
│ └── test
│ └── java
│ └── org
│ └── burningwave
│ └── jvm
│ └── test
│ ├── AllTestsSuite.java
│ ├── BaseTest.java
│ ├── DefaultDriverTest.java
│ ├── DynamicDriverTest.java
│ ├── HybridDriverTest.java
│ ├── NativeDriverTest.java
│ ├── NativeExecutorTest.java
│ └── Reflection.java
├── launcher
└── eclipse
│ ├── Burningwave JVM Driver - Debug attacher.launch
│ ├── Burningwave JVM Driver - build and test with REMOTE DEBUG.launch
│ ├── Burningwave JVM Driver - parent clean package install.launch
│ └── Burningwave JVM Driver - test.launch
├── native
├── bin
│ ├── NativeExecutor-x32.dll
│ ├── NativeExecutor-x64.dll
│ ├── libNativeExecutor-aarch64.so
│ ├── libNativeExecutor-x32.so
│ ├── libNativeExecutor-x64.dylib
│ └── libNativeExecutor-x64.so
├── pom.xml
└── src
│ └── main
│ └── c-c++
│ └── org
│ └── burningwave
│ ├── common.h
│ └── jvm
│ ├── NativeEnvironment.cpp
│ ├── NativeEnvironment.h
│ ├── NativeExecutor.cpp
│ └── NativeExecutor.h
└── pom.xml
/.github/FUNDING.yml:
--------------------------------------------------------------------------------
1 | custom: https://www.paypal.com/donate/?cmd=_donations&business=EY4TMTW8SWDAC&item_name=Support+maintenance+and+improvement+of+Burningwave+JVM+Driver¤cy_code=EUR&source=url
2 |
--------------------------------------------------------------------------------
/.github/workflows/[A] build and test, release if requested.yml:
--------------------------------------------------------------------------------
1 | name: Build and release if requested
2 |
3 |
4 | on:
5 | push:
6 | branches:
7 | - main
8 | paths:
9 | - "**.sh"
10 | - "**.cmd"
11 | - "**.c"
12 | - "**.cpp"
13 | - "**.java"
14 | # - ".github/workflows/**"
15 | - "**.properties"
16 | - "**.xml"
17 |
18 |
19 | jobs:
20 |
21 |
22 | elaborate-native-module:
23 | name: Elaborate native module (${{ matrix.os }} ${{ matrix.architecture }})
24 | strategy:
25 | fail-fast: false
26 | max-parallel: 2
27 | matrix:
28 | os: [windows-latest, ubuntu-22.04, macos-latest]
29 | java: [19]
30 | distribution: [zulu]
31 | architecture: [x86, x64]
32 | exclude:
33 | - os: macOS-latest
34 | architecture: x86
35 | runs-on: ${{ matrix.os }}
36 | steps:
37 | - name: Set up JDK ${{ matrix.java }}
38 | uses: actions/setup-java@v3
39 | with:
40 | java-version: ${{ matrix.java }}
41 | distribution: 'zulu'
42 | architecture: ${{ matrix.architecture }}
43 | - if: startsWith(matrix.os, 'ubuntu') && startsWith(matrix.architecture, 'x64')
44 | name: Set up C/C++ compiler
45 | run: |
46 | sudo apt update
47 | sudo apt-get -y install g++-aarch64-linux-gnu g++-arm-linux-gnueabi
48 | - if: startsWith(matrix.os, 'ubuntu') && startsWith(matrix.architecture, 'x86')
49 | name: Set up C/C++ compiler
50 | run: |
51 | sudo apt update
52 | sudo apt-get -y install doxygen vera++ zlib1g-dev libsnappy-dev \
53 | g++-multilib
54 | - if: startsWith(matrix.os, 'windows-latest') && startsWith(matrix.architecture, 'x86')
55 | name: Set up C/C++ compiler
56 | uses: egor-tensin/setup-mingw@v2
57 | with:
58 | platform: ${{ matrix.architecture }}
59 | version: 12.2.0
60 | - uses: actions/checkout@v3
61 | - name: Build native library
62 | run: mvn -B clean compile -Dproject_jdk_version=${{ matrix.java }} -DskipTests=true --file ./native/pom.xml
63 | - if: startsWith(matrix.os, 'ubuntu-22.04') && startsWith(matrix.architecture, 'x64')
64 | name: Build native library for platform group one
65 | run: |
66 | mvn -B clean compile -Dproject_jdk_version=${{ matrix.java }} -Pextra-compilation-one -Dextra-compilation-one-executable=aarch64-linux-gnu-g++ -Dextra-compilation-one-artifact-name-suffix=aarch64 -DskipTests=true --file ./native/pom.xml
67 | # mvn -B clean compile -Dproject_jdk_version=${{ matrix.java }} -Pextra-compilation-one -Dextra-compilation-one-executable=arm-linux-gnueabi-g++ -Dextra-compilation-one-artifact-name-suffix=armeabi-x32 -DskipTests=true --file ./native/pom.xml
68 | - if: github.event_name == 'push' && (endsWith(github.event.head_commit.message, 'Releasing new version') || contains(github.event.head_commit.message, 'Generating external artifacts'))
69 | name: Push native library
70 | run: |
71 | git config user.name "${{ github.event.head_commit.committer.name }}"
72 | git config user.email "${{ github.event.head_commit.committer.email }}"
73 | git pull origin ${{github.ref}}
74 | git add .
75 | git commit -am "Generated native libraries on ${{ matrix.os }} ${{ matrix.architecture }}" --allow-empty
76 | git push
77 |
78 | build-and-test-with-zulu-JDK:
79 | name: ${{ matrix.os }} ${{ matrix.architecture }}, JVM ${{ matrix.distribution }} ${{ matrix.java }}
80 | needs: [elaborate-native-module]
81 | strategy:
82 | fail-fast: false
83 | max-parallel: 15
84 | matrix:
85 | architecture: [x64]
86 | distribution: [zulu]
87 | os: [ubuntu-latest, macOS-latest, windows-latest]
88 | java: [9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24]
89 | exclude:
90 | - architecture: x64
91 | java: 10
92 | runs-on: ${{ matrix.os }}
93 | steps:
94 | - uses: actions/checkout@v3
95 | - name: Set up JDK ${{ matrix.java }}
96 | uses: actions/setup-java@v3
97 | with:
98 | java-version: ${{ matrix.java }}
99 | distribution: ${{ matrix.distribution }}
100 | architecture: ${{ matrix.architecture }}
101 | - name: Update repositories
102 | run: |
103 | git config user.name "${{ github.event.head_commit.committer.name }}"
104 | git config user.email "${{ github.event.head_commit.committer.email }}"
105 | git pull origin ${{github.ref}}
106 | - name: Build and test with Java 7 target
107 | if: ${{ fromJSON(matrix.java) <= 19 }}
108 | run: mvn -B clean test -DskipTests=false --file ./java/pom.xml
109 | - name: Build and test with Java 8 target
110 | if: ${{ fromJSON(matrix.java) > 19}}
111 | run: mvn -B clean test -Dproject_jdk_version=8 -DskipTests=false --file ./java/pom.xml
112 |
113 |
114 | build-and-test-with-semeru-JDK:
115 | name: ${{ matrix.os }} ${{ matrix.architecture }}, JVM ${{ matrix.distribution }} ${{ matrix.java }}
116 | needs: [elaborate-native-module]
117 | strategy:
118 | fail-fast: false
119 | max-parallel: 15
120 | matrix:
121 | architecture: [x64]
122 | distribution: [semeru]
123 | os: [ubuntu-latest, macOS-latest, windows-latest]
124 | java: [11, 16, 17, 18, 19, 20, 21, 22, 23]
125 | runs-on: ${{ matrix.os }}
126 | steps:
127 | - uses: actions/checkout@v3
128 | - name: Set up JDK ${{ matrix.java }}
129 | uses: actions/setup-java@v3
130 | with:
131 | java-version: ${{ matrix.java }}
132 | distribution: ${{ matrix.distribution }}
133 | architecture: ${{ matrix.architecture }}
134 | - name: Update repositories
135 | run: |
136 | git config user.name "${{ github.event.head_commit.committer.name }}"
137 | git config user.email "${{ github.event.head_commit.committer.email }}"
138 | git pull origin ${{github.ref}}
139 | - name: Build and test with Java 7 target
140 | if: ${{ fromJSON(matrix.java) <= 19 }}
141 | run: mvn -B clean test -DskipTests=false --file ./java/pom.xml
142 | - name: Build and test with Java 8 target
143 | if: ${{ fromJSON(matrix.java) > 19}}
144 | run: mvn -B clean test -Dproject_jdk_version=8 -DskipTests=false --file ./java/pom.xml
145 |
146 |
147 | build-and-test-with-temurin-JDK:
148 | name: ${{ matrix.os }} ${{ matrix.architecture }}, JVM ${{ matrix.distribution }} ${{ matrix.java }}
149 | needs: [elaborate-native-module]
150 | strategy:
151 | fail-fast: false
152 | max-parallel: 15
153 | matrix:
154 | architecture: [x64]
155 | distribution: [temurin]
156 | os: [ubuntu-latest, macOS-latest, windows-latest]
157 | java: [11, 16, 17, 18, 19, 20, 21, 22, 23, 24]
158 | runs-on: ${{ matrix.os }}
159 | steps:
160 | - uses: actions/checkout@v3
161 | - name: Set up JDK ${{ matrix.java }}
162 | uses: actions/setup-java@v3
163 | with:
164 | java-version: ${{ matrix.java }}
165 | distribution: ${{ matrix.distribution }}
166 | architecture: ${{ matrix.architecture }}
167 | - name: Update repositories
168 | run: |
169 | git config user.name "${{ github.event.head_commit.committer.name }}"
170 | git config user.email "${{ github.event.head_commit.committer.email }}"
171 | git pull origin ${{github.ref}}
172 | - name: Build and test with Java 7 target
173 | if: ${{ fromJSON(matrix.java) <= 19 }}
174 | run: mvn -B clean test -DskipTests=false --file ./java/pom.xml
175 | - name: Build and test with Java 8 target
176 | if: ${{ fromJSON(matrix.java) > 19}}
177 | run: mvn -B clean test -Dproject_jdk_version=8 -DskipTests=false --file ./java/pom.xml
178 |
179 |
180 | #To ensure compatibility with the Java 7 version the build must never be run with a JDK version higher than 19
181 | release:
182 | needs: [build-and-test-with-zulu-JDK, build-and-test-with-semeru-JDK, build-and-test-with-temurin-JDK]
183 | name: Release if requested
184 | runs-on: ubuntu-latest
185 | if: github.event_name == 'push' && endsWith(github.event.head_commit.message, 'Releasing new version')
186 | steps:
187 | - uses: actions/checkout@v3
188 | - name: Set up JDK 19
189 | uses: actions/setup-java@v3
190 | with:
191 | java-version: 19
192 | distribution: 'zulu'
193 | server-id: ossrh
194 | server-username: MAVEN_USERNAME
195 | server-password: MAVEN_PASSWORD
196 | - name: Publish to the Maven central repository
197 | run: |
198 | export GPG_TTY=$(tty)
199 | echo "${{ secrets.gpg_private_key }}" | gpg --batch --import
200 | git config user.name "${{ github.event.head_commit.committer.name }}"
201 | git config user.email "${{ github.event.head_commit.committer.email }}"
202 | git pull origin ${{github.ref}}
203 | mv ./java/pom.xml ./java/temp-pom.xml
204 | mv ./java/sa-pom.xml ./java/pom.xml
205 | mv ./java/temp-pom.xml ./java/sa-pom.xml
206 | git commit -am "Swithcing pom for releasing"
207 | git push
208 | mvn -B release:prepare release:perform -DskipTests=true -Dgpg.passphrase=${{ secrets.gpg_passphrase }} -Dgpg.keyname=${{ secrets.gpg_key_id }} -Drepository.url=https://${GITHUB_ACTOR}:${{ secrets.GITHUB_TOKEN }}@github.com/${GITHUB_REPOSITORY}.git --file ./java/pom.xml
209 | mv ./java/pom.xml ./java/temp-pom.xml
210 | mv ./java/sa-pom.xml ./java/pom.xml
211 | mv ./java/temp-pom.xml ./java/sa-pom.xml
212 | newVersion=$(sed -n -r 's%.*[[:space:]]*(.*-SNAPSHOT).*%\1%p' ./java/sa-pom.xml)
213 | sed -r -i "s%[[:space:]]*(.*-SNAPSHOT)%${newVersion}%" ./java/pom.xml
214 | git commit -am "Prepare for next development iteration"
215 | git push
216 | env:
217 | MAVEN_USERNAME: ${{ secrets.nexus_username }}
218 | MAVEN_PASSWORD: ${{ secrets.nexus_password }}
--------------------------------------------------------------------------------
/.github/workflows/[A] update documentation.yml:
--------------------------------------------------------------------------------
1 | # This file is derived from ToolFactory JVM driver.
2 | #
3 | # Hosted at: https://github.com/toolfactory/jvm-driver
4 | #
5 | # Modified by: Roberto Gentili
6 | #
7 | # Modifications hosted at: https://github.com/burningwave/jvm-driver
8 | #
9 | # - -
10 | #
11 | # The MIT License (MIT)
12 | #
13 | # Copyright (c) 2021 Luke Hutchison, Roberto Gentili
14 | #
15 | # Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
16 | # documentation files (the "Software"), to deal in the Software without restriction, including without
17 | # limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
18 | # the Software, and to permit persons to whom the Software is furnished to do so, subject to the following
19 | # conditions:
20 | #
21 | # The above copyright notice and this permission notice shall be included in all copies or substantial
22 | # portions of the Software.
23 | #
24 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
25 | # LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO
26 | # EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
27 | # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
28 | # OR OTHER DEALINGS IN THE SOFTWARE.
29 | #
30 | name: Update index page
31 |
32 | on:
33 | push:
34 | branches:
35 | - main
36 | paths:
37 | - "**README.md"
38 |
39 | jobs:
40 | update-index-page:
41 | runs-on: ubuntu-latest
42 | name: Update index page
43 | steps:
44 | - uses: actions/checkout@master
45 | - name: Overwrite the index.md
46 | run: |
47 | git config user.name "${{ github.event.head_commit.committer.name }}"
48 | git config user.email "${{ github.event.head_commit.committer.email }}"
49 | git pull origin ${{github.ref}}
50 | cp "./README.md" "./docs/index.md"
51 | git add .
52 | git commit -am "Update" --allow-empty
53 | git push
54 |
--------------------------------------------------------------------------------
/.github/workflows/[M] build and test, release if requested.yml:
--------------------------------------------------------------------------------
1 | name: Build and test -> Release
2 |
3 |
4 | on:
5 | watch:
6 | types: [started]
7 |
8 |
9 | jobs:
10 |
11 | ask-for-authorization:
12 | name: Ask for authorization
13 | runs-on: ubuntu-latest
14 | steps:
15 | - uses: octokit/request-action@v2.0.0
16 | with:
17 | route: GET /repos/:repository/collaborators/${{ github.actor }}
18 | repository: ${{ github.repository }}
19 | env:
20 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
21 | - name: Send push notification
22 | if: ${{ failure() }}
23 | uses: techulus/push-github-action@1.0.0
24 | env:
25 | API_KEY: ${{ secrets.PUSH_NOTIFICATION_API_KEY }}
26 | MESSAGE: ${{ format('New star for {0}!', github.repository) }}
27 |
28 | elaborate-native-module:
29 | needs: [ask-for-authorization]
30 | name: Elaborate native module (${{ matrix.os }} ${{ matrix.architecture }})
31 | strategy:
32 | fail-fast: false
33 | max-parallel: 2
34 | matrix:
35 | os: [windows-latest, ubuntu-22.04, macos-latest]
36 | java: [19]
37 | distribution: [zulu]
38 | architecture: [x86, x64]
39 | exclude:
40 | - os: macOS-latest
41 | architecture: x86
42 | runs-on: ${{ matrix.os }}
43 | steps:
44 | - name: Set up JDK ${{ matrix.java }}
45 | uses: actions/setup-java@v3
46 | with:
47 | java-version: ${{ matrix.java }}
48 | distribution: 'zulu'
49 | architecture: ${{ matrix.architecture }}
50 | - if: startsWith(matrix.os, 'ubuntu') && startsWith(matrix.architecture, 'x64')
51 | name: Set up C/C++ compiler
52 | run: |
53 | sudo apt update
54 | sudo apt-get -y install g++-aarch64-linux-gnu g++-arm-linux-gnueabi
55 | - if: startsWith(matrix.os, 'ubuntu') && startsWith(matrix.architecture, 'x86')
56 | name: Set up C/C++ compiler
57 | run: |
58 | sudo apt update
59 | sudo apt-get -y install doxygen vera++ zlib1g-dev libsnappy-dev \
60 | g++-multilib
61 | - if: startsWith(matrix.os, 'windows-latest') && startsWith(matrix.architecture, 'x86')
62 | name: Set up C/C++ compiler
63 | uses: egor-tensin/setup-mingw@v2
64 | with:
65 | platform: ${{ matrix.architecture }}
66 | version: 12.2.0
67 | - uses: actions/checkout@v3
68 | - name: Build native library
69 | run: mvn -B clean compile -Dproject_jdk_version=${{ matrix.java }} -DskipTests=true --file ./native/pom.xml
70 | - if: startsWith(matrix.os, 'ubuntu-22.04') && startsWith(matrix.architecture, 'x64')
71 | name: Build native library for platform group one
72 | run: |
73 | mvn -B clean compile -Dproject_jdk_version=${{ matrix.java }} -Pextra-compilation-one -Dextra-compilation-one-executable=aarch64-linux-gnu-g++ -Dextra-compilation-one-artifact-name-suffix=aarch64 -DskipTests=true --file ./native/pom.xml
74 | # mvn -B clean compile -Dproject_jdk_version=${{ matrix.java }} -Pextra-compilation-one -Dextra-compilation-one-executable=arm-linux-gnueabi-g++ -Dextra-compilation-one-artifact-name-suffix=armeabi-x32 -DskipTests=true --file ./native/pom.xml
75 | - name: Push native library
76 | run: |
77 | git config user.name "burningwave"
78 | git config user.email "info@burningwave.org"
79 | git pull origin ${{github.ref}}
80 | git add .
81 | git commit -am "Generated native libraries on ${{ matrix.os }} ${{ matrix.architecture }}" --allow-empty
82 | git push
83 |
84 | build-and-test-with-zulu-JDK:
85 | name: ${{ matrix.os }} ${{ matrix.architecture }}, JVM ${{ matrix.distribution }} ${{ matrix.java }}
86 | needs: [elaborate-native-module]
87 | strategy:
88 | fail-fast: false
89 | max-parallel: 15
90 | matrix:
91 | architecture: [x64]
92 | distribution: [zulu]
93 | os: [ubuntu-latest, macOS-latest, windows-latest]
94 | java: [9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24]
95 | exclude:
96 | - architecture: x64
97 | java: 10
98 | runs-on: ${{ matrix.os }}
99 | steps:
100 | - uses: actions/checkout@v3
101 | - name: Set up JDK ${{ matrix.java }}
102 | uses: actions/setup-java@v3
103 | with:
104 | java-version: ${{ matrix.java }}
105 | distribution: ${{ matrix.distribution }}
106 | architecture: ${{ matrix.architecture }}
107 | - name: Update repositories
108 | run: |
109 | git config user.name "${{ github.event.head_commit.committer.name }}"
110 | git config user.email "${{ github.event.head_commit.committer.email }}"
111 | git pull origin ${{github.ref}}
112 | - name: Build and test with Java 7 target
113 | if: ${{ fromJSON(matrix.java) <= 19 }}
114 | run: mvn -B clean test -DskipTests=false --file ./java/pom.xml
115 | - name: Build and test with Java 8 target
116 | if: ${{ fromJSON(matrix.java) > 19}}
117 | run: mvn -B clean test -Dproject_jdk_version=8 -DskipTests=false --file ./java/pom.xml
118 |
119 |
120 | build-and-test-with-semeru-JDK:
121 | name: ${{ matrix.os }} ${{ matrix.architecture }}, JVM ${{ matrix.distribution }} ${{ matrix.java }}
122 | needs: [elaborate-native-module]
123 | strategy:
124 | fail-fast: false
125 | max-parallel: 15
126 | matrix:
127 | architecture: [x64]
128 | distribution: [semeru]
129 | os: [ubuntu-latest, macOS-latest, windows-latest]
130 | java: [11, 16, 17, 18, 19, 20, 21, 22, 23]
131 | runs-on: ${{ matrix.os }}
132 | steps:
133 | - uses: actions/checkout@v3
134 | - name: Set up JDK ${{ matrix.java }}
135 | uses: actions/setup-java@v3
136 | with:
137 | java-version: ${{ matrix.java }}
138 | distribution: ${{ matrix.distribution }}
139 | architecture: ${{ matrix.architecture }}
140 | - name: Update repositories
141 | run: |
142 | git config user.name "${{ github.event.head_commit.committer.name }}"
143 | git config user.email "${{ github.event.head_commit.committer.email }}"
144 | git pull origin ${{github.ref}}
145 | - name: Build and test with Java 7 target
146 | if: ${{ fromJSON(matrix.java) <= 19 }}
147 | run: mvn -B clean test -DskipTests=false --file ./java/pom.xml
148 | - name: Build and test with Java 8 target
149 | if: ${{ fromJSON(matrix.java) > 19}}
150 | run: mvn -B clean test -Dproject_jdk_version=8 -DskipTests=false --file ./java/pom.xml
151 |
152 |
153 | build-and-test-with-temurin-JDK:
154 | name: ${{ matrix.os }} ${{ matrix.architecture }}, JVM ${{ matrix.distribution }} ${{ matrix.java }}
155 | needs: [elaborate-native-module]
156 | strategy:
157 | fail-fast: false
158 | max-parallel: 15
159 | matrix:
160 | architecture: [x64]
161 | distribution: [temurin]
162 | os: [ubuntu-latest, macOS-latest, windows-latest]
163 | java: [11, 16, 17, 18, 19, 20, 21, 22, 23, 24]
164 | runs-on: ${{ matrix.os }}
165 | steps:
166 | - uses: actions/checkout@v3
167 | - name: Set up JDK ${{ matrix.java }}
168 | uses: actions/setup-java@v3
169 | with:
170 | java-version: ${{ matrix.java }}
171 | distribution: ${{ matrix.distribution }}
172 | architecture: ${{ matrix.architecture }}
173 | - name: Update repositories
174 | run: |
175 | git config user.name "${{ github.event.head_commit.committer.name }}"
176 | git config user.email "${{ github.event.head_commit.committer.email }}"
177 | git pull origin ${{github.ref}}
178 | - name: Build and test with Java 7 target
179 | if: ${{ fromJSON(matrix.java) <= 19 }}
180 | run: mvn -B clean test -DskipTests=false --file ./java/pom.xml
181 | - name: Build and test with Java 8 target
182 | if: ${{ fromJSON(matrix.java) > 19}}
183 | run: mvn -B clean test -Dproject_jdk_version=8 -DskipTests=false --file ./java/pom.xml
184 |
185 |
186 | #To ensure compatibility with the Java 7 version the build must never be run with a JDK version higher than 19
187 | release:
188 | needs: [build-and-test-with-zulu-JDK, build-and-test-with-semeru-JDK, build-and-test-with-temurin-JDK]
189 | if: ${{ fromJSON(vars.MANUAL_RELEASE_ENABLED) }}
190 | name: Release if requested
191 | runs-on: ubuntu-latest
192 | steps:
193 | - uses: actions/checkout@v3
194 | - name: Set up JDK 19
195 | uses: actions/setup-java@v3
196 | with:
197 | java-version: 19
198 | distribution: 'zulu'
199 | server-id: ossrh
200 | server-username: MAVEN_USERNAME
201 | server-password: MAVEN_PASSWORD
202 | - name: Publish to the Maven central repository
203 | run: |
204 | export GPG_TTY=$(tty)
205 | echo "${{ secrets.gpg_private_key }}" | gpg --batch --import
206 | git config user.name "${GITHUB_ACTOR}"
207 | git config user.email "info@burningwave.org"
208 | git pull origin ${{github.ref}}
209 | mv ./java/pom.xml ./java/temp-pom.xml
210 | mv ./java/sa-pom.xml ./java/pom.xml
211 | mv ./java/temp-pom.xml ./java/sa-pom.xml
212 | git commit -am "Swithcing pom for releasing"
213 | git push
214 | mvn -B release:prepare release:perform -DskipTests=true -Dgpg.passphrase=${{ secrets.gpg_passphrase }} -Dgpg.keyname=${{ secrets.gpg_key_id }} -Drepository.url=https://${GITHUB_ACTOR}:${{ secrets.GITHUB_TOKEN }}@github.com/${GITHUB_REPOSITORY}.git --file ./java/pom.xml
215 | mv ./java/pom.xml ./java/temp-pom.xml
216 | mv ./java/sa-pom.xml ./java/pom.xml
217 | mv ./java/temp-pom.xml ./java/sa-pom.xml
218 | newVersion=$(sed -n -r 's%.*[[:space:]]*(.*-SNAPSHOT).*%\1%p' ./java/sa-pom.xml)
219 | sed -r -i "s%[[:space:]]*(.*-SNAPSHOT)%${newVersion}%" ./java/pom.xml
220 | git commit -am "Prepare for next development iteration"
221 | git push
222 | env:
223 | MAVEN_USERNAME: ${{ secrets.nexus_username }}
224 | MAVEN_PASSWORD: ${{ secrets.nexus_password }}
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Log file
2 | *.log
3 |
4 | # BlueJ files
5 | *.ctxt
6 |
7 | # Mobile Tools for Java (J2ME)
8 | .mtj.tmp/
9 |
10 | # Package Files #
11 | *.jar
12 | *.war
13 | *.nar
14 | *.ear
15 | *.tar.gz
16 | *.rar
17 |
18 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
19 | hs_err_pid*
20 |
21 | /.project
22 | /.settings
23 | /.classpath
24 | /target/
25 |
26 | /java/generate-header.cmd
27 | /java/.project
28 | /java/.settings
29 | /java/.classpath
30 | /java/target/
31 |
32 | /java-hook/.project
33 | /java-hook/.settings
34 | /java-hook/.classpath
35 | /java-hook/target/
36 |
37 | /native/.cproject
38 | /native/.project
39 | /native/.settings
40 | /native/.classpath
41 | /native/target/
42 | /native/Debug/
43 | /native/Release/
44 | *.bwc
45 |
46 | .vscode
47 | .idea
48 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2021 Roberto Gentili
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Burningwave JVM Driver [](https://twitter.com/intent/tweet?text=%40burningwave_org%20JVM%20driver%2C%20a%20%23Java%20driver%20to%20allow%20deep%20interaction%20with%20the%20JVM%20without%20any%20restrictions&url=https://burningwave.github.io/jvm-driver/)
2 |
3 |
4 |
5 |
6 |
7 | [](https://maven-badges.herokuapp.com/maven-central/org.burningwave/jvm-driver/)
8 | [](https://github.com/burningwave/jvm-driver/blob/main/LICENSE)
9 |
10 | [](https://github.com/burningwave/jvm-driver/actions/runs/14538126883)
11 |
12 | [-blueviolet)](https://github.com/burningwave/jvm-driver/actions/runs/14538126883)
13 |
14 | [](https://github.com/burningwave/jvm-driver/issues)
15 | [](https://github.com/burningwave/jvm-driver/issues?q=is%3Aissue+is%3Aclosed)
16 |
17 | [](https://www.burningwave.org/artifact-downloads/?show-overall-trend-chart=false&artifactId=jvm-driver&startDate=2021-08)
18 | [](https://github.com/burningwave/jvm-driver/network/dependents)
19 | [](https://www.burningwave.org#bw-counters)
20 |
21 | A driver derived from [**ToolFactory JVM Driver**](https://toolfactory.github.io/jvm-driver/) with a fully extensible architecture and with a custom and [**extremely optimized JNI engine**](https://github.com/burningwave/jvm-driver/issues/3#issuecomment-1149840706) to allow deep interaction with the JVM **without any restrictions**.
22 |
23 |
24 |
25 | To include Burningwave JVM Driver in your projects simply use with **Apache Maven**:
26 | ```xml
27 |
28 | org.burningwave
29 | jvm-driver
30 | 8.19.1
31 |
32 | ```
33 | ### Requiring the Burningwave JVM Driver module
34 |
35 | To use Burningwave JMV Driver as a Java module, add the following to your `module-info.java`:
36 |
37 | ```java
38 | //Mandatory if you use the default, dynamic or hybrid driver
39 | requires jdk.unsupported;
40 |
41 | requires org.burningwave.jvm;
42 | ```
43 |
44 |
45 |
46 | ## Overview
47 |
48 | There are four kinds of driver:
49 |
50 | * the **default driver** completely based on Java api
51 | * the **dynamic driver** that extends the default driver and uses a JNI function only if a Java based function offered by the default driver cannot be initialized
52 | * the **hybrid driver** that extends the default driver and uses some JNI functions only when run on JVM 17 and later
53 | * the **native driver** that extends the hybrid driver and uses JNI functions more consistently regardless of the Java version it is running on
54 |
55 | All JNI methods used by the dynamic, hybrid and native driver are supplied by a **custom and highly optimized JNI engine written in C++** that works on the following system configurations:
56 | * Windows x86/x64
57 | * Linux x86/x64
58 | * MacOs x64
59 | * aarch64 (**needs testing**)
60 |
61 |
62 |
63 | ## Usage
64 |
65 | To create a driver instance you should use this code:
66 | ```java
67 | io.github.toolfactory.jvm.Driver driver = io.github.toolfactory.jvm.Driver.getNew();
68 | ```
69 |
70 | The driver type returned by the method `io.github.toolfactory.jvm.Driver.Factory.getNew()` is **the first driver that can be initialized among the default, hybrid and native drivers respectively**.
71 |
72 | If you need to create a specific driver type you should use:
73 |
74 | * this code to create a default driver instance:
75 |
76 | ```java
77 | io.github.toolfactory.jvm.Driver driver = io.github.toolfactory.jvm.Driver.Factory.getNewDefault();
78 | ```
79 |
80 | * this code to create a dynamic driver instance:
81 |
82 | ```java
83 | io.github.toolfactory.jvm.Driver driver = io.github.toolfactory.jvm.Driver.Factory.getNewDynamic();
84 | ```
85 |
86 | * this code to create an hybrid driver instance:
87 |
88 | ```java
89 | io.github.toolfactory.jvm.Driver driver = io.github.toolfactory.jvm.Driver.Factory.getNewHybrid();
90 | ```
91 |
92 | * this code to create a native driver instance:
93 |
94 | ```java
95 | io.github.toolfactory.jvm.Driver driver = io.github.toolfactory.jvm.Driver.Factory.getNewNative();
96 | ```
97 |
98 |
99 |
100 | Each functionality offered by the driver is **initialized in deferred way** at the first call if the driver is not obtained through the method `io.github.toolfactory.jvm.Driver.getNew()`. However, it is possible to initialize all of the functionalities at once by calling the method `Driver.init()`.
101 |
102 | The methods exposed by the Driver interface are the following:
103 | ```java
104 | public D init();
105 |
106 | public T allocateInstance(Class> cls);
107 |
108 | // Return a ClassLoaderDelegate or the input itself if the input is a
109 | // BuiltinClassLoader or null if the JVM version is less than 9
110 | public ClassLoader convertToBuiltinClassLoader(ClassLoader classLoader);
111 |
112 | public Class> defineHookClass(Class> clientClass, byte[] byteCode);
113 |
114 | public Class> getBuiltinClassLoaderClass();
115 |
116 | public Class> getClassLoaderDelegateClass();
117 |
118 | public Class> getClassByName(String className, Boolean initialize, ClassLoader classLoader, Class> caller);
119 |
120 | public MethodHandles.Lookup getConsulter(Class> cls);
121 |
122 | public Constructor[] getDeclaredConstructors(Class cls);
123 |
124 | public Field[] getDeclaredFields(Class> cls);
125 |
126 | public Method[] getDeclaredMethods(Class> cls);
127 |
128 | public T getFieldValue(Object target, Field field);
129 |
130 | public Package getPackage(ClassLoader classLoader, String packageName);
131 |
132 | public Collection getResources(String resourceRelativePath, boolean findFirst, ClassLoader... classLoaders);
133 |
134 | public Collection getResources(String resourceRelativePath, boolean findFirst, Collection classLoaders);
135 |
136 | public T invoke(Object target, Method method, Object[] params);
137 |
138 | public boolean isBuiltinClassLoader(ClassLoader classLoader);
139 |
140 | public boolean isClassLoaderDelegate(ClassLoader classLoader);
141 |
142 | public T newInstance(Constructor ctor, Object[] params);
143 |
144 | public CleanableSupplier>> getLoadedClassesRetriever(ClassLoader classLoader);
145 |
146 | public Map retrieveLoadedPackages(ClassLoader classLoader);
147 |
148 | public void setAccessible(AccessibleObject object, boolean flag);
149 |
150 | public void setFieldValue(Object target, Field field, Object value);
151 |
152 | public void stop(Thread thread);
153 |
154 | public T throwException(String message, Object... placeHolderReplacements);
155 |
156 | public T throwException(Throwable exception);
157 | ```
158 |
159 |
160 |
161 | ## Compilation requirements
162 |
163 | **A JDK version 9 or higher and a GCC compiler are required to compile the project**. On Windows you can find compiler and GDB debugger from [**MinGW-W64 project**](https://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win64/Personal%20Builds/mingw-builds/8.1.0/threads-win32/seh/).
164 |
165 |
166 |
167 | ## Contributing
168 | The [native module](https://github.com/burningwave/jvm-driver/tree/main/native) is currently compiled for Linux x86/x64, Windows x86/x64, and Mac OS X x64: **feel free to contribute native code builds for other platforms or architectures**. Once the native code is compiled you need to add a few lines of code in the [native library loader](https://github.com/burningwave/jvm-driver/blob/main/java/src/main/java/org/burningwave/jvm/util/Libraries.java).
169 |
170 |
171 |
172 | # Ask for assistance
173 | **For assistance you can**:
174 | * [open a discussion](https://github.com/burningwave/jvm-driver/discussions) here on GitHub
175 | * [report a bug](https://github.com/burningwave/jvm-driver/issues) here on GitHub
176 | * ask on [Stack Overflow](https://stackoverflow.com/search?q=burningwave)
177 |
--------------------------------------------------------------------------------
/docs/_config.yml:
--------------------------------------------------------------------------------
1 | theme: jekyll-theme-cayman
2 | title: Burningwave JVM driver
3 | google_analytics: UA-154852845-4
4 | show_downloads: false
--------------------------------------------------------------------------------
/docs/_layouts/default.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {% if site.google_analytics %}
6 |
7 |
13 | {% endif %}
14 |
15 |
16 | {% seo %}
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
37 |
38 |
39 | {{ content }}
40 |
41 |
47 |
48 |
49 |
50 |
--------------------------------------------------------------------------------
/docs/assets/css/style.scss:
--------------------------------------------------------------------------------
1 | ---
2 | ---
3 |
4 | @import "{{ site.theme }}";
5 | .page-header {
6 | background-image: linear-gradient(120deg, #e54d1d, #f7bc12);
7 | }
8 |
9 | h1.project-name {
10 | font-family: 'Aldo Pro Book';
11 | font-size: 4.25rem;
12 | font-style: italic;
13 | line-height: 1.00em;
14 | }
15 |
16 | .main-content {
17 | h1 {
18 | color: #e54d1d;
19 | }
20 | h2 {
21 | color: #e54d1d;
22 | }
23 | h3 {
24 | color: #e54d1d;
25 | }
26 | }
27 |
28 | @font-face {
29 | font-family: 'Aldo Pro Hairline';
30 | src: local('Aldo Pro Hairline'), local('Aldo-Pro-Hairline'),
31 | url('./../fonts/AldoPro-Hairline.woff2') format('woff2'),
32 | url('./../fonts/AldoPro-Hairline.woff') format('woff'),
33 | url('./../fonts/AldoPro-Hairline.ttf') format('truetype');
34 | font-weight: 100;
35 | font-style: normal;
36 | }
37 |
38 | @font-face {
39 | font-family: 'Aldo Pro Light';
40 | src: local('Aldo Pro Light'), local('Aldo-Pro-Light'),
41 | url('./../fonts/AldoPro-Light.woff2') format('woff2'),
42 | url('./../fonts/AldoPro-Light.woff') format('woff'),
43 | url('./../fonts/AldoPro-Light.ttf') format('truetype');
44 | font-weight: 300;
45 | font-style: normal;
46 | }
47 |
48 | @font-face {
49 | font-family: 'Aldo Pro Book';
50 | src: local('Aldo Pro Book'), local('Aldo-Pro-Book'),
51 | url('./../fonts/AldoPro-Book.woff2') format('woff2'),
52 | url('./../fonts/AldoPro-Book.woff') format('woff'),
53 | url('./../fonts/AldoPro-Book.ttf') format('truetype');
54 | font-weight: normal;
55 | font-style: normal;
56 | }
57 |
58 | @font-face {
59 | font-family: 'Aldo Pro Regular';
60 | src: local('Aldo Pro Regular'), local('Aldo-Pro-Regular'),
61 | url('./../fonts/AldoPro-Regular.woff2') format('woff2'),
62 | url('./../fonts/AldoPro-Regular.woff') format('woff'),
63 | url('./../fonts/AldoPro-Regular.ttf') format('truetype');
64 | font-weight: 400;
65 | font-style: normal;
66 | }
67 |
68 | @font-face {
69 | font-family: 'Aldo Pro Medium';
70 | src: local('Aldo Pro Medium'), local('Aldo-Pro-Medium'),
71 | url('./../fonts/AldoPro-Medium.woff2') format('woff2'),
72 | url('./../fonts/AldoPro-Medium.woff') format('woff'),
73 | url('./../fonts/AldoPro-Medium.ttf') format('truetype');
74 | font-weight: 500;
75 | font-style: normal;
76 | }
77 |
78 | @font-face {
79 | font-family: 'Aldo Pro Bold';
80 | src: local('Aldo Pro Bold'), local('Aldo-Pro-Bold'),
81 | url('./../fonts/AldoPro-Bold.woff2') format('woff2'),
82 | url('./../fonts/AldoPro-Bold.woff') format('woff'),
83 | url('./../fonts/AldoPro-Bold.ttf') format('truetype');
84 | font-weight: 700;
85 | font-style: normal;
86 | }
87 |
88 | @font-face {
89 | font-family: 'Aldo Pro Black';
90 | src: local('Aldo Pro Black'), local('Aldo-Pro-Black'),
91 | url('./../fonts/AldoPro-Black.woff2') format('woff2'),
92 | url('./../fonts/AldoPro-Black.woff') format('woff'),
93 | url('./../fonts/AldoPro-Black.ttf') format('truetype');
94 | font-weight: 900;
95 | font-style: normal;
96 | }
97 |
--------------------------------------------------------------------------------
/docs/assets/fonts/AldoPro-Black.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/burningwave/jvm-driver/4bc338f49debfee207996771449a56b375870bb6/docs/assets/fonts/AldoPro-Black.ttf
--------------------------------------------------------------------------------
/docs/assets/fonts/AldoPro-Black.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/burningwave/jvm-driver/4bc338f49debfee207996771449a56b375870bb6/docs/assets/fonts/AldoPro-Black.woff
--------------------------------------------------------------------------------
/docs/assets/fonts/AldoPro-Black.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/burningwave/jvm-driver/4bc338f49debfee207996771449a56b375870bb6/docs/assets/fonts/AldoPro-Black.woff2
--------------------------------------------------------------------------------
/docs/assets/fonts/AldoPro-Bold.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/burningwave/jvm-driver/4bc338f49debfee207996771449a56b375870bb6/docs/assets/fonts/AldoPro-Bold.ttf
--------------------------------------------------------------------------------
/docs/assets/fonts/AldoPro-Bold.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/burningwave/jvm-driver/4bc338f49debfee207996771449a56b375870bb6/docs/assets/fonts/AldoPro-Bold.woff
--------------------------------------------------------------------------------
/docs/assets/fonts/AldoPro-Bold.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/burningwave/jvm-driver/4bc338f49debfee207996771449a56b375870bb6/docs/assets/fonts/AldoPro-Bold.woff2
--------------------------------------------------------------------------------
/docs/assets/fonts/AldoPro-Book.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/burningwave/jvm-driver/4bc338f49debfee207996771449a56b375870bb6/docs/assets/fonts/AldoPro-Book.ttf
--------------------------------------------------------------------------------
/docs/assets/fonts/AldoPro-Book.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/burningwave/jvm-driver/4bc338f49debfee207996771449a56b375870bb6/docs/assets/fonts/AldoPro-Book.woff
--------------------------------------------------------------------------------
/docs/assets/fonts/AldoPro-Book.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/burningwave/jvm-driver/4bc338f49debfee207996771449a56b375870bb6/docs/assets/fonts/AldoPro-Book.woff2
--------------------------------------------------------------------------------
/docs/assets/fonts/AldoPro-Hairline.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/burningwave/jvm-driver/4bc338f49debfee207996771449a56b375870bb6/docs/assets/fonts/AldoPro-Hairline.ttf
--------------------------------------------------------------------------------
/docs/assets/fonts/AldoPro-Hairline.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/burningwave/jvm-driver/4bc338f49debfee207996771449a56b375870bb6/docs/assets/fonts/AldoPro-Hairline.woff
--------------------------------------------------------------------------------
/docs/assets/fonts/AldoPro-Hairline.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/burningwave/jvm-driver/4bc338f49debfee207996771449a56b375870bb6/docs/assets/fonts/AldoPro-Hairline.woff2
--------------------------------------------------------------------------------
/docs/assets/fonts/AldoPro-Light.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/burningwave/jvm-driver/4bc338f49debfee207996771449a56b375870bb6/docs/assets/fonts/AldoPro-Light.ttf
--------------------------------------------------------------------------------
/docs/assets/fonts/AldoPro-Light.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/burningwave/jvm-driver/4bc338f49debfee207996771449a56b375870bb6/docs/assets/fonts/AldoPro-Light.woff
--------------------------------------------------------------------------------
/docs/assets/fonts/AldoPro-Light.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/burningwave/jvm-driver/4bc338f49debfee207996771449a56b375870bb6/docs/assets/fonts/AldoPro-Light.woff2
--------------------------------------------------------------------------------
/docs/assets/fonts/AldoPro-Medium.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/burningwave/jvm-driver/4bc338f49debfee207996771449a56b375870bb6/docs/assets/fonts/AldoPro-Medium.ttf
--------------------------------------------------------------------------------
/docs/assets/fonts/AldoPro-Medium.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/burningwave/jvm-driver/4bc338f49debfee207996771449a56b375870bb6/docs/assets/fonts/AldoPro-Medium.woff
--------------------------------------------------------------------------------
/docs/assets/fonts/AldoPro-Medium.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/burningwave/jvm-driver/4bc338f49debfee207996771449a56b375870bb6/docs/assets/fonts/AldoPro-Medium.woff2
--------------------------------------------------------------------------------
/docs/assets/fonts/AldoPro-Regular.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/burningwave/jvm-driver/4bc338f49debfee207996771449a56b375870bb6/docs/assets/fonts/AldoPro-Regular.ttf
--------------------------------------------------------------------------------
/docs/assets/fonts/AldoPro-Regular.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/burningwave/jvm-driver/4bc338f49debfee207996771449a56b375870bb6/docs/assets/fonts/AldoPro-Regular.woff
--------------------------------------------------------------------------------
/docs/assets/fonts/AldoPro-Regular.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/burningwave/jvm-driver/4bc338f49debfee207996771449a56b375870bb6/docs/assets/fonts/AldoPro-Regular.woff2
--------------------------------------------------------------------------------
/docs/assets/fonts/AldoPro-Thin.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/burningwave/jvm-driver/4bc338f49debfee207996771449a56b375870bb6/docs/assets/fonts/AldoPro-Thin.ttf
--------------------------------------------------------------------------------
/docs/assets/fonts/AldoPro-Thin.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/burningwave/jvm-driver/4bc338f49debfee207996771449a56b375870bb6/docs/assets/fonts/AldoPro-Thin.woff
--------------------------------------------------------------------------------
/docs/assets/fonts/AldoPro-Thin.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/burningwave/jvm-driver/4bc338f49debfee207996771449a56b375870bb6/docs/assets/fonts/AldoPro-Thin.woff2
--------------------------------------------------------------------------------
/docs/index.md:
--------------------------------------------------------------------------------
1 | # Burningwave JVM Driver [](https://twitter.com/intent/tweet?text=%40burningwave_org%20JVM%20driver%2C%20a%20%23Java%20driver%20to%20allow%20deep%20interaction%20with%20the%20JVM%20without%20any%20restrictions&url=https://burningwave.github.io/jvm-driver/)
2 |
3 |
4 |
5 |
6 |
7 | [](https://maven-badges.herokuapp.com/maven-central/org.burningwave/jvm-driver/)
8 | [](https://github.com/burningwave/jvm-driver/blob/main/LICENSE)
9 |
10 | [](https://github.com/burningwave/jvm-driver/actions/runs/14538126883)
11 |
12 | [-blueviolet)](https://github.com/burningwave/jvm-driver/actions/runs/14538126883)
13 |
14 | [](https://github.com/burningwave/jvm-driver/issues)
15 | [](https://github.com/burningwave/jvm-driver/issues?q=is%3Aissue+is%3Aclosed)
16 |
17 | [](https://www.burningwave.org/artifact-downloads/?show-overall-trend-chart=false&artifactId=jvm-driver&startDate=2021-08)
18 | [](https://github.com/burningwave/jvm-driver/network/dependents)
19 | [](https://www.burningwave.org#bw-counters)
20 |
21 | A driver derived from [**ToolFactory JVM Driver**](https://toolfactory.github.io/jvm-driver/) with a fully extensible architecture and with a custom and [**extremely optimized JNI engine**](https://github.com/burningwave/jvm-driver/issues/3#issuecomment-1149840706) to allow deep interaction with the JVM **without any restrictions**.
22 |
23 |
24 |
25 | To include Burningwave JVM Driver in your projects simply use with **Apache Maven**:
26 | ```xml
27 |
28 | org.burningwave
29 | jvm-driver
30 | 8.19.1
31 |
32 | ```
33 | ### Requiring the Burningwave JVM Driver module
34 |
35 | To use Burningwave JMV Driver as a Java module, add the following to your `module-info.java`:
36 |
37 | ```java
38 | //Mandatory if you use the default, dynamic or hybrid driver
39 | requires jdk.unsupported;
40 |
41 | requires org.burningwave.jvm;
42 | ```
43 |
44 |
45 |
46 | ## Overview
47 |
48 | There are four kinds of driver:
49 |
50 | * the **default driver** completely based on Java api
51 | * the **dynamic driver** that extends the default driver and uses a JNI function only if a Java based function offered by the default driver cannot be initialized
52 | * the **hybrid driver** that extends the default driver and uses some JNI functions only when run on JVM 17 and later
53 | * the **native driver** that extends the hybrid driver and uses JNI functions more consistently regardless of the Java version it is running on
54 |
55 | All JNI methods used by the dynamic, hybrid and native driver are supplied by a **custom and highly optimized JNI engine written in C++** that works on the following system configurations:
56 | * Windows x86/x64
57 | * Linux x86/x64
58 | * MacOs x64
59 | * aarch64 (**needs testing**)
60 |
61 |
62 |
63 | ## Usage
64 |
65 | To create a driver instance you should use this code:
66 | ```java
67 | io.github.toolfactory.jvm.Driver driver = io.github.toolfactory.jvm.Driver.getNew();
68 | ```
69 |
70 | The driver type returned by the method `io.github.toolfactory.jvm.Driver.Factory.getNew()` is **the first driver that can be initialized among the default, hybrid and native drivers respectively**.
71 |
72 | If you need to create a specific driver type you should use:
73 |
74 | * this code to create a default driver instance:
75 |
76 | ```java
77 | io.github.toolfactory.jvm.Driver driver = io.github.toolfactory.jvm.Driver.Factory.getNewDefault();
78 | ```
79 |
80 | * this code to create a dynamic driver instance:
81 |
82 | ```java
83 | io.github.toolfactory.jvm.Driver driver = io.github.toolfactory.jvm.Driver.Factory.getNewDynamic();
84 | ```
85 |
86 | * this code to create an hybrid driver instance:
87 |
88 | ```java
89 | io.github.toolfactory.jvm.Driver driver = io.github.toolfactory.jvm.Driver.Factory.getNewHybrid();
90 | ```
91 |
92 | * this code to create a native driver instance:
93 |
94 | ```java
95 | io.github.toolfactory.jvm.Driver driver = io.github.toolfactory.jvm.Driver.Factory.getNewNative();
96 | ```
97 |
98 |
99 |
100 | Each functionality offered by the driver is **initialized in deferred way** at the first call if the driver is not obtained through the method `io.github.toolfactory.jvm.Driver.getNew()`. However, it is possible to initialize all of the functionalities at once by calling the method `Driver.init()`.
101 |
102 | The methods exposed by the Driver interface are the following:
103 | ```java
104 | public D init();
105 |
106 | public T allocateInstance(Class> cls);
107 |
108 | // Return a ClassLoaderDelegate or the input itself if the input is a
109 | // BuiltinClassLoader or null if the JVM version is less than 9
110 | public ClassLoader convertToBuiltinClassLoader(ClassLoader classLoader);
111 |
112 | public Class> defineHookClass(Class> clientClass, byte[] byteCode);
113 |
114 | public Class> getBuiltinClassLoaderClass();
115 |
116 | public Class> getClassLoaderDelegateClass();
117 |
118 | public Class> getClassByName(String className, Boolean initialize, ClassLoader classLoader, Class> caller);
119 |
120 | public MethodHandles.Lookup getConsulter(Class> cls);
121 |
122 | public Constructor[] getDeclaredConstructors(Class cls);
123 |
124 | public Field[] getDeclaredFields(Class> cls);
125 |
126 | public Method[] getDeclaredMethods(Class> cls);
127 |
128 | public T getFieldValue(Object target, Field field);
129 |
130 | public Package getPackage(ClassLoader classLoader, String packageName);
131 |
132 | public Collection getResources(String resourceRelativePath, boolean findFirst, ClassLoader... classLoaders);
133 |
134 | public Collection getResources(String resourceRelativePath, boolean findFirst, Collection classLoaders);
135 |
136 | public T invoke(Object target, Method method, Object[] params);
137 |
138 | public boolean isBuiltinClassLoader(ClassLoader classLoader);
139 |
140 | public boolean isClassLoaderDelegate(ClassLoader classLoader);
141 |
142 | public T newInstance(Constructor ctor, Object[] params);
143 |
144 | public CleanableSupplier>> getLoadedClassesRetriever(ClassLoader classLoader);
145 |
146 | public Map retrieveLoadedPackages(ClassLoader classLoader);
147 |
148 | public void setAccessible(AccessibleObject object, boolean flag);
149 |
150 | public void setFieldValue(Object target, Field field, Object value);
151 |
152 | public void stop(Thread thread);
153 |
154 | public T throwException(String message, Object... placeHolderReplacements);
155 |
156 | public T throwException(Throwable exception);
157 | ```
158 |
159 |
160 |
161 | ## Compilation requirements
162 |
163 | **A JDK version 9 or higher and a GCC compiler are required to compile the project**. On Windows you can find compiler and GDB debugger from [**MinGW-W64 project**](https://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win64/Personal%20Builds/mingw-builds/8.1.0/threads-win32/seh/).
164 |
165 |
166 |
167 | ## Contributing
168 | The [native module](https://github.com/burningwave/jvm-driver/tree/main/native) is currently compiled for Linux x86/x64, Windows x86/x64, and Mac OS X x64: **feel free to contribute native code builds for other platforms or architectures**. Once the native code is compiled you need to add a few lines of code in the [native library loader](https://github.com/burningwave/jvm-driver/blob/main/java/src/main/java/org/burningwave/jvm/util/Libraries.java).
169 |
170 |
171 |
172 | # Ask for assistance
173 | **For assistance you can**:
174 | * [open a discussion](https://github.com/burningwave/jvm-driver/discussions) here on GitHub
175 | * [report a bug](https://github.com/burningwave/jvm-driver/issues) here on GitHub
176 | * ask on [Stack Overflow](https://stackoverflow.com/search?q=burningwave)
177 |
--------------------------------------------------------------------------------
/java/pom.xml:
--------------------------------------------------------------------------------
1 |
31 |
34 | 4.0.0
35 |
36 |
37 | org.burningwave
38 | jvm-driver-parent
39 | ${revision}
40 |
41 |
42 | jvm-driver
43 | 8.19.2-SNAPSHOT
44 |
45 | jar
46 |
47 | Burningwave JVM Driver
48 |
49 | A driver derived from ToolFactory JVM Driver to allow deep interaction with the JVM without any restrictions
50 |
51 | https://burningwave.github.io/jvm-driver/
52 |
53 |
54 |
55 | MIT License
56 | https://github.com/burningwave/jvm-driver/blob/master/LICENSE
57 | repo
58 |
59 |
60 |
61 |
62 | Burningwave
63 | https://www.burningwave.org/
64 |
65 |
66 |
67 |
68 | Roberto Gentili
69 | roberto.gentili
70 | info@burningwave.org
71 | Burningwave
72 | https://www.burningwave.org/
73 |
74 | Administrator
75 | Developer
76 |
77 |
78 |
79 | Alessio Perrotta
80 | info@burningwave.org
81 | Burningwave
82 | https://www.burningwave.org/
83 |
84 | External relationship manager
85 | Developer
86 |
87 |
88 |
89 |
90 |
91 | UTF-8
92 | UTF-8
93 | 7
94 | bin/javadoc
95 | true
96 | AllTestsSuite
97 | **/${project.test.testSuite}.java
98 | **/*Test.java
99 |
100 | 5.10.0
101 | 1.10.0
102 | 9.8.0
103 | 3.1.0
104 | 5.1.9
105 | 3.11.0
106 | 3.3.0
107 | 3.2.0
108 | 3.0.1
109 | 3.2.1
110 |
111 |
112 |
113 |
114 |
115 | io.github.toolfactory
116 | jvm-driver
117 | ${jvm-driver.version}
118 |
119 |
120 | io.github.toolfactory
121 | narcissus
122 |
123 |
124 |
125 |
126 |
127 | org.junit.jupiter
128 | junit-jupiter-engine
129 | ${junit-jupiter.version}
130 | test
131 |
132 |
133 |
134 | org.junit.platform
135 | junit-platform-engine
136 | ${junit.version}
137 | test
138 |
139 |
140 |
141 | org.junit.platform
142 | junit-platform-commons
143 | ${junit.version}
144 | test
145 |
146 |
147 |
148 | org.junit.platform
149 | junit-platform-runner
150 | ${junit.version}
151 | test
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 | ${project.basedir}/../
160 |
161 | **LICENSE
162 |
163 | META-INF
164 |
165 |
166 | ${project.basedir}/src/main/resources
167 |
168 | **
169 |
170 |
171 |
172 | ${project.basedir}/../native/src/main/c-c++
173 |
174 | **
175 |
176 |
177 |
178 |
179 |
180 | ${project.basedir}/src/test/resources
181 |
182 |
183 |
184 |
185 | maven-antrun-plugin
186 | ${maven-antrun-plugin.version}
187 |
188 |
189 |
190 | run
191 |
192 |
193 | compile
194 |
195 |
196 |
197 |
199 |
200 |
201 |
202 |
203 |
204 |
205 | add-module-info-to-jar
206 | package
207 |
208 | run
209 |
210 |
211 |
212 |
214 |
217 |
218 |
219 |
220 |
221 |
222 |
223 |
224 | org.apache.maven.plugins
225 | maven-compiler-plugin
226 | ${maven-compiler-plugin.version}
227 |
228 |
229 | default-compile
230 |
231 |
232 | 9
233 |
234 |
235 |
236 |
237 | default-testCompile
238 |
239 |
240 | module-info.java
241 |
242 | ${project_jdk_version}
243 | true
244 |
245 |
246 |
247 | base-compile
248 |
249 | compile
250 |
251 |
252 |
253 |
254 | module-info.java
255 |
256 | ${project_jdk_version}
257 | ${project_jdk_version}
258 |
259 |
260 |
261 |
262 |
263 | org.apache.maven.plugins
264 | maven-surefire-plugin
265 | ${maven-surefire-plugin.version}
266 |
267 | ${skipTests}
268 |
269 | ${project.test.excludes}
270 |
271 |
272 | ${project.test.includes}
273 |
274 | false
275 |
276 |
277 |
278 | org.apache.felix
279 | maven-bundle-plugin
280 | ${maven-bundle-plugin.version}
281 | true
282 |
283 |
284 | generate-manifest
285 | process-classes
286 |
287 | manifest
288 |
289 |
290 |
291 |
292 | ${project.build.outputDirectory}/META-INF/
293 | true
294 |
295 | Utilities
296 | ${organization.name}
297 | https://github.com/burningwave/jvm-driver/blob/master/LICENSE
298 | 2
299 | JVM Driver
300 | ${project.groupId}.${project.artifactId}
301 | ${organization.name}
302 | ${project.description}
303 | ${project.version}
304 | osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=1.7))"
305 | io.github.toolfactory.jvm;version="${jvm-driver.version}",io.github.toolfactory.jvm.function.catalog;version="${jvm-driver.version}",io.github.toolfactory.jvm.function.template;version="${jvm-driver.version}",io.github.toolfactory.jvm.util;version="${jvm-driver.version}"
306 | true
307 | <_dsannotations>*
308 | <_metatypeannotations>*
309 |
310 |
311 |
312 |
313 | maven-jar-plugin
314 | ${maven-jar-plugin.version}
315 |
316 |
317 | module-info.class
318 | **/*.c
319 | **/*.cpp
320 | **/*.h
321 | META-INF/maven/
322 |
323 |
324 | false
325 | ${project.build.outputDirectory}/META-INF/MANIFEST.MF
326 |
327 |
328 |
329 |
330 | org.apache.maven.plugins
331 | maven-javadoc-plugin
332 | ${maven-javadoc-plugin.version}
333 |
334 | ${java.home}/${javadocExecutable.relativePath}
335 | UTF-8
336 | ${project_jdk_version}
337 |
338 |
339 |
340 | attach-javadoc
341 |
342 | jar
343 |
344 |
345 |
346 |
347 |
348 | org.apache.maven.plugins
349 | maven-source-plugin
350 | ${maven-source-plugin.version}
351 |
352 |
353 | attach-sources
354 |
355 | jar
356 |
357 |
358 |
359 |
360 |
361 |
362 |
--------------------------------------------------------------------------------
/java/src/main/java/module-info.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of Burningwave JVM driver.
3 | *
4 | * Author: Roberto Gentili
5 | *
6 | * Hosted at: https://github.com/burningwave/jvm-driver
7 | *
8 | * --
9 | *
10 | * The MIT License (MIT)
11 | *
12 | * Copyright (c) 2021 Roberto Gentili
13 | *
14 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
15 | * documentation files (the "Software"), to deal in the Software without restriction, including without
16 | * limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
17 | * the Software, and to permit persons to whom the Software is furnished to do so, subject to the following
18 | * conditions:
19 | *
20 | * The above copyright notice and this permission notice shall be included in all copies or substantial
21 | * portions of the Software.
22 | *
23 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
24 | * LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO
25 | * EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
26 | * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
27 | * OR OTHER DEALINGS IN THE SOFTWARE.
28 | */
29 | module org.burningwave.jvm {
30 |
31 | requires io.github.toolfactory.jvm;
32 |
33 | exports org.burningwave.jvm;
34 | exports org.burningwave.jvm.function.catalog;
35 | exports org.burningwave.jvm.util;
36 |
37 | }
38 |
--------------------------------------------------------------------------------
/java/src/main/java/org/burningwave/jvm/DynamicDriver.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of ToolFactory JVM driver.
3 | *
4 | * Hosted at: https://github.com/toolfactory/jvm-driver
5 | *
6 | * --
7 | *
8 | * The MIT License (MIT)
9 | *
10 | * Copyright (c) 2021 Luke Hutchison, Roberto Gentili
11 | *
12 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
13 | * documentation files (the "Software"), to deal in the Software without restriction, including without
14 | * limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
15 | * the Software, and to permit persons to whom the Software is furnished to do so, subject to the following
16 | * conditions:
17 | *
18 | * The above copyright notice and this permission notice shall be included in all copies or substantial
19 | * portions of the Software.
20 | *
21 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
22 | * LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO
23 | * EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
24 | * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
25 | * OR OTHER DEALINGS IN THE SOFTWARE.
26 | */
27 | package org.burningwave.jvm;
28 |
29 |
30 | import java.util.Map;
31 |
32 | import org.burningwave.jvm.function.catalog.AllocateInstanceFunction;
33 | import org.burningwave.jvm.function.catalog.ConsulterSupplier;
34 | import org.burningwave.jvm.function.catalog.GetFieldValueFunction;
35 | import org.burningwave.jvm.function.catalog.GetLoadedClassesRetrieverFunction;
36 | import org.burningwave.jvm.function.catalog.GetLoadedPackagesFunction;
37 | import org.burningwave.jvm.function.catalog.SetAccessibleFunction;
38 | import org.burningwave.jvm.function.catalog.SetFieldValueFunction;
39 |
40 | import io.github.toolfactory.jvm.DefaultDriver;
41 | import io.github.toolfactory.jvm.util.ObjectProvider;
42 | import io.github.toolfactory.jvm.util.ObjectProvider.BuildingException;
43 |
44 |
45 | public class DynamicDriver extends DefaultDriver {
46 |
47 | @Override
48 | protected Map