Repository navigation
[java] Model connect and no-arg constructors of piped streams - #2294
Merged
Merged
Conversation
PipedReader() and PipedWriter() were not tracked as resources, and connect on the four piped classes was not modeled as a call that can throw IOException. A pipe end closed only on the normal path after connect was therefore never reported.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two gaps in the Java Pulse models for piped streams:
PipedReader()andPipedWriter()(no-arg constructors) were not tracked as resources. Only the constructors that take the other end were covered, through the genericReader/Writerdelegation model.connectonPipedInputStream,PipedOutputStream,PipedReaderandPipedWriterwas not modeled, so Pulse did not know it can throwIOException.Because of this, a pipe end created with the no-arg constructor and closed only on the normal path after
connectwas never reported.FN_pipedReaderNotConnectedBadandFN_pipedWriterNotClosedAfterConnectBadshow this.<init>(justthis) ofPipedReader/PipedWriterwithResource.allocate. These constructors don't throw. The constructors that take the other end keep the existing delegation model.connecton all four piped classes withResource.use ~exn_class_name:"java.io.IOException", the same wayread/writeare modeled.Tests
FN_pipedReaderNotConnectedBadandFN_pipedWriterNotClosedAfterConnectBadare renamed without theFN_prefix and are now reported.pipedReaderNotClosedAfterConnectOkwas a leak (close()is skipped ifconnectorreadthrows), so it is renamedpipedReaderNotClosedAfterReadBadand is now reported.pipedInputStreamNotClosedAfterConnectBadandpipedOutputStreamNotClosedAfterConnectBadinResourceLeaks.javacoverconnectfor the byte streams.pipedReaderClosedOk,pipedWriterClosedOkand the otherOkcases stay clean.FN_pipedWriterNotConnectedBadandFN_pipedReaderWriterBadare left as they are.Test plan
PULSE_RESOURCE_LEAKfor all 5, allocated by thePipedReader(),PipedWriter(),PipedInputStream()orPipedOutputStream()constructormake direct_java_pulse_test: the onlyissues.expchanges are those 5 lines. (As in [java] Track PipedInputStream and PipedOutputStream as resources #2290, I still get the unrelated lambda-name differences in InvokeDynamic/TransitiveAccess locally with my javac; not committed.)ocamlformat0.29.0 reports no changes forPulseModelsJava.ml