Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8033765
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T01:48:07+00:00 2026-06-05T01:48:07+00:00

This question is not about how to use Serializable , I already know that.

  • 0

This question is not about how to use Serializable, I already know that. However, I was wondering how implementing Serializable brings up the following warning:

The serializable class MyClass does not declare a static final serialVersionUID field of type long

Suppose I wanted to write an interface like Serializable, how would I go about “warning” the programmer implementing my interface to declare a variable? I’ve tried looking at the source code for Serializable.java but I couldn’t find anything which would result in this behaviour. Is this even possible?

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T01:48:11+00:00Added an answer on June 5, 2026 at 1:48 am

    I think the behavior you’re looking for would be better implemented using annotations and the annotation processor. The fact that the compiler warns you about not declaring serialVersionUID is handled by a different mechanism at the compiler level (and therefore, out of the reach of the programmer); it’s more of a coding convention enforced by the serialization API than a consequence of implementing the Serializable interface.

    In fact, here you can examine the source code of Serializable and as you can see, there’s nothing special about it for forcing a compiler warning:

    /* comments removed for brevity */
    package java.io;
    public interface Serializable {
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This question is not about 'best' barcode library recommendation, we use various products on
(note that this question is not about CAS, it's about the May fail spuriously
This question is NOT about race-conditions, atomicity, or why you should use locks in
This question is NOT about how to use any language to generate a random
Please note that this question is about CGLayer (which you typically use to draw
Caveats: Let me first clarify that this is not a question about whether to
My question is not about how to solve this error(I already solved it) but
This question is not about which is the best, it is about which makes
How can I plot a figure like this: My question is not about subplot
For starters, this question is not so much about programming in the NetBeans IDE

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.