You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@netbeans.apache.org by "Florent Lioult (Jira)" <ji...@apache.org> on 2021/07/03 18:46:00 UTC

[jira] [Created] (NETBEANS-5832) Static block not compiled

Florent Lioult created NETBEANS-5832:
----------------------------------------

             Summary: Static block not compiled
                 Key: NETBEANS-5832
                 URL: https://issues.apache.org/jira/browse/NETBEANS-5832
             Project: NetBeans
          Issue Type: Bug
          Components: java - Compiler
    Affects Versions: 12.4
         Environment: *Product Version:* Apache NetBeans IDE 12.4
*Java:* 11.0.2; Java HotSpot(TM) 64-Bit Server VM 11.0.2+9-LTS
*Runtime:* Java(TM) SE Runtime Environment 11.0.2+9-LTS
*System:* Linux version 5.8.0-59-generic running on amd64; UTF-8; fr_FR (nb)
            Reporter: Florent Lioult


1. Create a Maven project with just this simple class:

 
{code:java}
public class Truc {
 
    private static Integer n;

    static {
       n = 123;
    }
    public static void main(String[] args) {
        System.out.println("n is " + n);
    }
 
}{code}
 

2. Execute it with _Run File_ or _Run Project_.

-> The program outputs "n is null".

3. Execute it with _Clean and Build Project_.

-> The program outputs "n is 123".

In fact, each time the source is changed, running it with _Run File_ or _Run Project_ will not compile the static blocks and will completely skip it (ie. _n_ will be back to _null_).



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@netbeans.apache.org
For additional commands, e-mail: commits-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists