After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 592577 - Vala does not enforce protected member access
Vala does not enforce protected member access
Status: RESOLVED FIXED
Product: vala
Classification: Core
Component: general
0.7.x
Other Linux
: Normal normal
: ---
Assigned To: Vala maintainers
Vala maintainers
: 592826 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2009-08-21 13:14 UTC by Adam Dingle
Modified: 2010-01-29 18:06 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Enforce protected member restrictions for classes (1.12 KB, patch)
2010-01-28 23:58 UTC, Marc-Andre Lureau
none Details | Review

Description Adam Dingle 2009-08-21 13:14:01 UTC
The Vala reference manual draft says

  "protected" asserts that the member will be visible to any code within this class, and also to any code that is in a subclass of this class.

And yet the following program builds without an error:

class Foo {
    protected void xyz() {
    }
}

void main() {
    Foo foo = new Foo();
    foo.xyz();
}

So either the compiler (I'm using Vala 0.7.5) is failing to enforce the protected access restriction, or the documentation is wrong.  In either case this should be fixed.
Comment 1 Michael 'Mickey' Lauer 2009-10-15 18:38:34 UTC
Confirming. 'protected' is not yet enforced.
Comment 2 Michael 'Mickey' Lauer 2009-10-15 22:46:51 UTC
*** Bug 592826 has been marked as a duplicate of this bug. ***
Comment 3 Marc-Andre Lureau 2010-01-28 23:58:03 UTC
Created attachment 152530 [details] [review]
Enforce protected member restrictions for classes

That seems to do the trick for me.

Should address 592577, at least partially.
Comment 4 Jürg Billeter 2010-01-29 18:06:12 UTC
commit 9a06f450b9801c1f79e5819185e1af84e7dba3c5
Author: Marc-André Lureau <marcandre.lureau@gmail.com>
Date:   Fri Jan 29 00:56:46 2010 +0100

    Enforce protected member restrictions
    
    Fixes bug 592577.