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 565852 - class init not called until first instantiation
class init not called until first instantiation
Status: RESOLVED DUPLICATE of bug 543189
Product: vala
Classification: Core
Component: Code Generator
0.5.x
Other Linux
: Normal normal
: ---
Assigned To: Jürg Billeter
Vala maintainers
Depends on:
Blocks:
 
 
Reported: 2008-12-28 08:41 UTC by Andreas Brauchli
Modified: 2009-01-09 23:26 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Andreas Brauchli 2008-12-28 08:41:41 UTC
public class Test {
    public static Test t = new Test ();
    public static void main () {
        stdout.printf ("t is%s null\n", t==null ? "" : " not");
        var m = new Test ();
        stdout.printf ("t is%s null\n", t==null ? "" : " not");
    }
}

output:
t is null
t is not null

solution: the TYPE_TEST macro should be called before accessing a static ref. field.
Works fine if t is a value type like int.
Comment 1 Jürg Billeter 2009-01-09 23:26:05 UTC
Thanks for the bug report. This particular bug has already been reported into our bug tracking system, but please feel free to report any further bugs you find.


*** This bug has been marked as a duplicate of 543189 ***