Menu

#254 False+ : UnusedImport with Javadoc @throws

PMD-5.0.4
closed
None
PMD
3-Major
Bug
[4,
2014-04-30
2004-11-26
No

Javadoc generator uses import to fully qualified
classes mentionned in @link, for instance

@deprecated use {@link
ServiceProfileAdmin#setServiceStructure(ServiceProfileDescriptor,
ServiceStructureDescriptor)} instead.

PMD detect those imports as unused. (Eclipse behaves
correctly on this)

Discussion

  • Tom Copeland

    Tom Copeland - 2004-11-29

    Logged In: YES
    user_id=5159

    Hi Florent -

    Hmmm...... very interesting. Since PMD discards comments,
    it doesn't pick this up. Hm. I hesitate to call this a
    bug... but it would be nice if it picked up this "usage", so
    I suppose it is....

    Yours,

    Tom

     
  • Dmitry Malenok

    Dmitry Malenok - 2012-03-20

    The similar issue was fixed in checkstyle in 2011 (https://sourceforge.net/tracker/?func=detail&atid=397078&aid=652303&group_id=29721).

     
  • thomaslennon

    thomaslennon - 2013-02-22

    hi
    I'm interested in this "bug" due to hitting it in our project today. We were using pmd 4.6, but after downloading 5.0.2 I noticed it was still a problem. Can I help to fix it?

     
  • Andreas Dangel

    Andreas Dangel - 2013-03-02
    • assigned_to: Andreas Dangel
    • module: --> PMD
    • milestone: --> PMD-5.0.3
    • priority: 5 --> 3-Major
    • type: --> Bug
    • affects_version: --> [4,
     
  • Andreas Dangel

    Andreas Dangel - 2013-03-14

    Hi,
    can you provide me a sample file which triggers this false positive?
    PMD should already properly handle @see, @link and @value tags in javadocs.
    Thanks,
    Andreas

     
  • Andreas Dangel

    Andreas Dangel - 2013-03-15
    • status: open --> more-info-needed
     
  • Andreas Dangel

    Andreas Dangel - 2013-04-05
    • status: more-info-needed --> not-reproducible
     
  • thomaslennon

    thomaslennon - 2013-04-08

    I have a testcase I can give you to reproduce this bug.

    Apologies for the delay in getting back to you, I was traveling. Little maven project. It throws up an unused import in SampleApp

    mvn pmd:pmd

    If you want I can open a new bug.

     

    Last edit: thomaslennon 2013-04-08
  • Andreas Dangel

    Andreas Dangel - 2013-04-08

    Thanks for the test case.

    I see now the problem, when it occurs: When declaring a RuntimeException via the @throws tag only in javadoc. As it is a runtime exception, the method itself might not declare this exception explicitly.

     
  • Andreas Dangel

    Andreas Dangel - 2013-04-08
    • status: not-reproducible --> accepted
    • milestone: PMD-5.0.3 --> PMD-5.0.x
     
  • Andreas Dangel

    Andreas Dangel - 2013-04-15
    • summary: False+ : UnusedImport with Javadoc @link --> False+ : UnusedImport with Javadoc @throws
    • status: accepted --> in-progress
    • Milestone: PMD-5.0.x --> PMD-5.0.4
     
  • Andreas Dangel

    Andreas Dangel - 2013-04-15
    • status: in-progress --> closed
     

Log in to post a comment.