Fix calling functions with only VarArgs (without fixed parameters)#764
Merged
matthiasblaesing merged 1 commit intojava-native-access:masterfrom Feb 4, 2017
Merged
Conversation
The change in 50eb820 introduces the detection of the count of the fixed parameters of a VarArgs call. The logic detecting whether this call was even a VarArgs call was changed to be true if fixed parameter count is not null. This is not correct, as the method call could contain only fixed parameters or a VarArgs call could be done without fixed parameters. Closes: java-native-access#763
twall
reviewed
Feb 3, 2017
| public int addVarArgs(String fmt, Number... args); | ||
| public String returnStringVarArgs(String fmt, Object... args); | ||
| public void modifyStructureVarArgs(String fmt, Object arg1, Object... args); | ||
| public String returnStringVarArgs(String... args); |
Contributor
There was a problem hiding this comment.
Varargs with no fixed arguments aren't possible in C (though they may be in other languages). In C you'd have to directly access the stack pointer to find the address of arguments, which may be compiler or processor-dependent.
twall
reviewed
Feb 3, 2017
| public void testStringVarArgsFull() { | ||
| Object[] args = new Object[] { "Test" }; | ||
| assertEquals("Did not return correct string", args[0], | ||
| lib.returnStringVarArgs("", "Test")); |
Contributor
There was a problem hiding this comment.
I think you'd want to test passing no arguments here. Perhaps this "bug" is an issue with the client (java) code?
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.
The change in 50eb820 introduces
the detection of the count of the fixed parameters of a VarArgs call.
The logic detecting whether this call was even a VarArgs call was
changed to be true if fixed parameter count is not null. This is
not correct, as the method call could contain only fixed parameters
or a VarArgs call could be done without fixed parameters.
Closes: #763