You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Namgyu Kim (JIRA)" <ji...@apache.org> on 2018/09/05 17:13:00 UTC

[jira] [Updated] (LUCENE-8486) Code Refactoring in Field Class

     [ https://issues.apache.org/jira/browse/LUCENE-8486?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Namgyu Kim updated LUCENE-8486:
-------------------------------
    Summary: Code Refactoring in Field Class  (was: Code Refactoring in Field)

> Code Refactoring in Field Class
> -------------------------------
>
>                 Key: LUCENE-8486
>                 URL: https://issues.apache.org/jira/browse/LUCENE-8486
>             Project: Lucene - Core
>          Issue Type: Improvement
>          Components: core/other
>            Reporter: Namgyu Kim
>            Priority: Minor
>              Labels: refactoring
>         Attachments: LUCENE-8486.patch
>
>
> 1) Remove Unnecessary Boxing
> As I know, Explicit manual boxing is unnecessary after Java 5.
>  It can be safely removed.
>  
> Before :
> {code:java}
> // After Line 352
> public void setByteValue(byte value) {
>   ...
>   fieldsData = Byte.valueOf(value);
> }
> public void setShortValue(short value) {
>   ...
>   fieldsData = Short.valueOf(value);
> }
> public void setIntValue(int value) {
>   ...
>   fieldsData = Integer.valueOf(value);
> }
> public void setLongValue(long value) {
>   ...
>   fieldsData = Long.valueOf(value);
> }
> public void setFloatValue(float value) {
>   ...
>   fieldsData = Float.valueOf(value);
> }
> public void setDoubleValue(double value) {
>   ...
>   fieldsData = Double.valueOf(value);
> }
> {code}
>  
> After :
> {code:java}
> // After Line 352
> public void setByteValue(byte value) {
>   ...
>   fieldsData = value;
> }
> public void setShortValue(short value) {
>   ...
>   fieldsData = value;
> }
> public void setIntValue(int value) {
>   ...
>   fieldsData = value;
> }
> public void setLongValue(long value) {
>   ...
>   fieldsData = value;
> }
> public void setFloatValue(float value) {
>   ...
>   fieldsData = value;
> }
> public void setDoubleValue(double value) {
>   ...
>   fieldsData = value;
> }{code}
>  
> 2) Unnecessary static deletion in Store enum
> According to [https://docs.oracle.com/javase/specs/jls/se8/html/jls-8.html#jls-8.9],
>  "A nested enum type is implicitly {{static}}. It is permitted for the declaration of a nested enum type to redundantly specify the {{static}} modifier."
> So I made the following changes.
>  
> Before:
> {code:java}
> // Line 600 method
> public static enum Store {
>   YES,
>   NO
> }
> {code}
>  
> After:
> {code:java}
> // Line 600 method
> public enum Store {
>   YES,
>   NO
> }{code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org