Fix parameter mismatch in CreateSwtWebView2Options native declaration - #3526
Open
GreenFuze wants to merge 1 commit into
Open
Fix parameter mismatch in CreateSwtWebView2Options native declaration#3526GreenFuze wants to merge 1 commit into
GreenFuze wants to merge 1 commit into
Conversation
The Java declaration takes no parameters:
public static final native long CreateSwtWebView2Options();
while the C++ stub that implements it takes one:
JNIEXPORT jlong JNICALL COM_NATIVE(CreateSwtWebView2Options)
(JNIEnv *env, jclass that, jobject host)
The JVM binds a native method by its SYMBOL, not by its signature - the
argument descriptor appears in the entry symbol only for overloaded natives -
so nothing checks that the two ends agree. The stub is entered with two
arguments pushed and reads a third from wherever the calling convention says
it lives.
The value read is currently harmless because the parameter is unused, and the
parameter itself looks like a copy of the neighbouring CreateSwtWebView2Host,
which does use its host argument. It becomes a real defect the moment the
parameter is read.
The Java side is the correct one: SwtWebView2Options::Create() takes no
arguments, and the sole caller, Edge.java:619, passes none.
Fixes eclipse-platform#3519
Signed-off-by: TCs <green.fuzer@gmail.com>
Contributor
HeikoKlare
approved these changes
Aug 18, 2026
HeikoKlare
left a comment
Contributor
There was a problem hiding this comment.
Thank you for contributing this fix.
The issue analysis and the derived change are sound.
This changes native code, so the Windows libraries need rebuilding and possibly a Library.REVISION bump. I have not touched Library.java or the checked-in binaries, since I cannot produce the official Windows builds — please tell me if you would like the version bump included here, or whether that is handled on your side.
The natives will automatically be regenerated when this PR is merged. The CI build already executed a natives compilation on the fly to validate the change.
This can be merged as soon as development opens for 2026-12.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #3519.
The Java declaration takes no parameters:
while the C++ stub that implements it takes one:
The JVM binds a native method by its symbol, not by its signature — the argument descriptor appears in the entry symbol only for overloaded natives — so nothing checks that the two ends agree. The stub is entered with two arguments pushed and reads a third from wherever the calling convention says it lives.
The value read is currently harmless because the parameter is unused, and the parameter itself looks like a copy of the neighbouring
CreateSwtWebView2Host, which does use itshostargument. It becomes a real defect the moment the parameter is read.The Java side is the correct one:
SwtWebView2Options::Create()takes no arguments, and the sole caller —Edge.java:619— passes none.One question for a committer
This changes native code, so the Windows libraries need rebuilding and possibly a
Library.REVISIONbump. I have not touchedLibrary.javaor the checked-in binaries, since I cannot produce the official Windows builds — please tell me if you would like the version bump included here, or whether that is handled on your side.Reported and fixed as part of a research project on cross-language contract checking; the mismatch was found by static comparison of the two declarations rather than by a failing test, which is why the issue quotes no reproducer.