Hm, I'll try. Thanks for the paste. It seems jni_generator.py it's putting weird '<E>'s where they don't belong.
This is in response to some older posts. If your HashSet.jni.h file is giving you problems, you need to first make sure you are using JDK 6. Then, if you don't want to lose your progress, instead of resetting your entire build with a "make clobber", you can just remove the <E>'s wherever they are. I did it to mine and it kept right on building. Or, better yet, you could just paste in my HashSet_jni.h as follows:
Code:
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// This file is autogenerated by
// base/android/jni_generator/jni_generator.py
// For
// java/util/HashSet
#ifndef java_util_HashSet_JNI
#define java_util_HashSet_JNI
#include <jni.h>
#include "base/android/jni_android.h"
#include "base/android/scoped_java_ref.h"
#include "base/basictypes.h"
#include "base/logging.h"
using base::android::ScopedJavaLocalRef;
// Step 1: forward declarations.
namespace {
const char kHashSetClassPath[] = "java/util/HashSet";
// Leaking this jclass as we cannot use LazyInstance from some threads.
jclass g_HashSet_clazz = NULL;
} // namespace
namespace JNI_HashSet {
// Step 2: method stubs.
static base::subtle::AtomicWord g_HashSet_add = 0;
static jboolean Java_HashSet_add(JNIEnv* env, jobject obj, jobject p0)
__attribute__ ((unused));
static jboolean Java_HashSet_add(JNIEnv* env, jobject obj, jobject p0) {
/* Must call RegisterNativesImpl() */
DCHECK(g_HashSet_clazz);
jmethodID method_id =
base::android::MethodID::LazyGet<
base::android::MethodID::TYPE_INSTANCE>(
env, g_HashSet_clazz,
"add",
"("
"Ljava/util/E;"
")"
"Z",
&g_HashSet_add);
jboolean ret =
env->CallBooleanMethod(obj,
method_id, p0);
base::android::CheckException(env);
return ret;
}
static base::subtle::AtomicWord g_HashSet_clear = 0;
static void Java_HashSet_clear(JNIEnv* env, jobject obj) __attribute__
((unused));
static void Java_HashSet_clear(JNIEnv* env, jobject obj) {
/* Must call RegisterNativesImpl() */
DCHECK(g_HashSet_clazz);
jmethodID method_id =
base::android::MethodID::LazyGet<
base::android::MethodID::TYPE_INSTANCE>(
env, g_HashSet_clazz,
"clear",
"("
")"
"V",
&g_HashSet_clear);
env->CallVoidMethod(obj,
method_id);
base::android::CheckException(env);
}
static base::subtle::AtomicWord g_HashSet_clone = 0;
static ScopedJavaLocalRef<jobject> Java_HashSet_clone(JNIEnv* env, jobject
obj) __attribute__ ((unused));
static ScopedJavaLocalRef<jobject> Java_HashSet_clone(JNIEnv* env, jobject
obj) {
/* Must call RegisterNativesImpl() */
DCHECK(g_HashSet_clazz);
jmethodID method_id =
base::android::MethodID::LazyGet<
base::android::MethodID::TYPE_INSTANCE>(
env, g_HashSet_clazz,
"clone",
"("
")"
"Ljava/lang/Object;",
&g_HashSet_clone);
jobject ret =
env->CallObjectMethod(obj,
method_id);
base::android::CheckException(env);
return ScopedJavaLocalRef<jobject>(env, ret);
}
static base::subtle::AtomicWord g_HashSet_contains = 0;
static jboolean Java_HashSet_contains(JNIEnv* env, jobject obj, jobject p0)
__attribute__ ((unused));
static jboolean Java_HashSet_contains(JNIEnv* env, jobject obj, jobject p0) {
/* Must call RegisterNativesImpl() */
DCHECK(g_HashSet_clazz);
jmethodID method_id =
base::android::MethodID::LazyGet<
base::android::MethodID::TYPE_INSTANCE>(
env, g_HashSet_clazz,
"contains",
"("
"Ljava/lang/Object;"
")"
"Z",
&g_HashSet_contains);
jboolean ret =
env->CallBooleanMethod(obj,
method_id, p0);
base::android::CheckException(env);
return ret;
}
static base::subtle::AtomicWord g_HashSet_isEmpty = 0;
static jboolean Java_HashSet_isEmpty(JNIEnv* env, jobject obj) __attribute__
((unused));
static jboolean Java_HashSet_isEmpty(JNIEnv* env, jobject obj) {
/* Must call RegisterNativesImpl() */
DCHECK(g_HashSet_clazz);
jmethodID method_id =
base::android::MethodID::LazyGet<
base::android::MethodID::TYPE_INSTANCE>(
env, g_HashSet_clazz,
"isEmpty",
"("
")"
"Z",
&g_HashSet_isEmpty);
jboolean ret =
env->CallBooleanMethod(obj,
method_id);
base::android::CheckException(env);
return ret;
}
static base::subtle::AtomicWord g_HashSet_iterator = 0;
static ScopedJavaLocalRef<jobject> Java_HashSet_iterator(JNIEnv* env, jobject
obj) __attribute__ ((unused));
static ScopedJavaLocalRef<jobject> Java_HashSet_iterator(JNIEnv* env, jobject
obj) {
/* Must call RegisterNativesImpl() */
DCHECK(g_HashSet_clazz);
jmethodID method_id =
base::android::MethodID::LazyGet<
base::android::MethodID::TYPE_INSTANCE>(
env, g_HashSet_clazz,
"iterator",
"("
")"
"Ljava/util/Iterator;",
&g_HashSet_iterator);
jobject ret =
env->CallObjectMethod(obj,
method_id);
base::android::CheckException(env);
return ScopedJavaLocalRef<jobject>(env, ret);
}
static base::subtle::AtomicWord g_HashSet_remove = 0;
static jboolean Java_HashSet_remove(JNIEnv* env, jobject obj, jobject p0)
__attribute__ ((unused));
static jboolean Java_HashSet_remove(JNIEnv* env, jobject obj, jobject p0) {
/* Must call RegisterNativesImpl() */
DCHECK(g_HashSet_clazz);
jmethodID method_id =
base::android::MethodID::LazyGet<
base::android::MethodID::TYPE_INSTANCE>(
env, g_HashSet_clazz,
"remove",
"("
"Ljava/lang/Object;"
")"
"Z",
&g_HashSet_remove);
jboolean ret =
env->CallBooleanMethod(obj,
method_id, p0);
base::android::CheckException(env);
return ret;
}
static base::subtle::AtomicWord g_HashSet_size = 0;
static jint Java_HashSet_size(JNIEnv* env, jobject obj) __attribute__
((unused));
static jint Java_HashSet_size(JNIEnv* env, jobject obj) {
/* Must call RegisterNativesImpl() */
DCHECK(g_HashSet_clazz);
jmethodID method_id =
base::android::MethodID::LazyGet<
base::android::MethodID::TYPE_INSTANCE>(
env, g_HashSet_clazz,
"size",
"("
")"
"I",
&g_HashSet_size);
jint ret =
env->CallIntMethod(obj,
method_id);
base::android::CheckException(env);
return ret;
}
// Step 3: RegisterNatives.
static bool RegisterNativesImpl(JNIEnv* env) {
g_HashSet_clazz = reinterpret_cast<jclass>(env->NewGlobalRef(
base::android::GetClass(env, kHashSetClassPath).obj()));
return true;
}
} // namespace JNI_HashSet
#endif // java_util_HashSet_JNI
Last edited: