[jira] [Commented] (NETBEANS-5757) Compile-on-Save drops static initializer (vanilla javac)

2021-07-16 Thread Eirik Bakke (Jira)


[ 
https://issues.apache.org/jira/browse/NETBEANS-5757?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17382144#comment-17382144
 ] 

Eirik Bakke commented on NETBEANS-5757:
---

I think this will be fixed by https://github.com/apache/netbeans/pull/3054 .

> Compile-on-Save drops static initializer (vanilla javac)
> 
>
> Key: NETBEANS-5757
> URL: https://issues.apache.org/jira/browse/NETBEANS-5757
> Project: NetBeans
>  Issue Type: Bug
>  Components: java - Compiler
>Affects Versions: 12.4
> Environment: NetBeans 12.4 _without_ nb-javac installed (started from 
> clean user and cache directories to ensure no trace of nb-javac was left from 
> my old installation). Java 11.0.11 or Java 17-ea+25. Windows 10.
>Reporter: Eirik Bakke
>Priority: Major
>
> Very great to see Compile-on-Save now working without the external nb-javac 
> plugin! Here's the first bug I've found around this. To reproduce, create an 
> empty maven-based Java project and add the following class:
> {code:java}
> public class StaticInitializerExample {
>   private static final String SOME_CONSTANT;
>   static {
> SOME_CONSTANT = "I am a constant.";
>   }
>   public static final void main(String args[]) {
> System.out.println(SOME_CONSTANT);
>   }
> }
> {code}
> Do a clean build and run. The application will print, "I am a constant."
> Now do any trivial change to the code, such as adding a comment, and save. 
> Run again. The application will now print "null", rather than the correct 
> output.
> Tested on both Java 11.0.11 and Java 17-ea+25. I also tested with NetBeans 
> 11.3 with nb-javac installed; in that case the output is correct (still "I am 
> a constant."). In the latter case you can also change the constant in the 
> static initializer, and CoS will apply the change correctly.



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

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

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



[jira] [Commented] (NETBEANS-5757) Compile-on-Save drops static initializer (vanilla javac)

2021-06-30 Thread Jira


[ 
https://issues.apache.org/jira/browse/NETBEANS-5757?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17371864#comment-17371864
 ] 

René Pöpperl commented on NETBEANS-5757:


This bug is not limited to static initializers. Instance initializers are also 
ignored. For me, it only happens on Windows systems in NB 12.4. NB 12.3 does 
not show this bug. 

The bug does not appear on macOS with NB 12.3 / 12.4. 

It seems to be independent from JDK version. I tried with Oracle JDK 8u151, 
AdoptOpenJDK 11 / 16.

> Compile-on-Save drops static initializer (vanilla javac)
> 
>
> Key: NETBEANS-5757
> URL: https://issues.apache.org/jira/browse/NETBEANS-5757
> Project: NetBeans
>  Issue Type: Bug
>  Components: java - Compiler
>Affects Versions: 12.4
> Environment: NetBeans 12.4 _without_ nb-javac installed (started from 
> clean user and cache directories to ensure no trace of nb-javac was left from 
> my old installation). Java 11.0.11 or Java 17-ea+25. Windows 10.
>Reporter: Eirik Bakke
>Priority: Major
>
> Very great to see Compile-on-Save now working without the external nb-javac 
> plugin! Here's the first bug I've found around this. To reproduce, create an 
> empty maven-based Java project and add the following class:
> {code:java}
> public class StaticInitializerExample {
>   private static final String SOME_CONSTANT;
>   static {
> SOME_CONSTANT = "I am a constant.";
>   }
>   public static final void main(String args[]) {
> System.out.println(SOME_CONSTANT);
>   }
> }
> {code}
> Do a clean build and run. The application will print, "I am a constant."
> Now do any trivial change to the code, such as adding a comment, and save. 
> Run again. The application will now print "null", rather than the correct 
> output.
> Tested on both Java 11.0.11 and Java 17-ea+25. I also tested with NetBeans 
> 11.3 with nb-javac installed; in that case the output is correct (still "I am 
> a constant."). In the latter case you can also change the constant in the 
> static initializer, and CoS will apply the change correctly.



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

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

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