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

  • SEARCH
  • Home
  • 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 3457192
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T09:49:50+00:00 2026-05-18T09:49:50+00:00

In one library that is in heavy use in our project there is a

  • 0

In one library that is in heavy use in our project there is a restriction that variables of its classes must never be static. (It is ULC). As far as I understood it is because of the need to serialize all of them. And the problem with this rule, is that it is not strict and may be the cause of bugs that are very hard to debug.

We are going to write a module for Checkstyle to detect static variables of such types (detected by some customizable regexp probably). And we need to know how necessary is this check for other developers.

So the question is: What are the general circumstances when variables of some types must never be static?

  • 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-05-18T09:49:51+00:00Added an answer on May 18, 2026 at 9:49 am

    First, proper object oriented design should inform the decision to make a method/field static.

    Second, in a web application, where requests are all handled on separate threads, you have to be very careful how you use static methods/fields. If your static method maintains any state across invocations(by using a static field to keep a count, for example), you can run into threading issues. This happens because one request might invoke the static method, and then be stopped in the middle of execution by another thread that invokes the method. If the first invocation modified a common resource, but did not finish, the second invocation might corrupt the progress of the first execution.

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

Sidebar

Related Questions

I am wondering if there is a library one can use that calculates elapsed
I use one library which is very important and untouchable. The problem is that
I'm working on a library that makes heavy use of the latest C++0x language
I'm creating a c++ library that makes heavy use of smart pointers, both in
Can any one tell me an opensource js library that can have a real-time
I've got several android projects that share one of my library projects. I want
I need an alternative to the std library's matrix functions, preferably one that is
I have created one library project in iphone and my images folder is present
as opposed to writing your own library. We're working on a project here that
I've been working with layers for MapKit on the iPhone, and one library that

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.