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

Dawid Weiss commented on LUCENE-10074:
--------------------------------------

I actually had to check whether it's not optimized away by javac... and it 
seems it's not. :) 
{code}
> javap -c Test2.class
Compiled from "Test2.java"
public class Test2 {
  int field;

  public Test2();
    Code:
       0: aload_0
       1: invokespecial #1                  // Method 
java/lang/Object."<init>":()V
       4: return
}

>javap -c Test1.class
Compiled from "Test1.java"
public class Test1 {
  int field;

  public Test1();
    Code:
       0: aload_0
       1: invokespecial #1                  // Method 
java/lang/Object."<init>":()V
       4: aload_0
       5: iconst_0
       6: putfield      #7                  // Field field:I
       9: return
}
{code}

> Remove unneeded default value assignment
> ----------------------------------------
>
>                 Key: LUCENE-10074
>                 URL: https://issues.apache.org/jira/browse/LUCENE-10074
>             Project: Lucene - Core
>          Issue Type: Task
>            Reporter: Zach Chen
>            Priority: Minor
>
> This is a spin-off issue from discussion here 
> [https://github.com/apache/lucene/pull/128#discussion_r695669643,] where we 
> would like to see if there's any automatic checking mechanism (ecj ?) that 
> can be enabled to detect and warn about unneeded default value assignments in 
> future changes, as well as in the existing code.



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

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to