Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.
SWT/Devel/Gtk/Sentinel warning
In certain cases, you may encounter a warning: missing sentinel
compilation warning. This occurs when dealing with function calls that have a terminator parameter, in order to signify the end of a variable argument length function.
For example, see gtk_file_chooser_dialog_new()
defined in OS.java
as follows:
/** * @param title cast=(const gchar *),flags=no_out * @param parent cast=(GtkWindow *) * @param first_button_text cast=(const gchar *),flags=no_out * @param terminator cast=(const gchar *),flags=sentinel */ public static final native long /*int*/ _gtk_file_chooser_dialog_new(byte[] title, long /*int*/ parent, int action, long /*int*/ first_button_text, int first_button_id, long /*int*/ second_button_text, int second_button_id, long /*int*/ terminator); public static final long /*int*/ gtk_file_chooser_dialog_new(byte[] title, long /*int*/ parent, int action, long /*int*/ first_button_text, int first_button_id, long /*int*/ second_button_text, int second_button_id, long /*int*/ terminator) { lock.lock(); try { return _gtk_file_chooser_dialog_new(title, parent, action, first_button_text, first_button_id, second_button_text, second_button_id, terminator); } finally { lock.unlock(); } }
Notice the flags=sentinel
for terminator parameter. This flag alerts the compiler to the fact that this is a terminator value, and should be regarded as Null
. This is necessary even if the function is only called with a Null
value for the terminator. Adding this flag should remove any sentinel warnings for that parameter.
For further reference/information, consult the SWT JNIGen Tool Metadata page.