bsorrentino / cordova-broadcaster

Cordova Plugin to allow message exchange between javascript and native (and viceversa)
MIT License
113 stars 53 forks source link

Might be only me but i'm hvaing other build issues with backwards compatability #57

Closed Woozyman closed 3 years ago

Woozyman commented 3 years ago

Thanks for the new update to 4.3.0 but is is still too "new" the if shorthand is aperently an issue for the old versions. So i'm still locked to version 4.1.0

     `:compileDebugJavaWithJavac - is not incremental (e.g. outputs have changed, no previous execution, etc.).

     /usr/src/app/platforms/android/src/org/bsc/cordova/CDVBroadcaster.java:79: error: incompatible types: Optional<? extends Object> cannot be converted to Optional<Integer>

     flags = ( hasFlags ) ? Optional.ofNullable( userData.optInt("flags") ) : Optional.empty();
                          ^

     Note: Some input files use or override a deprecated API.
     Note: Recompile with -Xlint:deprecation for details.
     Note: Some input files use unchecked or unsafe operations.
     Note: Recompile with -Xlint:unchecked for details.
     1 error
     :compileDebugJavaWithJavac FAILED`
bsorrentino commented 3 years ago

Hi @Woozyman

Seems that you are using an older java version.

This issue seems related to conversion of Optional.empty() to Integer.

Could you provide me your Gradle files in order to replicate it in my developer environment ?

bsorrentino commented 3 years ago

Hi @Woozyman

could you substitute the line

flags = ( hasFlags ) ? Optional.ofNullable( userData.optInt("flags") ) : Optional.empty();

to

 if( hasFlags ) {
          flags = Optional.ofNullable( userData.optInt("flags") );
        }
        else {
          flags = Optional.empty();
}

and let me know if it works

thanks in advance

Woozyman commented 3 years ago

Sorry for the delay. I have replaced the code and that fixed the build problem. Aparently not having issues with the lines: 55 - return isPresent() ? ref : other; 239 - final Bundle bundle = (userData == null) ? new Bundle() : toBundle(userData.extras); now on to testing...

bsorrentino commented 3 years ago

Hi @Woozyman thanks for the feedback

I'll arrange the new 4.3.1 release with fix