From eb54e04df1abb03394bf102d6a46a4af26820c97 Mon Sep 17 00:00:00 2001 From: Jim Chen Date: Wed, 7 Oct 2015 08:57:30 -0400 Subject: [PATCH] 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. --- build/annotationProcessors/CodeGenerator.java | 1 + widget/android/GeneratedJNIWrappers.cpp | 8 -------- widget/android/GeneratedJNIWrappers.h | 16 +--------------- 3 files changed, 2 insertions(+), 23 deletions(-) diff --git a/build/annotationProcessors/CodeGenerator.java b/build/annotationProcessors/CodeGenerator.java index 0a8e6d5f44a0..b36d1602eb71 100644 --- a/build/annotationProcessors/CodeGenerator.java +++ b/build/annotationProcessors/CodeGenerator.java @@ -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) { } diff --git a/widget/android/GeneratedJNIWrappers.cpp b/widget/android/GeneratedJNIWrappers.cpp index 5b372dd7581d..fcc500eac510 100644 --- a/widget/android/GeneratedJNIWrappers.cpp +++ b/widget/android/GeneratedJNIWrappers.cpp @@ -1507,14 +1507,6 @@ auto SQLiteBridgeException::New(mozilla::jni::String::Param a0) -> SQLiteBridgeE return mozilla::jni::Constructor::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::Get(nullptr, nullptr); -} - constexpr char Clipboard::name[]; constexpr char Clipboard::ClearText_t::name[]; diff --git a/widget/android/GeneratedJNIWrappers.h b/widget/android/GeneratedJNIWrappers.h index b3f88b357732..4731d5ecb2f6 100644 --- a/widget/android/GeneratedJNIWrappers.h +++ b/widget/android/GeneratedJNIWrappers.h @@ -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; };