You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Robert Muir (JIRA)" <ji...@apache.org> on 2012/06/28 01:18:44 UTC
[jira] [Created] (LUCENE-4172) clean up redundant throws clauses
Robert Muir created LUCENE-4172:
-----------------------------------
Summary: clean up redundant throws clauses
Key: LUCENE-4172
URL: https://issues.apache.org/jira/browse/LUCENE-4172
Project: Lucene - Java
Issue Type: Bug
Reporter: Robert Muir
examples are things like ctors that list throws XYZException but actually dont, and things like 'throws CorruptIndex, LockObtainedFailed, IOException' when all of these are actually IOException.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org
[jira] [Commented] (LUCENE-4172) clean up redundant throws clauses
Posted by "Steven Rowe (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/LUCENE-4172?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13402669#comment-13402669 ]
Steven Rowe commented on LUCENE-4172:
-------------------------------------
IntelliJ has two relevant inspections: "Redundant throws clause" and "Duplicate throws". I've applied your patch to trunk and I'm running these on the whole project to see what they find.
> clean up redundant throws clauses
> ---------------------------------
>
> Key: LUCENE-4172
> URL: https://issues.apache.org/jira/browse/LUCENE-4172
> Project: Lucene - Java
> Issue Type: Bug
> Reporter: Robert Muir
> Attachments: LUCENE-4172.patch
>
>
> examples are things like ctors that list throws XYZException but actually dont, and things like 'throws CorruptIndex, LockObtainedFailed, IOException' when all of these are actually IOException.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org
[jira] [Commented] (LUCENE-4172) clean up redundant throws clauses
Posted by "Steven Rowe (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/LUCENE-4172?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13403733#comment-13403733 ]
Steven Rowe commented on LUCENE-4172:
-------------------------------------
bq. What's wrong with?: import <package>.*; – especially when there are many classes?
Some reasons given here: [http://stackoverflow.com/questions/147454/why-is-using-a-wild-card-with-a-java-import-statement-bad]: namespace polution; package additions can trigger compilation failure; compilation is slower.
My IDE (IntelliJ) automatically folds imports, so assuming most devs have a similar experience, many classes in a package don't cause actual clutter.
bq. And is there a coding standard that Lucene/Solr adheres to? I am unaware.
The only standard I've seen referred to is "Sun's Java style rules, with the exception of 2 spaces per indent level instead of 4".
> clean up redundant throws clauses
> ---------------------------------
>
> Key: LUCENE-4172
> URL: https://issues.apache.org/jira/browse/LUCENE-4172
> Project: Lucene - Java
> Issue Type: Bug
> Reporter: Robert Muir
> Assignee: Steven Rowe
> Fix For: 4.0, 5.0
>
> Attachments: LUCENE-4172.patch, LUCENE-4172.patch, LUCENE-4172.patch
>
>
> examples are things like ctors that list throws XYZException but actually dont, and things like 'throws CorruptIndex, LockObtainedFailed, IOException' when all of these are actually IOException.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org
[jira] [Resolved] (LUCENE-4172) clean up redundant throws clauses
Posted by "Steven Rowe (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/LUCENE-4172?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Steven Rowe resolved LUCENE-4172.
---------------------------------
Resolution: Fixed
Fix Version/s: 5.0
4.0
Assignee: Steven Rowe
Lucene Fields: New,Patch Available (was: New)
Committed to trunk and branch_4x.
> clean up redundant throws clauses
> ---------------------------------
>
> Key: LUCENE-4172
> URL: https://issues.apache.org/jira/browse/LUCENE-4172
> Project: Lucene - Java
> Issue Type: Bug
> Reporter: Robert Muir
> Assignee: Steven Rowe
> Fix For: 4.0, 5.0
>
> Attachments: LUCENE-4172.patch, LUCENE-4172.patch, LUCENE-4172.patch
>
>
> examples are things like ctors that list throws XYZException but actually dont, and things like 'throws CorruptIndex, LockObtainedFailed, IOException' when all of these are actually IOException.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org
[jira] [Updated] (LUCENE-4172) clean up redundant throws clauses
Posted by "Robert Muir (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/LUCENE-4172?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Robert Muir updated LUCENE-4172:
--------------------------------
Attachment: LUCENE-4172.patch
the start to a patch... eclipse doesn't do well here so it would be better to use something else to find these.
> clean up redundant throws clauses
> ---------------------------------
>
> Key: LUCENE-4172
> URL: https://issues.apache.org/jira/browse/LUCENE-4172
> Project: Lucene - Java
> Issue Type: Bug
> Reporter: Robert Muir
> Attachments: LUCENE-4172.patch
>
>
> examples are things like ctors that list throws XYZException but actually dont, and things like 'throws CorruptIndex, LockObtainedFailed, IOException' when all of these are actually IOException.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org
[jira] [Commented] (LUCENE-4172) clean up redundant throws clauses
Posted by "Robert Muir (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/LUCENE-4172?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13402956#comment-13402956 ]
Robert Muir commented on LUCENE-4172:
-------------------------------------
+1
I think you should commit before the patch gets out of date!
> clean up redundant throws clauses
> ---------------------------------
>
> Key: LUCENE-4172
> URL: https://issues.apache.org/jira/browse/LUCENE-4172
> Project: Lucene - Java
> Issue Type: Bug
> Reporter: Robert Muir
> Attachments: LUCENE-4172.patch, LUCENE-4172.patch
>
>
> examples are things like ctors that list throws XYZException but actually dont, and things like 'throws CorruptIndex, LockObtainedFailed, IOException' when all of these are actually IOException.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org
[jira] [Updated] (LUCENE-4172) clean up redundant throws clauses
Posted by "Steven Rowe (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/LUCENE-4172?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Steven Rowe updated LUCENE-4172:
--------------------------------
Attachment: LUCENE-4172.patch
Patch with manually vetted IntelliJ finds for global "Redundant throws clauses", "Redundant throws declarations", and "Duplicate throws". Compiles; Lucene&Solr tests pass.
Robert, I added another bullet at the top of your list of allowable contexts in which to remove redundant throws:
* nuke the redundant throws if the method is either in an anonymous inner class or in a final class
* nuke the redundant throws if its a static method, private, or package-private, or final
* nuke the redundant throws if its a ctor (subclass can always declare its own)
* keep the redundant throws if its public/protected non-final method that can be overridden
> clean up redundant throws clauses
> ---------------------------------
>
> Key: LUCENE-4172
> URL: https://issues.apache.org/jira/browse/LUCENE-4172
> Project: Lucene - Java
> Issue Type: Bug
> Reporter: Robert Muir
> Attachments: LUCENE-4172.patch, LUCENE-4172.patch
>
>
> examples are things like ctors that list throws XYZException but actually dont, and things like 'throws CorruptIndex, LockObtainedFailed, IOException' when all of these are actually IOException.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org
[jira] [Commented] (LUCENE-4172) clean up redundant throws clauses
Posted by "Michael McCandless (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/LUCENE-4172?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13403806#comment-13403806 ]
Michael McCandless commented on LUCENE-4172:
--------------------------------------------
I prefer the individual imports, not wildcards.
> clean up redundant throws clauses
> ---------------------------------
>
> Key: LUCENE-4172
> URL: https://issues.apache.org/jira/browse/LUCENE-4172
> Project: Lucene - Java
> Issue Type: Bug
> Reporter: Robert Muir
> Assignee: Steven Rowe
> Fix For: 4.0, 5.0
>
> Attachments: LUCENE-4172.patch, LUCENE-4172.patch, LUCENE-4172.patch
>
>
> examples are things like ctors that list throws XYZException but actually dont, and things like 'throws CorruptIndex, LockObtainedFailed, IOException' when all of these are actually IOException.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org
[jira] [Commented] (LUCENE-4172) clean up redundant throws clauses
Posted by "Robert Muir (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/LUCENE-4172?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13402680#comment-13402680 ]
Robert Muir commented on LUCENE-4172:
-------------------------------------
that sounds nice: I think we always want to fix 'duplicate throws'.
But redundant throws requires some decisions... basically i looked at each one and:
* nuke the redundant throws if its a static method, private, or package-private, or final
* nuke the redundant throws if its a ctor (subclass can always declare its own)
* keep the redundant throws if its public/protected non-final method that can be overridden
> clean up redundant throws clauses
> ---------------------------------
>
> Key: LUCENE-4172
> URL: https://issues.apache.org/jira/browse/LUCENE-4172
> Project: Lucene - Java
> Issue Type: Bug
> Reporter: Robert Muir
> Attachments: LUCENE-4172.patch
>
>
> examples are things like ctors that list throws XYZException but actually dont, and things like 'throws CorruptIndex, LockObtainedFailed, IOException' when all of these are actually IOException.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org
[jira] [Updated] (LUCENE-4172) clean up redundant throws clauses
Posted by "Steven Rowe (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/LUCENE-4172?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Steven Rowe updated LUCENE-4172:
--------------------------------
Attachment: LUCENE-4172.patch
Patch with more fixes.
When I went to commit from IntelliJ, it performed a pre-commit code inspection and found a bunch of unused imports, which I fixed. I also converted a bunch of {{import <package>.*;}} to individual imports, in the files that are already being touched by this change.
Compile works; I'm running through tests, and once they succeed I'll commit.
> clean up redundant throws clauses
> ---------------------------------
>
> Key: LUCENE-4172
> URL: https://issues.apache.org/jira/browse/LUCENE-4172
> Project: Lucene - Java
> Issue Type: Bug
> Reporter: Robert Muir
> Attachments: LUCENE-4172.patch, LUCENE-4172.patch, LUCENE-4172.patch
>
>
> examples are things like ctors that list throws XYZException but actually dont, and things like 'throws CorruptIndex, LockObtainedFailed, IOException' when all of these are actually IOException.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org
[jira] [Commented] (LUCENE-4172) clean up redundant throws clauses
Posted by "David Smiley (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/LUCENE-4172?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13403700#comment-13403700 ]
David Smiley commented on LUCENE-4172:
--------------------------------------
What's wrong with?:
import <package>.*;
-- especially when there are many classes?
And is there a coding standard that Lucene/Solr adheres to? I am unaware.
> clean up redundant throws clauses
> ---------------------------------
>
> Key: LUCENE-4172
> URL: https://issues.apache.org/jira/browse/LUCENE-4172
> Project: Lucene - Java
> Issue Type: Bug
> Reporter: Robert Muir
> Assignee: Steven Rowe
> Fix For: 4.0, 5.0
>
> Attachments: LUCENE-4172.patch, LUCENE-4172.patch, LUCENE-4172.patch
>
>
> examples are things like ctors that list throws XYZException but actually dont, and things like 'throws CorruptIndex, LockObtainedFailed, IOException' when all of these are actually IOException.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org