Closed Bug 1352177 Opened 7 years ago Closed 7 years ago

Annotation processor can not differentiate overloaded java functions

Categories

(GeckoView :: General, defect)

defect
Not set
normal

Tracking

(firefox55 fixed)

RESOLVED FIXED
mozilla55
Tracking Status
firefox55 --- fixed

People

(Reporter: rbarker, Assigned: jchen)

References

(Blocks 1 open bug)

Details

Attachments

(3 files)

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+
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
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.

Attachment

General

Created:
Updated:
Size: