Граф коммитов

30 Коммитов

Автор SHA1 Сообщение Дата
Jim Chen 6723035d5c Bug 1352177 - 2. Introduce new config file format for SDK bindings; r=snorp
Instead of specifying a class name per line, the new format uses the
.ini format, with each section name specifying the class, and each
property name specifying a member of the class. WrapForJNI options can
be specified with each class or member. Comments can be specified with
';' or '#'. For example,

 # Generate bindings for Bundle using default options:
 [android.os.Bundle]

 # Generate bindings for Bundle using class options:
 [android.os.Bundle = exceptionMode:nsresult]

 # Generate bindings for Bundle using method options:
 [android.os.Bundle]
 putInt = stubName:PutInteger

 # Generate bindings for Bundle using class options with method override:
 # (note that all options are overriden at the same time.)
 [android.os.Bundle = exceptionMode:nsresult]
 # putInt will have stubName "PutInteger", and exceptionMode of "abort"
 putInt = stubName:PutInteger
 # putChar will have stubName "PutCharacter", and exceptionMode of "nsresult"
 putChar = stubName:PutCharacter, exceptionMode:nsresult

 # Overloded methods can be specified using its signature
 [android.os.Bundle]
 # Skip the copy constructor
 <init>(Landroid/os/Bundle;)V = skip:true

 # Generic member types can be specified
 [android.view.KeyEvent = skip:true]
 # Skip everything except fields
 <field> = skip:false

 # Skip everything except putInt and putChar
 [android.os.Bundle = skip:true]
 putInt = skip:false
 putChar =

 # Avoid conflicts in native bindings
 [android.os.Bundle]
 # Bundle(PersistableBundle) native binding can conflict with Bundle(ClassLoader)
 <init>(Landroid/os/PersistableBundle;)V = stubName:NewFromPersistableBundle

 # Generate a getter instead of a literal for certain runtime constants
 [android.os.Build$VERSION = skip:true]
 SDK_INT = noLiteral:true
2017-05-03 11:36:18 -04:00
Jim Chen f915e1bd65 Bug 1352177 - 1. Add a "noLiteral" option for WrapForJNI; r=snorp
For static final fields, generate a getter instead of a literal when
specified. Used to generate bindings for runtime constants whose values
are unknown at compile time.
2017-05-03 11:36:18 -04:00
Jim Chen 0bd1b97d16 Bug 1292323 - Update annotationProcessor to reflect WrapForJNI changes; r=snorp
Update the code generator and related classes in annotation processor to
use the new WrapForJNI flags. Also add some more sanity checking to make
sure the flags are used correctly.
2016-08-12 23:15:52 -04:00
Jim Chen fe52fe774b Bug 1286663 - Add JNI wrapper class for ByteBuffer; r=snorp
Add a wrapper class for ByteBuffer and its associated calls in JNI.
2016-07-21 13:49:04 -04:00
Carsten "Tomcat" Book eaf9acf7d5 Backed out changeset f623f6ccca25 (Bug 1286663) for another bustage on android on a CLOSED TREE 2016-07-21 08:14:27 +02:00
Jim Chen bf5b43ab73 Bug 1286663 - Add JNI wrapper class for ByteBuffer; r=snorp
Add a wrapper class for ByteBuffer and its associated calls in JNI.
2016-07-21 00:41:12 -04:00
James Willcox 718f23f9d0 Bug 1280666 - Allow class annotations to set defaults for members when generating Java bindings r=jchen 2016-06-29 17:09:55 -07:00
Jim Chen d2bff49120 Bug 1244875 - Update binding generator; r=snorp
Update the automatic binding generator to match the JNI template
changes.
2016-02-09 17:27:28 -05:00
Jim Chen f133e47c1a Bug 1210585 - Use equals to compare Class instances; r=snorp
The code generator uses == and != to compare two instances of Class, but
it really should be using equals because two distinct instances of Class
can refer to the same class type.
2015-10-22 17:45:45 -04:00
Jim Chen 7595348845 Bug 1192079 - Support inner classes in generated JNI wrapper; r=snorp
Currently, when we generate JNI wrapper for an inner class, the
resulting C++ class will not actually be a nested class of the enclosing
class. As a result, the class can be confusing to use. For example,
wrapping Java class GeckoThread.State results in two unrelated C++
classes, GeckoThread and State, and it'd be confusing to use State by
itself.

This patch adds support for inner classes. We start by scanning only for
top-level classes, and when processing each top-level class, we
recursively scan for inner classes through
JarClassIterator.getInnerClasses() and CodeGenerator.generateClasses().
For each Java inner classes, the resulting C++ class will be a nested
class. For example, wrapping GeckoThread.State will produce
widget::GeckoThread and widget::GeckoThread::State.
2015-08-13 00:53:39 -04:00
Mark Capella f3a5fca399 Bug 1191161 - p3 - Rename / Shorten WrapElementForJNI to WrapForJNI, r=jchen
--HG--
rename : mobile/android/base/mozglue/generatorannotations/WrapElementForJNI.java => mobile/android/base/annotation/WrapForJNI.java
2015-08-07 02:09:08 -04:00
Mark Capella a715087aff Bug 1191161 - p1 - Merge WrapEntireClassForJNI into WrapElementForJNI, r=jchen 2015-08-06 01:55:29 -04:00
Jim Chen c723648f9d Bug 1186517 - Fix SDKProcessor API version detection; r=snorp
The API version detection functionality was broken in SDKProcessor
because we were passing in "Lpackage/Class;" as the class name rather
than just "package/Class". Also, some classes have a weird situation
where some methods were moved around in later API versions. For example,
some put* and get* methods in Bundle were moved to BaseBundle in API 21.
If we only checked BaseBundle.put*, we would think they are API 21+
only. The workaround is to check both the top-level class and the
declaring class for a member, and choose the lower API level as the
minimal API level for that member.

