Bug 1209574 - Generate constants for non-accessible static final fields; r=snorp

We try to generate a C++ constant for static final fields, but that
was failing for inaccessible fields. Now we set the field to be
accessible so that we do end up generating a C++ constant.
This commit is contained in:
Jim Chen 2015-10-07 08:57:30 -04:00
parent a0ee2ee496
commit 2cc9923726
3 changed files with 2 additions and 23 deletions

View File

@ -392,6 +392,7 @@ public class CodeGenerator {
if (isStatic && isFinal && (type.isPrimitive() || type == String.class)) {
Object val = null;
try {
field.setAccessible(true);
val = field.get(null);
} catch (final IllegalAccessException e) {
}

View File

@ -1507,14 +1507,6 @@ auto SQLiteBridgeException::New(mozilla::jni::String::Param a0) -> SQLiteBridgeE
return mozilla::jni::Constructor<New2_t>::Call(nullptr, nullptr, a0);
}
constexpr char SQLiteBridgeException::SerialVersionUID_t::name[];
constexpr char SQLiteBridgeException::SerialVersionUID_t::signature[];
auto SQLiteBridgeException::SerialVersionUID() -> int64_t
{
return mozilla::jni::Field<SerialVersionUID_t>::Get(nullptr, nullptr);
}
constexpr char Clipboard::name[];
constexpr char Clipboard::ClearText_t::name[];

View File

@ -3647,21 +3647,7 @@ public:
static auto New(mozilla::jni::String::Param) -> SQLiteBridgeException::LocalRef;
public:
struct SerialVersionUID_t {
typedef SQLiteBridgeException Owner;
typedef int64_t ReturnType;
typedef int64_t SetterType;
typedef mozilla::jni::Args<> Args;
static constexpr char name[] = "serialVersionUID";
static constexpr char signature[] =
"J";
static const bool isStatic = true;
static const bool isMultithreaded = true;
static const mozilla::jni::ExceptionMode exceptionMode =
mozilla::jni::ExceptionMode::ABORT;
};
static auto SerialVersionUID() -> int64_t;
static const int64_t SerialVersionUID = 1;
};