mirror of
https://github.com/sqlite/sqlite.git
synced 2025-07-30 19:03:16 +03:00
JNI: add the @Experimental annotation and mark all java.nio.ByteBuffer-related methods with it.
FossilOrigin-Name: 0f4b223102e5dc9142c9d2cb8892b8d3cc476e579420028b93d4e12f4cf94d3e
This commit is contained in:
30
ext/jni/src/org/sqlite/jni/annotation/Experimental.java
Normal file
30
ext/jni/src/org/sqlite/jni/annotation/Experimental.java
Normal file
@ -0,0 +1,30 @@
|
||||
/*
|
||||
** 2023-09-27
|
||||
**
|
||||
** The author disclaims copyright to this source code. In place of
|
||||
** a legal notice, here is a blessing:
|
||||
**
|
||||
** May you do good and not evil.
|
||||
** May you find forgiveness for yourself and forgive others.
|
||||
** May you share freely, never taking more than you give.
|
||||
**
|
||||
*************************************************************************
|
||||
** This file houses the Experimental annotation for the sqlite3 C API.
|
||||
*/
|
||||
package org.sqlite.jni.annotation;
|
||||
import java.lang.annotation.*;
|
||||
|
||||
/**
|
||||
This annotation is for flagging methods, constructors, and types
|
||||
which are expressly experimental and subject to any amount of
|
||||
change or outright removal. Client code should not rely on such
|
||||
features.
|
||||
*/
|
||||
@Documented
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
@Target({
|
||||
ElementType.METHOD,
|
||||
ElementType.CONSTRUCTOR,
|
||||
ElementType.TYPE
|
||||
})
|
||||
public @interface Experimental{}
|
@ -9,9 +9,10 @@
|
||||
** May you share freely, never taking more than you give.
|
||||
**
|
||||
*************************************************************************
|
||||
** This file houses the NotNull annotaion for the sqlite3 C API.
|
||||
** This file houses the NotNull annotation for the sqlite3 C API.
|
||||
*/
|
||||
package org.sqlite.jni.annotation;
|
||||
import java.lang.annotation.*;
|
||||
|
||||
/**
|
||||
This annotation is for flagging parameters which may not legally be
|
||||
@ -64,7 +65,7 @@ package org.sqlite.jni.annotation;
|
||||
part of the public API and client-level code must not rely on
|
||||
it.</p>
|
||||
*/
|
||||
@java.lang.annotation.Documented
|
||||
@java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.SOURCE)
|
||||
@java.lang.annotation.Target(java.lang.annotation.ElementType.PARAMETER)
|
||||
@Documented
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
@Target(ElementType.PARAMETER)
|
||||
public @interface NotNull{}
|
||||
|
@ -9,9 +9,10 @@
|
||||
** May you share freely, never taking more than you give.
|
||||
**
|
||||
*************************************************************************
|
||||
** This file houses the Nullable annotaion for the sqlite3 C API.
|
||||
** This file houses the Nullable annotation for the sqlite3 C API.
|
||||
*/
|
||||
package org.sqlite.jni.annotation;
|
||||
import java.lang.annotation.*;
|
||||
|
||||
/**
|
||||
This annotation is for flagging parameters which may legally be
|
||||
@ -26,7 +27,7 @@ package org.sqlite.jni.annotation;
|
||||
annotated functions. It is not part of the public API and
|
||||
client-level code must not rely on it.
|
||||
*/
|
||||
@java.lang.annotation.Documented
|
||||
@java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.SOURCE)
|
||||
@java.lang.annotation.Target(java.lang.annotation.ElementType.PARAMETER)
|
||||
@Documented
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
@Target(ElementType.PARAMETER)
|
||||
public @interface Nullable{}
|
||||
|
@ -9,7 +9,7 @@
|
||||
** May you share freely, never taking more than you give.
|
||||
**
|
||||
*************************************************************************
|
||||
** This file declares JNI bindings for the sqlite3 C API.
|
||||
** This file declares the main JNI bindings for the sqlite3 C API.
|
||||
*/
|
||||
package org.sqlite.jni.capi;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
@ -129,6 +129,7 @@ public final class CApi {
|
||||
Returns true if this JVM has JNI-level support for C-level direct
|
||||
memory access using java.nio.ByteBuffer, else returns false.
|
||||
*/
|
||||
@Experimental
|
||||
public static native boolean sqlite3_jni_supports_nio();
|
||||
|
||||
/**
|
||||
@ -254,6 +255,7 @@ public final class CApi {
|
||||
Convenience overload which is a simple proxy for
|
||||
sqlite3_bind_nio_buffer().
|
||||
*/
|
||||
@Experimental
|
||||
public static int sqlite3_bind_blob(
|
||||
@NotNull sqlite3_stmt stmt, int ndx, @Nullable java.nio.ByteBuffer data,
|
||||
int begin, int n
|
||||
@ -266,6 +268,7 @@ public final class CApi {
|
||||
to sqlite3_bind_nio_buffer() with the values 0 and -1 for the
|
||||
final two arguments.
|
||||
*/
|
||||
@Experimental
|
||||
public static int sqlite3_bind_blob(
|
||||
@NotNull sqlite3_stmt stmt, int ndx, @Nullable java.nio.ByteBuffer data
|
||||
){
|
||||
@ -342,6 +345,7 @@ public final class CApi {
|
||||
|
||||
@see https://docs.oracle.com/javase/8/docs/api/java/nio/Buffer.html
|
||||
*/
|
||||
@Experimental
|
||||
public static native int sqlite3_bind_nio_buffer(
|
||||
@NotNull sqlite3_stmt stmt, int ndx, @Nullable java.nio.ByteBuffer data,
|
||||
int beginPos, int howMany
|
||||
@ -351,6 +355,7 @@ public final class CApi {
|
||||
Convenience overload which binds the given buffer's entire
|
||||
contents, up to its limit() (as opposed to its capacity()).
|
||||
*/
|
||||
@Experimental
|
||||
public static int sqlite3_bind_nio_buffer(
|
||||
@NotNull sqlite3_stmt stmt, int ndx, @Nullable java.nio.ByteBuffer data
|
||||
){
|
||||
@ -578,6 +583,7 @@ public final class CApi {
|
||||
/**
|
||||
An internal level of indirection.
|
||||
*/
|
||||
@Experimental
|
||||
private static native int sqlite3_blob_read_nio_buffer(
|
||||
@NotNull long ptrToBlob, int srcOffset,
|
||||
@NotNull java.nio.ByteBuffer tgt, int tgtOffset, int howMany
|
||||
@ -593,6 +599,7 @@ public final class CApi {
|
||||
succeeds, it returns the result of the underlying call to
|
||||
sqlite3_blob_read() (0 on success).
|
||||
*/
|
||||
@Experimental
|
||||
public static int sqlite3_blob_read_nio_buffer(
|
||||
@NotNull sqlite3_blob src, int srcOffset,
|
||||
@NotNull java.nio.ByteBuffer tgt, int tgtOffset, int howMany
|
||||
@ -616,6 +623,7 @@ public final class CApi {
|
||||
the src blob, or the underlying call to sqlite3_blob_read() fails
|
||||
for any reason.
|
||||
*/
|
||||
@Experimental
|
||||
public static java.nio.ByteBuffer sqlite3_blob_read_nio_buffer(
|
||||
@NotNull sqlite3_blob src, int srcOffset, int howMany
|
||||
){
|
||||
@ -636,6 +644,7 @@ public final class CApi {
|
||||
/**
|
||||
Overload alias for sqlite3_blob_read_nio_buffer().
|
||||
*/
|
||||
@Experimental
|
||||
public static int sqlite3_blob_read(
|
||||
@NotNull sqlite3_blob src, int srcOffset,
|
||||
@NotNull java.nio.ByteBuffer tgt,
|
||||
@ -658,6 +667,7 @@ public final class CApi {
|
||||
null or sqlite3_jni_supports_nio() returns false. Else it returns
|
||||
the result of the underlying call to sqlite3_blob_read().
|
||||
*/
|
||||
@Experimental
|
||||
public static int sqlite3_blob_read(
|
||||
@NotNull sqlite3_blob src,
|
||||
@NotNull java.nio.ByteBuffer tgt
|
||||
@ -694,6 +704,7 @@ public final class CApi {
|
||||
/**
|
||||
An internal level of indirection.
|
||||
*/
|
||||
@Experimental
|
||||
private static native int sqlite3_blob_write_nio_buffer(
|
||||
@NotNull long ptrToBlob, int tgtOffset,
|
||||
@NotNull java.nio.ByteBuffer src,
|
||||
@ -715,6 +726,7 @@ public final class CApi {
|
||||
either offset is negative. If argument validation succeeds, it
|
||||
returns the result of the underlying call to sqlite3_blob_read().
|
||||
*/
|
||||
@Experimental
|
||||
public static int sqlite3_blob_write_nio_buffer(
|
||||
@NotNull sqlite3_blob tgt, int tgtOffset,
|
||||
@NotNull java.nio.ByteBuffer src,
|
||||
@ -728,6 +740,7 @@ public final class CApi {
|
||||
/**
|
||||
Overload alias for sqlite3_blob_write_nio_buffer().
|
||||
*/
|
||||
@Experimental
|
||||
public static int sqlite3_blob_write(
|
||||
@NotNull sqlite3_blob tgt, int tgtOffset,
|
||||
@NotNull java.nio.ByteBuffer src,
|
||||
@ -742,6 +755,7 @@ public final class CApi {
|
||||
Convenience overload which writes all of src to the given offset
|
||||
of b.
|
||||
*/
|
||||
@Experimental
|
||||
public static int sqlite3_blob_write(
|
||||
@NotNull sqlite3_blob tgt, int tgtOffset,
|
||||
@NotNull java.nio.ByteBuffer src
|
||||
@ -755,6 +769,7 @@ public final class CApi {
|
||||
Convenience overload which writes all of src to offset 0
|
||||
of tgt.
|
||||
*/
|
||||
@Experimental
|
||||
public static int sqlite3_blob_write(
|
||||
@NotNull sqlite3_blob tgt,
|
||||
@NotNull java.nio.ByteBuffer src
|
||||
@ -910,6 +925,7 @@ public final class CApi {
|
||||
sqlite3_jni_supports_nio() is false, or if sqlite3_column_blob()
|
||||
would return null for the same inputs.
|
||||
*/
|
||||
@Experimental
|
||||
public static native java.nio.ByteBuffer sqlite3_column_nio_buffer(
|
||||
@NotNull sqlite3_stmt stmt, int ndx
|
||||
);
|
||||
@ -1831,6 +1847,7 @@ public final class CApi {
|
||||
If the resulting slice of the buffer exceeds SQLITE_LIMIT_LENGTH
|
||||
then this function behaves like sqlite3_result_error_toobig().
|
||||
*/
|
||||
@Experimental
|
||||
public static native void sqlite3_result_nio_buffer(
|
||||
@NotNull sqlite3_context cx, @Nullable java.nio.ByteBuffer blob,
|
||||
int begin, int n
|
||||
@ -1840,6 +1857,7 @@ public final class CApi {
|
||||
Convenience overload which uses the whole input object
|
||||
as the result blob content.
|
||||
*/
|
||||
@Experimental
|
||||
public static void sqlite3_result_nio_buffer(
|
||||
@NotNull sqlite3_context cx, @Nullable java.nio.ByteBuffer blob
|
||||
){
|
||||
@ -1944,6 +1962,7 @@ public final class CApi {
|
||||
Convenience overload which behaves like
|
||||
sqlite3_result_nio_buffer().
|
||||
*/
|
||||
@Experimental
|
||||
public static void sqlite3_result_blob(
|
||||
@NotNull sqlite3_context cx, @Nullable java.nio.ByteBuffer blob,
|
||||
int begin, int n
|
||||
@ -1955,6 +1974,7 @@ public final class CApi {
|
||||
Convenience overload which behaves like the two-argument overload of
|
||||
sqlite3_result_nio_buffer().
|
||||
*/
|
||||
@Experimental
|
||||
public static void sqlite3_result_blob(
|
||||
@NotNull sqlite3_context cx, @Nullable java.nio.ByteBuffer blob
|
||||
){
|
||||
@ -2366,6 +2386,7 @@ public final class CApi {
|
||||
sqlite3_jni_supports_nio() is false, or if sqlite3_value_blob()
|
||||
would return null for the same input.
|
||||
*/
|
||||
@Experimental
|
||||
public static native java.nio.ByteBuffer sqlite3_value_nio_buffer(
|
||||
@NotNull sqlite3_value v
|
||||
);
|
||||
|
Reference in New Issue
Block a user