This patch also fixes bugs in including the right class members.
For SDKProcessor we want to include all public members of a class,
including inherited members, because the private/protected members are
not part of the public API. For AnnotationProcessor, we want to include
all the members declared in that class, including private and
protected members, because we may want to access private/protected
members of our own Java classes from C++.
2015-07-29 15:11:15 -04:00
Jim Chen db34c64f29 Bug 1116589 - Use templated JNI classes in generated bindings; r=snorp 2015-01-09 19:33:57 -05:00
James Willcox 4f5b795709 Bug 1086693 - Part 5: Add a 'catchException' mode to JNI generator r=ckitching 2014-11-13 12:47:24 -06:00
James Willcox f793c98f19 Bug 1086693 - Part 4: Add a lazy initialization mode to CodeGenerator, and use it for SDK bindings r=ckitching 2014-11-13 12:47:24 -06:00
James Willcox 178ca1265d Bug 1086693 - Part 3: Don't generate members that are above a given API version r=ckitching 2014-11-13 12:47:23 -06:00
Chris Kitching d9eab8b56d Bug 1049105: Make annotation processor compile with Xlint:all r=kats 2014-08-05 21:13:49 -07:00
Chris Kitching 9bc3c00d3c Bug 1049105: Remove generateStatic option from JNI wrapper generator r=kats 2014-08-05 15:04:38 -07:00
Kartikaya Gupta dffa17239a Follow-up to bug 1019836 to replace tabs with spaces. r=me and DONTBUILD because whitespace changes only. 2014-08-05 15:52:43 -04:00
Brad Lassey 551b30bb4c bug 1019836 - Support narrow char strings in android bridge r=snorp 2014-06-04 15:04:12 -04:00
Jim Chen c137c2f965 Bug 958706 - Make generated JNI wrappers handle uncaught exceptions; r=blassey
This patch adds AndroidBridge::HandleUncaughtException calls to generated JNI wrappers. Also, the JNI annotation now accepts the noThrow flag to indicate that the JNI caller wishes to handle Exceptions manually.
2014-01-17 23:32:25 -06:00
Chris Kitching c7984b3c10 Bug 913985: Part 3 - Update the annotation processor to generate wrapper classes. r=kats
--HG--
rename : build/annotationProcessors/MethodWithAnnotationInfo.java => build/annotationProcessors/AnnotationInfo.java
rename : build/annotationProcessors/utils/AlphabeticMethodComparator.java => build/annotationProcessors/utils/AlphabeticAnnotatableEntityComparator.java
rename : build/annotationProcessors/utils/GeneratableEntryPointIterator.java => build/annotationProcessors/utils/GeneratableElementIterator.java
2013-11-21 20:41:28 +00:00
Chris Kitching ae53fdd615 Bug 913985: Part 1.5 - Update the annotation processor to handle the renamed annotations. r=kats 2013-11-12 10:41:00 -08:00
Ryan VanderMeulen 2c440594a5 Backed out 7 changesets (bug 913985) for intermittent Android crashes.
Backed out changeset 53513a959cf0 (bug 913985)
Backed out changeset d23d1e678417 (bug 913985)
Backed out changeset a9c9187b4f4a (bug 913985)
Backed out changeset c6b02e4a3e35 (bug 913985)
Backed out changeset 895dae322e3c (bug 913985)
Backed out changeset 3d97e6a53313 (bug 913985)
Backed out changeset 892bb017f8ba (bug 913985)

--HG--
rename : build/annotationProcessors/AnnotationInfo.java => build/annotationProcessors/MethodWithAnnotationInfo.java
rename : build/annotationProcessors/utils/AlphabeticAnnotatableEntityComparator.java => build/annotationProcessors/utils/AlphabeticMethodComparator.java
rename : build/annotationProcessors/utils/GeneratableElementIterator.java => build/annotationProcessors/utils/GeneratableEntryPointIterator.java
rename : mobile/android/base/mozglue/generatorannotations/WrapElementForJNI.java => mobile/android/base/mozglue/GeneratableAndroidBridgeTarget.java
rename : mobile/android/base/mozglue/generatorannotations/OptionalGeneratedParameter.java => mobile/android/base/mozglue/OptionalGeneratedParameter.java
2013-11-19 10:56:09 -05:00
Chris Kitching e66536370a Bug 913985 - Part 3: update the annotation processor to generate wrapper classes. r=kats
--HG--
rename : build/annotationProcessors/MethodWithAnnotationInfo.java => build/annotationProcessors/AnnotationInfo.java
rename : build/annotationProcessors/utils/AlphabeticMethodComparator.java => build/annotationProcessors/utils/AlphabeticAnnotatableEntityComparator.java
rename : build/annotationProcessors/utils/GeneratableEntryPointIterator.java => build/annotationProcessors/utils/GeneratableElementIterator.java
2013-11-18 20:31:35 -08:00
Chris Kitching fc7d75fbe2 Bug 913985 - Part 1.5: update the annotation processor to handle the renamed annotations. r=kats 2013-11-12 10:41:00 -08:00
cewang f20f4220a6 Bug 934359 - Solve endless loop problem in gecko/build/annotationProcessors/utils/Utils.java. r=kats 2013-11-18 09:11:35 -05:00
Nick Alexander db4bc98e91 Bug 923306 - Make annotationProcessors build with -Xlint:all. r=ckitching 2013-10-09 17:05:37 -07:00
Chris Kitching abd1001920 Bug 794981 - Part 8: Add an annotation processor to the build process to generate the contents of part 5. r=kats, r=glandium 2013-09-09 08:57:37 -04:00