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 150145
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T09:14:37+00:00 2026-05-11T09:14:37+00:00

On line: private boolean someFlag; I get the following PMD warning: Found non-transient, non-static

  • 0

On line:

private boolean someFlag; 

I get the following PMD warning:

Found non-transient, non-static member. Please mark as transient or provide accessors.

Can someone please explain why this warning is there and what it means? (I understand how to fix it, I don’t understand why it’s there…)

I’m getting this on many other member declarations as well…


EDIT: My class is definitely not a bean, and not serializable…

  • 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. 2026-05-11T09:14:38+00:00Added an answer on May 11, 2026 at 9:14 am

    I assume your class is a bean that by definition implements Serializable. A transient variable will be excluded from the serialization process. If you serialize and then deserialize the bean the value will be actually have the default value.

    PMD assumes you are dealing with a serializable bean here. For a bean it is expected to have getters/setters for all member variables. As you have omitted these, you imply that your member variable is not part of the bean ….and so does not need to be serialized. If that is the case you should exclude it from the serialization. Which you do by marking the variable as ‘transient’.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Consider the following line of code: private void DoThis() { int i = 5;
public class BloodPressure { public Int16? Diastolic { get; set; } private Boolean IsValid
Why is it bad practice to declare variables on one line? e.g. private String
Given the URL (single line): http://test.example.com/dir/subdir/file.html How can I extract the following parts using
How can I get line numbers to print in Visual Studio 2005 when printing
I have a strange problem which I can't fix: A field: private boolean[][][] gaps;
I get null pointer exception at line mService.start() when i try to bind to
What does this line from the following code sample mean? synchronized (_surfaceHolder) { _panel.onDraw(c);
I never get paint written to my command line window when I use Eclipse
I've got the following MapOverlay . The following line is throwing a NullPointer but

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.