lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Uwe Schindler (Commented) (JIRA)" <>
Subject [jira] [Commented] (LUCENE-3777) trapping overloaded ctors/setters in Field/NumericField/DocValuesField
Date Tue, 14 Feb 2012 07:30:59 GMT


Uwe Schindler commented on LUCENE-3777:

The biggest trap is silently creating wrong types that are incompatible with what your index

new NumericField(..., 5L) vs new NumericField(..., 5) is producing something totaly different.
Please note the "L", forgetting to add this, you suddenly get completely incompatible fields.

This is unreleaseable!
> trapping overloaded ctors/setters in Field/NumericField/DocValuesField
> ----------------------------------------------------------------------
>                 Key: LUCENE-3777
>                 URL:
>             Project: Lucene - Java
>          Issue Type: Bug
>    Affects Versions: 4.0
>            Reporter: Robert Muir
> In trunk, these apis let you easily create a field, but my concern is this:
> {code}
> public NumericField(String name, int value)
> public NumericField(String name, long value)
> ..
> public Field(String name, int value, FieldType type)
> public Field(String name, long value, FieldType type)
> ..
> public void setValue(int value)
> public void setValue(long value)
> ..
> public DocValuesField(String name, int value, DocValues.Type docValueType)
> public DocValuesField(String name, long value, DocValues.Type docValueType)
> {code}
> I really don't like overloaded ctors/setters where the compiler can type-promote you,
> I think it makes the apis hard to use.
> Instead for the setters I think we sohuld have setIntValue, setLongValue, ...
> For the ctors, I see two other options:
> # factories like DocValuesField.newIntField()
> # subclasses like IntField
> I don't have any patch for this, but I think we should discuss and fix before these apis
are released.

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:!default.jspa
For more information on JIRA, see:


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message