Under Review
over 2 years ago

SDK 4.1.6 broke some apps without (:base)

The following snippets are from my datafield. It compiles for instinct (or other black&white devices) using SDK 4.1.5 but fails to compile using SDK 4.1.6.

//monkey.jungle:

project.manifest = manifest.xml

base.sourcePath = source
base.resourcePath = $(base.resourcePath);resources-array-settings-0;memory32K/resources;memory32K/resources-array-settings-0;memory32K/resources-color-array-settings-0
base.excludeAnnotations = base;no_api1_3;no_api2;no_api3_1;memory16K;memory64K;black_and_white;array_settings;no_zones;no_gauge;draw_line_buggy;no_live_settings;no_fit_zone;no_search_anim

instinct2.excludeAnnotations = base;no_api1_3;no_api2;no_api3_1;memory16K;memory64K;color;array_settings;no_zones;gauge;no_live_settings;fit_zone

instinct2.resourcePath = resources;resources-array-settings-0;memory32K/resources;memory32K/resources-array-settings-0



// MyDataField.mc:
class BaseExtHRMField extends WatchUi.DataField {
    (:black_and_white) protected var mShowZoneColor as Boolean;
    (:color) protected var mShowZoneColor as Boolean = true;
// ...

    function x() {
        var spaceBetweenGaugeAndLabel = mShowZoneColor ? 10 : 0;
    }

}

Interestingly this helped to discover an "error" in my code, one that I agree should have failed even with earlier compilers, but it worked. This line works:

var spaceBetweenGaugeAndLabel = mShowZoneColor ? 10 : 0;

mShowZoneColor is null and spaceBetweenGaugeAndLabel is set to 0 as I expected.

However compiling with 4.1.6 it fails:

java -Xms1g -Dfile.encoding=UTF-8 -Dapple.awt.UIElement=true -jar /home/gavriel/Garmin/ConnectIQ/Sdks/connectiq-sdk-lin-4.1.6-2022-11-04-17f8cfdf3/bin/monkeybrains.jar -o bin/MyApp.prg -f /home/gavriel/Garmin/MyApp/monkey.jungle;/home/gavriel/Garmin/MyApp/barrels.jungle -y /home/gavriel/Garmin/developer_key.der -d instinct2_sim -w -l 3

ERROR: instinct2: /home/gavrielGarmin/MyApp/source/MyDataField.mc:55: Member 'mShowZoneColor' not initialized but does not accept Null.


Parents
  • If the line annotated with :black_and_white is compiled in (as you would expect for instinct2), you have declared a member that is only allowed to be a Boolean, but you don’t appear to have initialized it.

    I believe you have three options:

    1. initialize mShowZoneColor with the declaration
    2. initialize mShowZoneColor in initialize()
    3. update the declaration to allow Null
Comment
  • If the line annotated with :black_and_white is compiled in (as you would expect for instinct2), you have declared a member that is only allowed to be a Boolean, but you don’t appear to have initialized it.

    I believe you have three options:

    1. initialize mShowZoneColor with the declaration
    2. initialize mShowZoneColor in initialize()
    3. update the declaration to allow Null
Children
No Data