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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T07:38:39+00:00 2026-05-27T07:38:39+00:00

In Guava 10+, Google deprecated Files.deleteDirectoryContents() . JavaDoc says Deprecated. This method suffers from

  • 0

In Guava 10+, Google deprecated Files.deleteDirectoryContents(). JavaDoc says

Deprecated. This method suffers from poor symlink detection and race
conditions. This functionality can be supported suitably only by
shelling out to an operating system command such as rm -rf or del /s.
This method is scheduled to be removed from Guava in Guava release
11.0

I am confused on why there is a race condition. I think having this method is actually useful and find shelling out to operating system a poor solution. Can the authors share why the made this decision?

  • 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-27T07:38:39+00:00Added an answer on May 27, 2026 at 7:38 am

    I am confused on why there is a race condition.

    For example, suppose that one thread calls Files.deleteDirectoryContents() and a second thread (or an external process) simultaneously creates a new file in the directory.

    When you return from the call, can you rely on the directory being empty? Nope!

    Anyway, if you find the functionality of this method to be useful … despite its flaws … you are free to take a copy of the code, tweak it, and embed it in your application. (Just check the Guava source code license and make sure that you conform to it.)

    Can the authors share why the made this decision?

    I think that they already have; see the deprecation notice. If you want more, try searching the issue tracker and the Guava discussion group. You could even try asking politely on the discussion group, though if your agenda is to change their minds, I doubt that you will succeed.

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

Sidebar

Related Questions

I'm using MultiMap from Google Guava 12 like this: Multimap<Integer, OccupancyType> pkgPOP = HashMultimap.create();
UPDATE: It looks like my 13.0.1 is calling code from this diffed CharMatcher. http://code.google.com/p/guava-libraries/source/diff?spec=svn69ad96b719d7cd3d872a948d7454f17b816a21c2&r=464b0cfab7c3b6713c35e6f3ae7426542668c77b&format=side&path=/guava/src/com/google/common/base/CharMatcher.java
From Google Guava JavaDoc for Iterables : static <T> T getFirst(Iterable<T> iterable, T defaultValue)
I'm trying to use AbstractScheduledService from google guava lib. In the docs for this
There are a few factory methods in Google Guava to create InputSuppliers, e.g. from
I have a java file Test.java (below) which uses Guava's HashMultiMap (downloaded from http://code.google.com/p/guava-libraries/
I love Google Guava and use it a lot, but there is one method
I was using com.google.common.collect.PrimitiveArrays from Google Collections, however I cannot find it in Guava,
The com.google.common.base.Function interface (from Google Guava ) defines apply as: @Nullable T apply(@Nullable F
I am having trouble using the MapMaker from google-guava. Here is the code: package

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.