Bug? IDE - class property bug

Discussion in 'B4J Bugs & Wishlist' started by wl, Jun 8, 2015.

  1. wl

    wl Well-Known Member Licensed User

    in V.3:

    Create a class ("MyClass') like this:

    Code:
    private someProp as int
    ...
    public getSomeProp as int
      
    return someProp
    end sub
    (Save the class)

    In another module try code completion: MyClass.: it will not display SomeProp as a possible property
    Probably this is caused by the private variable having the same name as the public property ...

    Change the class implementation to:

    Code:
    private p_someProp as int
    ...
    public getSomeProp as int
      
    return p_someProp
    end sub
    (Save the class)

    Still code completion will NOT display SomeProp as possible property.

    Rename the property to:

    Code:
    public getSomeProp2 as int
      
    return p_someProp
    end sub
    (save the class)

    Code completion WILL show SomeProp2 as possible property

    Rename the property back to:

    Code:
    public getSomeProp as int
      
    return p_someProp
    end sub
    (save the class)

    Code completion NOW WILL show SomeProp as possible property
     
    Last edited: Jun 9, 2015
    JakeBullet70 and thedesolatesoul like this.
  2. jmon

    jmon Well-Known Member Licensed User

    i think that it's because you didn't save after changing to:

    Code:
    private p_someProp as int
    ...
    public getSomeProp as int
      
    return p_someProp
    end sub
    If this problem is not fixable, I would suggest to have a clear error message showing that a global variable has the same name as a property. I bump into this problem so many times and always wondered what I did wrong because the error message isn't self explanatory.
     
  3. wl

    wl Well-Known Member Licensed User

    I'm pretty sure I saved in between, but I'll have to double-check....

    An error message in this case would indeed be helpful...
     
Loading...