Skip to content

Commit 4578308

Browse files
authored
[GenAI] Add support for net.java.dev.jna:jna-platform:5.12.1 using gpt-5.5 (#8670)
* Scaffold net.java.dev.jna:jna-platform:5.12.1 * Dynamic-access coverage for com.sun.jna.platform.WindowUtils$MacWindowUtils$1 (4/27) * Dynamic-access coverage for com.sun.jna.platform.win32.COM.util.Convert (4/27) * Dynamic-access coverage for com.sun.jna.platform.win32.DdemlUtil$MessageLoopWrapper (8/27) * Partial dynamic-access coverage for com.sun.jna.platform.WindowUtils$X11WindowUtils (1/2) * Dynamic-access coverage for com.sun.jna.platform.win32.DdemlUtil$StandaloneDdeClient (13/27) * Native metadata for com.sun.jna.platform.win32.DdemlUtil$StandaloneDdeClient__native_batch_5 * Dynamic-access coverage for com.sun.jna.platform.win32.COM.tlb.imp.TlbBase (5/27) * Dynamic-access coverage for com.sun.jna.platform.win32.COM.util.ProxyObject (7/27) * Dynamic-access coverage for com.sun.jna.platform.win32.OaIdlUtil (8/27) * Dynamic-access coverage for com.sun.jna.platform.win32.User32Util$MessageLoopThread$Handler$1 (9/27) * Dynamic-access coverage for com.sun.jna.platform.win32.Win32Exception (10/27) * Native metadata for com.sun.jna.platform.win32.Win32Exception__native_batch_5 * Update generated library support for net.java.dev.jna:jna-platform:5.12.1 * Add support for net.java.dev.jna:jna-platform:5.12.1
1 parent 479c357 commit 4578308

13 files changed

Lines changed: 966 additions & 0 deletions

File tree

metadata/net.java.dev.jna/jna-platform/5.12.1/reachability-metadata.json

Lines changed: 544 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
[
2+
{
3+
"latest" : true,
4+
"metadata-version" : "5.12.1",
5+
"source-code-url" : "https://repo.maven.apache.org/maven2/net/java/dev/jna/jna-platform/$version$/jna-platform-$version$-sources.jar",
6+
"repository-url" : "https://github.com/java-native-access/jna",
7+
"test-code-url" : "https://github.com/java-native-access/jna/tree/$version$/contrib/platform/test",
8+
"documentation-url" : "https://repo.maven.apache.org/maven2/net/java/dev/jna/jna-platform/$version$/jna-platform-$version$-javadoc.jar",
9+
"description" : "JNA Platform provides Java mappings and helper classes for common native platform APIs on top of Java Native Access. It lets JVM applications call operating-system and bundled native library functions without writing JNI code.",
10+
"tested-versions" : [
11+
"5.12.1"
12+
],
13+
"allowed-packages" : [
14+
"com.sun.jna.platform"
15+
]
16+
}
17+
]
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
{
2+
"add_new_library_support:2026-06-26": {
3+
"timestamp": "2026-06-26T19:43:29.285486Z",
4+
"library": "net.java.dev.jna:jna-platform:5.12.1",
5+
"starting_commit": "10ad139d81656f85792e51fe54b94eaef6569352",
6+
"ending_commit": "b5b36a978860633f1504ecb51c73cb72fb87c8d4",
7+
"strategy_name": "dynamic_access_main_sources_pi_gpt-5.5",
8+
"agent": "pi",
9+
"model": "oca/gpt-5.5",
10+
"status": "success_with_intervention",
11+
"stats": {
12+
"version": "5.12.1",
13+
"dynamicAccess": {
14+
"breakdown": {
15+
"reflection": {
16+
"coverageRatio": 0.115385,
17+
"coveredCalls": 3,
18+
"totalCalls": 26
19+
},
20+
"resources": {
21+
"coverageRatio": 1.0,
22+
"coveredCalls": 1,
23+
"totalCalls": 1
24+
}
25+
},
26+
"coverageRatio": 0.148148,
27+
"coveredCalls": 4,
28+
"totalCalls": 27
29+
},
30+
"libraryCoverage": {
31+
"instruction": {
32+
"covered": 285,
33+
"missed": 63083,
34+
"ratio": 0.004498,
35+
"total": 63368
36+
},
37+
"line": {
38+
"covered": 59,
39+
"missed": 14052,
40+
"ratio": 0.004181,
41+
"total": 14111
42+
},
43+
"method": {
44+
"covered": 14,
45+
"missed": 3468,
46+
"ratio": 0.004021,
47+
"total": 3482
48+
}
49+
}
50+
},
51+
"library_preparation_preflight": {
52+
"status": "completed",
53+
"action": "no_action",
54+
"issue_number": 8507,
55+
"issue_label": "library-new-request",
56+
"library": "net.java.dev.jna:jna-platform:5.12.1",
57+
"summary": "jna-platform 5.12.1 only has the expected transitive dependency on net.java.dev.jna:jna:5.12.1 and provides mappings to host OS native libraries; meaningful Linux/POSIX coverage is reachable without extra Maven dependencies, Docker services, or required environment/system properties.",
58+
"deterministic_setup": [],
59+
"agent_guidance": "",
60+
"risks": [
61+
"Many jna-platform APIs are OS-specific; tests that directly exercise Windows COM/Win32, macOS, GUI, X11, or optional native libraries may fail on the Linux/headless CI host.",
62+
"Prefer host-available POSIX/Linux mappings such as libc/sysinfo/resource structures, or pure structure/constant behavior, and guard any platform-specific calls."
63+
],
64+
"applied_setup": [],
65+
"input_evidence": [
66+
{
67+
"name": "issue",
68+
"summary": "#8507 Support for net.java.dev.jna:jna-platform:5.12.1; label=library-new-request; body_chars=39"
69+
},
70+
{
71+
"name": "existing_tests",
72+
"summary": "0 existing test file path(s) included"
73+
}
74+
],
75+
"model": "oca/gpt-5.5",
76+
"input_tokens_used": 49259,
77+
"output_tokens_used": 2964,
78+
"prompt_path": "library-preflight-prompt.txt",
79+
"raw_response_path": "library-preflight-response.txt",
80+
"session_log_path": "/home/vjovanov/c/forge/forge4/graalvm-reachability-metadata/forge/logs/net.java.dev.jna:jna-platform:5.12.1/library-preparation-preflight/pi-generation-2026-06-26T16-56-52-410532Z.log"
81+
},
82+
"metrics": {
83+
"input_tokens_used": 1479375,
84+
"cached_input_tokens_used": 17621504,
85+
"output_tokens_used": 186576,
86+
"iterations": 33,
87+
"cost_usd": 14.4081,
88+
"generated_loc": 128,
89+
"tested_library_loc": 59,
90+
"metadata_entries": 147,
91+
"test_only_metadata_entries": 4,
92+
"code_coverage_percent": 0.42
93+
},
94+
"artifacts": {
95+
"test_file": "tests/src/net.java.dev.jna/jna-platform/5.12.1/src/test/java/net_java_dev_jna/jna_platform/ConvertTest.java",
96+
"metadata_file": "metadata/net.java.dev.jna/jna-platform/5.12.1/reachability-metadata.json"
97+
}
98+
}
99+
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
{
2+
"versions" : [ {
3+
"version" : "5.12.1",
4+
"dynamicAccess" : {
5+
"breakdown" : {
6+
"reflection" : {
7+
"coverageRatio" : 0.115385,
8+
"coveredCalls" : 3,
9+
"totalCalls" : 26
10+
},
11+
"resources" : {
12+
"coverageRatio" : 1.0,
13+
"coveredCalls" : 1,
14+
"totalCalls" : 1
15+
}
16+
},
17+
"coverageRatio" : 0.148148,
18+
"coveredCalls" : 4,
19+
"totalCalls" : 27
20+
},
21+
"libraryCoverage" : {
22+
"instruction" : {
23+
"covered" : 285,
24+
"missed" : 63083,
25+
"ratio" : 0.004498,
26+
"total" : 63368
27+
},
28+
"line" : {
29+
"covered" : 59,
30+
"missed" : 14052,
31+
"ratio" : 0.004181,
32+
"total" : 14111
33+
},
34+
"method" : {
35+
"covered" : 14,
36+
"missed" : 3468,
37+
"ratio" : 0.004021,
38+
"total" : 3482
39+
}
40+
}
41+
} ]
42+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
gradlew.bat
2+
gradlew
3+
gradle/
4+
build/
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/*
2+
* Copyright and related rights waived via CC0
3+
*
4+
* You should have received a copy of the CC0 legalcode along with this
5+
* work. If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.
6+
*/
7+
plugins {
8+
id "org.graalvm.internal.tck"
9+
}
10+
11+
String libraryVersion = tck.testedLibraryVersion.get()
12+
13+
dependencies {
14+
testImplementation "net.java.dev.jna:jna-platform:$libraryVersion"
15+
testImplementation 'org.assertj:assertj-core:3.22.0'
16+
}
17+
18+
graalvmNative {
19+
agent {
20+
defaultMode = "conditional"
21+
modes {
22+
conditional {
23+
userCodeFilterPath = "user-code-filter.json"
24+
}
25+
}
26+
}
27+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Optional explicit tested library coordinates (format: group:artifact:version).
2+
# If omitted, fallback resolution in org.graalvm.internal.tck.gradle still uses
3+
# environment variable GVM_TCK_LC and then this property.
4+
library.coordinates = net.java.dev.jna:jna-platform:5.12.1
5+
library.version = 5.12.1
6+
metadata.dir = net.java.dev.jna/jna-platform/5.12.1/
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/*
2+
* Copyright and related rights waived via CC0
3+
*
4+
* You should have received a copy of the CC0 legalcode along with this
5+
* work. If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.
6+
*/
7+
pluginManagement {
8+
def tckPath = Objects.requireNonNullElse(
9+
System.getenv("GVM_TCK_TCKDIR"),
10+
"../../../../tck-build-logic"
11+
)
12+
includeBuild(tckPath)
13+
repositories { mavenLocal(); gradlePluginPortal() }
14+
}
15+
16+
plugins {
17+
id "org.graalvm.internal.tck-settings" version "1.0.0-SNAPSHOT"
18+
}
19+
20+
rootProject.name = 'net.java.dev.jna.jna-platform_tests'
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
/*
2+
* Copyright and related rights waived via CC0
3+
*
4+
* You should have received a copy of the CC0 legalcode along with this
5+
* work. If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.
6+
*/
7+
package net_java_dev_jna.jna_platform;
8+
9+
import static org.assertj.core.api.Assertions.assertThat;
10+
11+
import java.lang.reflect.Method;
12+
13+
import org.junit.jupiter.api.Test;
14+
15+
import com.sun.jna.platform.win32.COM.util.IComEnum;
16+
17+
public class ConvertTest {
18+
@Test
19+
void toComEnumUsesEnumValuesMethodToSelectMatchingValue() throws Exception {
20+
TestComChoice choice = (TestComChoice) convertMethod("toComEnum", Class.class, Object.class)
21+
.invoke(null, TestComChoice.class, TestComChoice.SECOND.getValue());
22+
23+
assertThat(choice).isEqualTo(TestComChoice.SECOND);
24+
}
25+
26+
private static Method convertMethod(String name, Class<?>... parameterTypes) throws Exception {
27+
Class<?> convertClass = Class.forName("com.sun.jna.platform.win32.COM.util.Convert");
28+
Method method = convertClass.getDeclaredMethod(name, parameterTypes);
29+
method.setAccessible(true);
30+
return method;
31+
}
32+
33+
public enum TestComChoice implements IComEnum {
34+
FIRST(1),
35+
SECOND(2);
36+
37+
private final long value;
38+
39+
TestComChoice(long value) {
40+
this.value = value;
41+
}
42+
43+
@Override
44+
public long getValue() {
45+
return value;
46+
}
47+
}
48+
}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
/*
2+
* Copyright and related rights waived via CC0
3+
*
4+
* You should have received a copy of the CC0 legalcode along with this
5+
* work. If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.
6+
*/
7+
package net_java_dev_jna.jna_platform;
8+
9+
import static org.assertj.core.api.Assertions.assertThat;
10+
11+
import org.junit.jupiter.api.Test;
12+
13+
import com.sun.jna.platform.win32.COM.tlb.imp.TlbBase;
14+
15+
public class TlbBaseTest {
16+
@Test
17+
void constructorLoadsClasspathTemplateIntoClassBuffer() {
18+
TemplateBackedTlbBase tlbBase = new TemplateBackedTlbBase();
19+
20+
assertThat(tlbBase.getClassBuffer()).isNotNull();
21+
assertThat(tlbBase.getClassBuffer().toString())
22+
.contains("package ${packagename};")
23+
.contains("public class ${classname} extends Structure")
24+
.contains("${content}");
25+
}
26+
27+
@Test
28+
void templateContentCanBeSpecializedAfterLoading() {
29+
TemplateBackedTlbBase tlbBase = new TemplateBackedTlbBase();
30+
31+
tlbBase.createContent("public static final int ANSWER = 42;");
32+
33+
assertThat(tlbBase.getClassBuffer().toString())
34+
.contains("public static final int ANSWER = 42;")
35+
.doesNotContain("${content}");
36+
}
37+
38+
private static final class TemplateBackedTlbBase extends TlbBase {
39+
private TemplateBackedTlbBase() {
40+
super(0, null, null);
41+
}
42+
43+
@Override
44+
protected String getClassTemplate() {
45+
return "com/sun/jna/platform/win32/COM/tlb/imp/TlbEnum.template";
46+
}
47+
}
48+
}

0 commit comments

Comments
 (0)