[
https://issues.apache.org/jira/browse/LUCENE-2285?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12838456#action_12838456
]
Shai Erera commented on LUCENE-2285:
------------------------------------
bq. some of the changes are problematic because they appear in generated
classes (like QueryParser),
So? All I did was remove unnecessary semicolons and casts ... next time those
files will be generated, the warnings will return. But at least until then we
can live w/ few less warnings ... which will allow my perfectionist eyes to
rest a little :).
bq. replaced all LUCENE_CURRENT constants in tests
Yes, I figured I'm already touching these files, let's do it all at once.
Reduced another ~300 warnings.
About the removed casts - eclipse really warns you on unnecessary casts. I have
never found a case where it was wrong. The removed cast from TestCharArraySet
is justified because you want to test the contains(Object) method, which is
exactly what happens. In fact, when I look at the code, I think there is a
wrong cast:
{code}
assertFalse(CharArraySet.EMPTY_SET.contains((Object) "foo")); // invokes
the contains(Object) method
assertFalse(CharArraySet.EMPTY_SET.contains("foo".toCharArray())); //
invokes the contains(Object) method
assertFalse(CharArraySet.EMPTY_SET.contains("foo".toCharArray(),0,3)); //
invokes the contains(char[], int, int) method
{code}
If the intention was to check all 3 contains methods, then the first cast
should have been to CharSequence? Anyway, the removed cast (the second, which
cast to Object) is justified as it's indeed unnecessary.
bq. Also @SuppressWarnings("unused") is not a javac annotation
Are you sure? I have another project which compiles w/ javac and it works fine.
I'll check it, but I trust you :).
About adding casts for clarity of code - I guess that's a matter of styling,
but the cast is truly unnecessary, and just produces a warning. I would like
the code to be free of those, but that's only my opinion.
> Code cleanup from all sorts of (trivial) warnings
> -------------------------------------------------
>
> Key: LUCENE-2285
> URL: https://issues.apache.org/jira/browse/LUCENE-2285
> Project: Lucene - Java
> Issue Type: Improvement
> Reporter: Shai Erera
> Assignee: Uwe Schindler
> Priority: Minor
> Fix For: 3.1
>
> Attachments: LUCENE-2285.patch
>
>
> I would like to do some code cleanup and remove all sorts of trivial
> warnings, like unnecessary casts, problems w/ javadocs, unused variables,
> redundant null checks, unnecessary semicolon etc. These are all very trivial
> and should not pose any problem.
> I'll create another issue for getting rid of deprecated code usage, like
> LuceneTestCase and all sorts of deprecated constructors. That's also trivial
> because it only affects Lucene code, but it's a different type of change.
> Another issue I'd like to create is about introducing more generics in the
> code, where it's missing today - not changing existing API. There are many
> places in the code like that.
> So, with you permission, I'll start with the trivial ones first, and then
> move on to the others.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]