Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removal of non deprecated method SourceFile fromInputStream #4157

Closed
Lonzak opened this issue Mar 4, 2024 · 3 comments
Closed

Removal of non deprecated method SourceFile fromInputStream #4157

Lonzak opened this issue Mar 4, 2024 · 3 comments

Comments

@Lonzak
Copy link

Lonzak commented Mar 4, 2024

I wanted to update our (pretty) old version of the closure-compiler to a newer one. I was able to fix all issues except for the following. We are using the following method:

SourceFile.fromInputStream(name, inpustream, StandardCharsets.UTF_8);

The method still exists in version v20210601 but was removed in version v20210808

Removal of deprecated method is not uncommon however there are two methods: one deprecated and one without deprecations - and both were removed. The commit can be found here.

@Deprecated
  @GwtIncompatible("java.io.InputStream")
  public static SourceFile fromInputStream(String fileName, InputStream s)
      throws IOException {
    return builder().withPath(fileName).withContent(s).build();
  }

  @GwtIncompatible("java.io.InputStream")
  public static SourceFile fromInputStream(String fileName, InputStream s, Charset charset)
      throws IOException {
    return builder().withPath(fileName).withCharset(charset).withContent(s).build();
  }

The removal of an non deprecated method is not a good idea. Was this intentional? Could the method be added again?

@lauraharker
Copy link
Contributor

Does switching SourceFile.fromInputStream(fileName, s, charset); => SourceFile.builder().withPath(fileName).withCharset(charset).withContent(s).build(); work?

I agree it's best practice to deprecate methods before removing them, but as the SourceFile builder API still supports this pattern and it's been gone for a few years, I don't think it's reasonable to add back at this point.

@Lonzak
Copy link
Author

Lonzak commented Mar 5, 2024

Yes that is what I ended up doing - I replaced it with the code you mentioned... Some migration guide would have been helpful - took quite some research to figure that out :-)

@lauraharker
Copy link
Contributor

Added something to the 20210808 release notes at https://github.com/google/closure-compiler/wiki/Releases#august-8-2021-v20210808.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants