Generate JNI code for built in Integer class

TBR=sakal@webrtc.org

Bug: webrtc:8279
Change-Id: Ic2e5d169f11a0d4a88086d61f737f33ab9e86447
Reviewed-on: https://webrtc-review.googlesource.com/24220
Reviewed-by: Magnus Jedvert <magjed@webrtc.org>
Commit-Queue: Magnus Jedvert <magjed@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#20881}
This commit is contained in:
Magnus Jedvert
2017-11-18 16:20:52 +01:00
committed by Commit Bot
parent 18b823e0f5
commit a319931f3c
3 changed files with 10 additions and 29 deletions

View File

@ -1,24 +0,0 @@
/*
* Copyright 2017 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
package org.webrtc;
/** This class contains the Java glue code for JNI generation of Integer handling. */
class IntegerWrapper {
@CalledByNative
static Integer create(int i) {
return Integer.valueOf(i);
}
@CalledByNative
static int getIntValue(Integer i) {
return i;
}
}

View File

@ -15,7 +15,7 @@
#include <unistd.h>
#include <vector>
#include "sdk/android/generated_base_jni/jni/IntegerWrapper_jni.h"
#include "sdk/android/generated_external_classes_jni/jni/Integer_jni.h"
#include "sdk/android/src/jni/class_loader.h"
#include "sdk/android/src/jni/classreferenceholder.h"
@ -278,7 +278,7 @@ std::vector<std::string> JavaToStdVectorStrings(JNIEnv* jni, jobject list) {
rtc::Optional<int32_t> JavaIntegerToOptionalInt(JNIEnv* jni, jobject integer) {
if (IsNull(jni, integer))
return rtc::nullopt;
return Java_IntegerWrapper_getIntValue(jni, integer);
return JNI_Integer::Java_Integer_intValue(jni, integer);
}
jobject JavaIntegerFromOptionalInt(JNIEnv* jni,
@ -287,7 +287,7 @@ jobject JavaIntegerFromOptionalInt(JNIEnv* jni,
}
jobject JavaIntegerFromInt(JNIEnv* jni, int32_t i) {
return Java_IntegerWrapper_create(jni, i);
return JNI_Integer::Java_Integer_ConstructorJLI_I(jni, i);
}
// Return the (singleton) Java Enum object corresponding to |index|;