Age | Commit message (Collapse) | Author |
|
- Mostly migrate to Checker Framework declaration annotations.
- Migrate @GuardedBy to a custom annotation for now. (We would migrate to Error Prone's, but that's causing me problems as I experiment with JPMS.)
Compare to b/69411537 for Guava.
I've left @ParametersAreNonnullByDefault in place for now, but we'd need to remove it to fully eliminate the jsr305 dep.
RELNOTES=Migrated from jsr305 `@Nullable` to Checker Framework `@NullableDecl`. In addition to the new dependency on the Checker Framework annotations, we keep the dependency on jsr305 for now so that we can keep using `@ParametersAreNonNullByDefault`.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=272713254
|
|
Renames may include:
- containsAllOf => containsAtLeast
- containsAllIn => containsAtLeastElementsIn
- isSameAs => isSameInstanceAs
- isOrdered => isInOrder
- isStrictlyOrdered => isInStrictOrder
The other major change is to change custom subjects to extend raw Subject instead of supplying type parameters. The type parameters are being removed from Subject. This CL will temporarily produce rawtypes warnings, which will go away when I remove the type parameters (as soon as this batch of CLs is submitted).
Some CLs in this batch also migrate calls away from actualAsString(). Its literal replacement is `"<" + actual + ">"` (unless an object overrides actualCustomStringRepresentation()), but usually I've made a larger change, such as switching from an old-style "Not true that..." failure message to one generated with the Fact API. In that case, the new code usually contains a direct reference to this.actual (a field that I occasionally had to create). Another larger change I sometimes made is to switch from a manual check-and-fail approach to instead use check(...). And sometimes I just remove a withMessage() call that's no longer necessary now that the code uses check(...), or I introduce a check(...) call. (An assertion made with check(...) automatically includes the actual value from the original subject, so there's no need to set it again with withMessage().)
Finally, there's one CL in this batch in which I migrate a Correspondence subclass to instead use Correspondence.from.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=251486146
|
|
RELNOTES=n/a
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=250762064
|
|
(https://github.com/google/truth/issues/556)
RELNOTES=n/a
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=250746093
|
|
Subject.fail* methods or, in some cases, to Subject.check.
Most of the changes in this CL were made manually.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=247414164
|
|
read that.
actual() is being removed.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=247003356
|
|
RELNOTES=n/a
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=246869377
|
|
description.
The overload that accepts a description generally produces better failure messages:
- The first line of the message it produces is something like: "value of: myProto.getResponse()" (where "getResponse()" is taken from the provided description)
- The last line of the message it produces is something like: "myProto was: response: query was throttled" (the full value of myProto)
- And the existing text goes in between.
Additional motivation: We are deleting the no-arg overload externally (and probably internally thereafter).
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=246824728
|
|
failWithActual(String, Object), tweaking verbs for the new grammar.
Before:
fail("has foo", expected);
After:
failWithActual("expected to have foo", expected);
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=246144541
|
|
(The exact change is slightly different in some cases, like when using custom subjects or check(), but it's always a migration from named(...) to [assert]WithMessage(...).)
named(...) is being removed.
This CL may slightly modify the failure messages produced, but all the old information will still be present.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=245027649
|
|
The two behave identically, and containsAllOf is being removed.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=244876613
|
|
Subject.check(...).
Before:
if (actual().foo() != expected) {
fail("has foo", expected);
}
After:
check("foo()").that(actual().foo()).isEqualTo(expected);
This CL changes the format of the failure message. The new message will typically contain the same information as the old, but if some is missing, let us know, and consider adding a test.
The overload of check(...) used by this CL was added in Truth 0.40.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=244408001
|
|
RELNOTES=Run google-java-format over all of JimFS.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=244231542
|
|
the file if the TRUNCATE_EXISTING option was explicitly provided and the WRITE option wasn't.
The code that handles TRUNCATE_EXISTING requires that WRITE also be present for it to do anything (because it's documented that it's ignored otherwise), but newOutputStream should always add the WRITE option if the user doesn't provide it because an OutputStream is obviously for writing. (This matches the default behavior of FileSystemProvider.newOutputStream as well.)
Fixes #77
RELNOTES=Fixed an issue where `Files.newOutputStream` wouldn't truncate the file if the `TRUNCATE_EXISTING` option was explicitly provided and the `WRITE` option wasn't.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=237818016
|
|
RELNOTES=n/a
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=191319699
|
|
RELNOTES=N/A
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=181787747
|
|
This cleanup is being performed in preparation for enabling a
compiler error.
From the javadoc for Files.list:
The returned stream encapsulates a DirectoryStream. If timely disposal
of file system resources is required, the try-with-resources construct
should be used to ensure that the stream's close method is invoked
after the stream operations are completed.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=180930883
|
|
Also changed truth.SubjectFactory to truth.Subject.Factory (plain renaming) and use method reference instead of anonymous class to create the factory when applicable.
FailureMetadata, an opaque object to its users, is introduced to replace FailureStrategy in in custom Subject in order to resolve some existing flaws of FailureStrategy as well as enable new features to be added to Truth.
New API is available in Truth-0.36, if there is a build/pom.xml, it's also updated to use this version.
More information: See [] & []
Tested:
TAP --sample for global presubmit queue
[]
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=175818007
|
|
- Throw UOE instead of IAE when attempting to set an attribute that can't be set at all during file creation. This matches the behavior of the real file system implementations.
- Make the owner:owner attribute not settable during file creation, which also matches the actual behavior.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=117965277
|
|
This commit modifies the behavior when setting unsupported attributes to
throw an UnsupportedOperationException instead of an
IllegalArgumentException. This is to make
JimfsFileSystemProvider#createDirectory and
JimfsFileSystemProvider#newByteChannel behave consistently with the
Javadocs for FileSystemProvider#createDirectory and
FileSystemProvider#newByteChannel which require an
UnsupportedOperationException to be thrown when the array of attributes
contains attributes which can not be set. In particular, these methods
are invoked via Files#createTempDirectory and Files#createFile which
have the same requirement regarding throwing an
UnsupportedOperationException when the array of attributes contains
attributes which can not be set. Most notably, this causes a discrepancy
between the handling of Jimfs when configured to act like a Windows
filesystem versus the behavior of sun.nio.fs.WindowsFileSystem where the
former will throw an IllegalArgumentException if an attempt is made to
set a POSIX attribute but the latter will throw an
UnsupportedOperationException (consistent with the Javadocs).
|
|
The tests are racy, and I don't have a good way to fix that. This change just makes the (much) rarer case where the race ends with the channel being closed before the read/write operations get to the point where they check that the channel is open also pass the test. Unfortunately it doesn't differentiate between that case happening once in a thousand times and happening every time (which would be a problem).
Also simplify a bunch of stuff using SettableFuture.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=112606151
|
|
We've determined that NTFS does not do locale-dependent case mapping (and neither do any other file systems we know of), so providing this option is unnecessary and misleading.
I'm leaving the removal of a TODO I had to consider allowing Turkish-correct case folding and also adding in some notes about the whole situation for posterity.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=111990375
|
|
WatchService that Jimfs creates for watching for directory changes.
This is done in such a way that it doesn't make it awkward to create a new WatchService implementation in the future.
Fixes https://github.com/google/jimfs/issues/14.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=111885937
|
|
|
|
This is in preparation for turning on a static analysis check for this.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=96412671
|
|
Made a bunch of manual fixes, but mostly pretty good.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=94692335
|
|
- tryLock() shouldn't handle interruption.
- lock() should throw FileLockInterruptionException rather than ClosedByInterruptException.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=91829785
|
|
- Update it to handle thread interruption for all methods that handle interruption in the default FileChannel implementation (with the exception of map(), for which we always throw UOE). For most methods that weren't already handling interruption, this mostly just means that if they're called on a thread that's already interrupted they'll throw ClosedByInterruptException and close the channel. Requested in GitHub issue #21. Also add tests for this.
- Make it possible for FileChannel methods that don't use the channel's position (they have a parameter for a specific file position) to proceed concurrently with other FileChannel methods, which is specified as legal in the FileChannel docs: "Other operations, in particular those that take an explicit position, may proceed concurrently".
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=91435386
|
|
a directory.
See this issue: https://github.com/google/jimfs/issues/16
I was initially reluctant to do this because it seems strange to actually access the file system to convert a path to a URI, but this does in fact seem to be the behavior for actual Unix paths. Additionally, when looking into creating a ClassLoader that takes Path objects for the classpath, I noticed that URLClassLoader treats URLs that end with / differently (as directories) from those that don't, which indicates that there are real consequences for not doing this. Note: URLClassLoader is tied to the default file system via File/JarFile by default, so it's not like this change actually enables it to just work with Jimfs files (nor do I have any real reason to think you'd even want to do that, I was just curious).
This involves changing the PathType API to take a boolean parameter indicating whether or not the file is a directory in its method for getting a URI path, which makes this an incompatible change that would probably require a 2.0 release (not that I expect anyone's actually implementing their own PathType).
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=87278575
|
|
Also change usages of base.Objects methods to java.util.Objects where possible.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=87182713
|
|
Maven build errors, suggesting that the method should be annotated with @Test.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=87177747
|
|
See https://github.com/google/jimfs/issues/18 for more information.
- SystemJimfsFileSystemProvider (which is loaded as a service by the system classloader) only serves as a cache of FileSystem instances as needed to make Paths.get(URI) work.
- JimfsFileSystemProvider is the actual provider that is returned by JimfsFileSystem.provider(). It is a singleton and provides the real implementation of most of the FileSystemProvider methods, but does not cache FileSystem instances.
We now create the FileSystem instances directly when the user calls Jimfs.newFileSystem rather than passing the Configuration off to FileSystems.newFileSystem. This should ensure no classloader issues when creating the FileSystem. Once created, the FileSystem itself is passed to FileSystems.newFileSystem. There should be no classloader issues here either, since the new SystemJimfsFileSystemProvider implementation does not deal with any other Jimfs-specific classes.
Also add a test that fails without this change.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=87170296
|
|
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=86811396
|
|
For URLs to work, Java has to be able to find a URLStreamHandler implementation for the URL protocol/scheme. There isn't any really ideal way to do this programatically, but what this CL does is add "com.google.common" to the "java.protocol.handler.pkgs" system property when JimfsFileSystemProvider is initialized. This means that when Java tries to create a URL with the "jimfs" protocol, it'll look for "jimfs.Handler" under "com.google.common", find it and use it. (Documentation of that behavior found here: http://docs.oracle.com/javase/8/docs/api/java/net/URL.html#URL-java.lang.String-java.lang.String-int-java.lang.String-)
Fixes Github issue #13.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=86627713
|
|
Tested:
TAP --sample for global presubmit queue
[]
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=86014119
|
|
Tested:
TAP --sample for global presubmit queue
[]
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=85451232
|
|
exception when the stream is already already closed.
This matches the behavior of other core OutputStream implementations such as that returned by Files.newOutputStream(Path) for the default FileSystem and prevents an exception when nesting an OutputStream inside a BufferedOutputStream inside an OutputStreamWriter using try-with-resources under JDK8 (among any number of other situations that could cause the same problem).
(Details: try-with-resources closes each declared resource in reverse order. Closing the OutputStreamWriter causes the BufferedOutputStream to be closed which causes the unbuffered OutputStream to be flushed and then closed. Closing the BufferedOutputStream then tries to flush the unbuffered OutputStream again. Prior to JDK8, any exception thrown by this flush() was swallowed and completely ignored; in JDK8, the behavior changed to (correctly) throw that exception.)
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=84439059
|
|
containsExactly(...).inOrder().
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=78848947
|
|
-has().item(...) -> contains(...)
-has().allOf(...) -> containsAllOf(...)
-has().exactly(...) -> containsExactly(...)
-has().exactlyAs(...) -> containsExactlyElementsIn(...)
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=78681455
|
|
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=78584467
|
|
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=74628842
|
|
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=74309082
|
|
either one or two events depending on when exactly a poll occurs.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=73325083
|
|
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=73318805
|
|
-MapSubject.hasKey(key).withValue(value) to MapSubject.containsEntry(key, value)
-MapSubject.hasKey(key) to MapSubject.containsKey(key)
-MapSubject.lacksKey(key) to MapSubject.doesNotContainKey(key)
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=73223123
|
|
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=73145243
|
|
"assertThatPath" so that we can static import Truth.assertThat for normal Truth assertions instead of using assert_().that.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=72751369
|
|
- Greatly increase timeout on PollingWatchService tests. The timeout shouldn't matter unless something's terribly wrong, so it should be ok to make it long.
- Try to ensure that asynchronous close tests for JimfsFileChannel are working as expected by being more careful in ensuring that all threads start blocking properly. Also switch to using Truth instead of assertTrue so that we'll get error messages that are actually helpful if the tests still fail.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=72748113
|
|
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=72563991
|
|
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=72403557
|