New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[java] MissingSerialVersionUID rule does not seem to catch inherited classes #1078

lgoldstein opened this Issue May 6, 2018 · 1 comment


None yet
3 participants

lgoldstein commented May 6, 2018

Please, prefix the report title with the language it applies to within brackets, such as [java] or [apex].
If not specific to a language, you can use [core].

Affects PMD Version:





Code Sample demonstrating the issue:

public class Foo implements Serializable {
     private static final long serialVersionUID = 1234567L;

// PMD does not complain about this class
public class Bar extends Foo {
    // ... no serialVersionUID value defined ...

see old rejected patch for same issue

Running PMD through: [Maven]


This comment has been minimized.


jsotuyod commented May 6, 2018

@lgoldstein definitely. The patch is useless nowadays (this is an XPath rule, maybe it wasn't back then?) but this can be easily fixed by adapting the rule to use the typeof instead of checking for [@Image = ...]. I'm therefore flagging this as an easy fix for newcomers wanting to contribute.

krichter722 added a commit to krichter722/pmd that referenced this issue Jul 26, 2018

Use typeof in MissingSerialVersionUID
The construct

or ClassOrInterfaceType/@image='']) =1

doesn't cover subclasses of a class or interface implementing or
extending Serializable whereas the `typeof` operator does.

close pmd#1078

@jsotuyod jsotuyod added this to the 6.6.0 milestone Jul 26, 2018

@adangel adangel added the has:pr label Jul 28, 2018

@adangel adangel modified the milestones: 6.6.0, 6.7.0 Jul 29, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment