Bug 121171

Summary: Add @NonNull annotation to out parameters in java interfaces generated by javamaker
Product: LibreOffice Reporter: straub
Component: sdkAssignee: Not Assigned <libreoffice-bugs>
Status: RESOLVED WONTFIX    
Severity: normal CC: noelgrandin, xiscofauli
Priority: medium    
Version: 6.1.0.3 release   
Hardware: All   
OS: All   
Whiteboard:
Crash report or crash signature: Regression By:

Description straub 2018-11-05 09:59:56 UTC
Java interfaces generated by javamaker doesn't seem to use the @NonNull annotation for out parameters.
When calling such a method with a null argument where an out parameter is expected, the java uno bridge will terminate with an exception triggered by the following code in urp.java (because args[i] == null).

         if (argTypes != null) {
             for (int i = 0; i < argTypes.length; ++i) {
                 if (argTypes[i] != null) {
                     Array.set(
                         args[i], 0,
                         unmarshal.readValue(
                             argTypes[i].getComponentType()));

When adding @NonNull to such out arguments, java would prevent the caller to accidentally pass null.

To make this method more safe, I'd suggest to also add a try/catch around the Array.set(...) call, which would return an exception to the caller.
Comment 1 Xisco Faulí 2019-01-15 15:22:54 UTC
Hello,
Would you like to work on this issue?
You can submit your patch to gerrit ( https://wiki.documentfoundation.org/Development/gerrit/SubmitPatch ) and core developers will review it...
Comment 2 Xisco Faulí 2019-03-21 13:00:36 UTC Comment hidden (obsolete)
Comment 3 Xisco Faulí 2019-03-21 13:24:21 UTC
@Noel, I would like to hear your opinion on this, do you think it can be turned into an easyhack ?
Comment 4 Noel Grandin 2019-03-24 10:43:03 UTC
@xisco, probably not, this will require some kind of compatibility work, because adding those things to the interfaces will add another library requirement to the Java UDK which means it's an ABI change
Comment 5 Xisco Faulí 2019-03-25 10:19:16 UTC
(In reply to Noel Grandin from comment #4)
> @xisco, probably not, this will require some kind of compatibility work,
> because adding those things to the interfaces will add another library
> requirement to the Java UDK which means it's an ABI change

Hi Noel,
Thanks for replying.
I think we can close it as RESOLVED WONTFIX then.