Annotation processor can not differentiate overloaded java functions

RESOLVED FIXED in Firefox 55

Status

defect
RESOLVED FIXED
2 years ago
6 months ago

People

(Reporter: rbarker, Assigned: jchen)

Tracking

(Blocks 1 bug)

unspecified
mozilla55
Dependency tree / graph

Firefox Tracking Flags

(firefox55 fixed)

Details

Attachments

(3 attachments)

Reporter

Description

2 years ago
Trying to create bindings for android.graphics.Bitmap produce the following compile time errors:

 0:35.48 In file included from /Volumes/firefox/toolbar/obj-arm-linux-androideabi-debug/widget/android/bindings/Bitmap.cpp:7:0:
 0:35.48 /Volumes/firefox/toolbar/obj-arm-linux-androideabi-debug/widget/android/bindings/Bitmap.h:625:10: error: 'nsresult mozilla::java::sdk::Bitmap::GetScaledHeight(mozilla::jni::ObjectBase<mozilla::jni::Object, _jobject*>::Param, int32_t*) const' cannot be overloaded
 0:35.48      auto GetScaledHeight(mozilla::jni::Object::Param, int32_t*) const -> nsresult;
 0:35.48           ^
 0:35.48 /Volumes/firefox/toolbar/obj-arm-linux-androideabi-debug/widget/android/bindings/Bitmap.h:585:10: error: with 'nsresult mozilla::java::sdk::Bitmap::GetScaledHeight(mozilla::jni::ObjectBase<mozilla::jni::Object, _jobject*>::Param, int32_t*) const'
 0:35.48      auto GetScaledHeight(mozilla::jni::Object::Param, int32_t*) const -> nsresult;
 0:35.48           ^
 0:35.48 /Volumes/firefox/toolbar/obj-arm-linux-androideabi-debug/widget/android/bindings/Bitmap.h:685:10: error: 'nsresult mozilla::java::sdk::Bitmap::GetScaledWidth(mozilla::jni::ObjectBase<mozilla::jni::Object, _jobject*>::Param, int32_t*) const' cannot be overloaded
 0:35.48      auto GetScaledWidth(mozilla::jni::Object::Param, int32_t*) const -> nsresult;
 0:35.48           ^
 0:35.48 /Volumes/firefox/toolbar/obj-arm-linux-androideabi-debug/widget/android/bindings/Bitmap.h:645:10: error: with 'nsresult mozilla::java::sdk::Bitmap::GetScaledWidth(mozilla::jni::ObjectBase<mozilla::jni::Object, _jobject*>::Param, int32_t*) const'
 0:35.48      auto GetScaledWidth(mozilla::jni::Object::Param, int32_t*) const -> nsresult;
 0:35.48           ^
 0:35.48 /Volumes/firefox/toolbar/obj-arm-linux-androideabi-debug/widget/android/bindings/Bitmap.cpp:324:6: error: redefinition of 'nsresult mozilla::java::sdk::Bitmap::GetScaledHeight(mozilla::jni::ObjectBase<mozilla::jni::Object, _jobject*>::Param, int32_t*) const'
 0:35.48  auto Bitmap::GetScaledHeight(mozilla::jni::Object::Param a0, int32_t* a1) const -> nsresult
 0:35.48       ^
 0:35.48 /Volumes/firefox/toolbar/obj-arm-linux-androideabi-debug/widget/android/bindings/Bitmap.cpp:302:6: note: 'nsresult mozilla::java::sdk::Bitmap::GetScaledHeight(mozilla::jni::ObjectBase<mozilla::jni::Object, _jobject*>::Param, int32_t*) const' previously defined here
 0:35.48  auto Bitmap::GetScaledHeight(mozilla::jni::Object::Param a0, int32_t* a1) const -> nsresult
 0:35.48       ^
 0:35.48 /Volumes/firefox/toolbar/obj-arm-linux-androideabi-debug/widget/android/bindings/Bitmap.cpp:357:6: error: redefinition of 'nsresult mozilla::java::sdk::Bitmap::GetScaledWidth(mozilla::jni::ObjectBase<mozilla::jni::Object, _jobject*>::Param, int32_t*) const'
 0:35.48  auto Bitmap::GetScaledWidth(mozilla::jni::Object::Param a0, int32_t* a1) const -> nsresult
 0:35.48       ^
 0:35.48 /Volumes/firefox/toolbar/obj-arm-linux-androideabi-debug/widget/android/bindings/Bitmap.cpp:335:6: note: 'nsresult mozilla::java::sdk::Bitmap::GetScaledWidth(mozilla::jni::ObjectBase<mozilla::jni::Object, _jobject*>::Param, int32_t*) const' previously defined here
 0:35.48  auto Bitmap::GetScaledWidth(mozilla::jni::Object::Param a0, int32_t* a1) const -> nsresult
 0:35.48       ^
 0:35.48 
 0:35.48 In the directory  /Volumes/firefox/toolbar/obj-arm-linux-androideabi-debug/widget/android/bindings
Assignee: nobody → nchen
Status: NEW → ASSIGNED
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.
Attachment #8862935 - Flags: review?(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
Attachment #8862936 - Flags: review?(snorp)
Update the existing binding config files to the new format. Bundle is no
longer used so Bundle-classes.txt is removed.
Attachment #8862937 - Flags: review?(snorp)
Attachment #8862935 - Flags: review?(snorp) → review+
Comment on attachment 8862936 [details] [diff] [review]
2. Introduce new config file format for SDK bindings (v1)

Review of attachment 8862936 [details] [diff] [review]:
-----------------------------------------------------------------

Wow, this is great!
Attachment #8862936 - Flags: review?(snorp) → review+
Attachment #8862937 - Flags: review?(snorp) → review+

Comment 5

2 years ago
Pushed by nchen@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/10aeb7cd6f60
1. Add a "noLiteral" option for WrapForJNI; r=snorp
https://hg.mozilla.org/integration/mozilla-inbound/rev/2e2d48af1599
2. Introduce new config file format for SDK bindings; r=snorp
https://hg.mozilla.org/integration/mozilla-inbound/rev/48425cb6a957
3. Update existing binding config files; r=snorp

Comment 6

2 years ago
bugherder
https://hg.mozilla.org/mozilla-central/rev/10aeb7cd6f60
https://hg.mozilla.org/mozilla-central/rev/2e2d48af1599
https://hg.mozilla.org/mozilla-central/rev/48425cb6a957
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 55

Updated

6 months ago
Product: Firefox for Android → GeckoView
Target Milestone: Firefox 55 → mozilla55
You need to log in before you can comment on or make changes to this bug.