[
https://issues.apache.org/jira/browse/LUCENE-7077?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Robert Muir updated LUCENE-7077:
--------------------------------
Attachment: LUCENE-7077.patch
Simple patch, and fixing the other two instances of it.
The previous bug on LUCENE-7073 would have looked like this:
{noformat}
[ecj-lint] Compiling 747 source files to
/var/folders/bp/94_rx5954cq2bvzqclnrwt0c0000gn/T/ecj420232355
[ecj-lint] ----------
[ecj-lint] 1. ERROR in
/Users/rmuir/workspace/lucene-solr/lucene/core/src/java/org/apache/lucene/document/FieldType.java
(at line 78)
[ecj-lint] this.dimensionCount = dimensionCount;
[ecj-lint] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[ecj-lint] The assignment to variable dimensionCount has no effect
[ecj-lint] ----------
[ecj-lint] 2. ERROR in
/Users/rmuir/workspace/lucene-solr/lucene/core/src/java/org/apache/lucene/document/FieldType.java
(at line 79)
[ecj-lint] this.dimensionNumBytes = dimensionNumBytes;
[ecj-lint] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[ecj-lint] The assignment to variable dimensionNumBytes has no effect
[ecj-lint] —————
{noformat}
> fail precommit on useless assignment
> ------------------------------------
>
> Key: LUCENE-7077
> URL: https://issues.apache.org/jira/browse/LUCENE-7077
> Project: Lucene - Core
> Issue Type: Bug
> Reporter: Robert Muir
> Attachments: LUCENE-7077.patch
>
>
> I found LUCENE-7073 because of a compiler warning in my IDE. It slipped all
> the way through buggy tests too! I think we should fail when "assignment has
> no effect", rather than just rely on someone to catch it visually.
> This is very specific and will not trigger a bunch of false positives: but
> can indicate a common bug in e.g. constructors for POJO classes and so on.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]