Skip to content
Permalink
Browse files
8263684: Avoid wrapping into BufferedWriter twice
Reviewed-by: prappo
  • Loading branch information
jonathan-gibbons committed May 19, 2021
1 parent 9820f3d commit 74f30ad38baecc0f7e9b64124fa9a6b801c280a3
Showing with 4 additions and 2 deletions.
  1. +4 −2 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/ElementListWriter.java
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -74,7 +74,9 @@ public static void generate(BaseConfiguration configuration) throws DocFileIOExc
}

protected void generateElementListFile(DocletEnvironment docEnv) throws DocFileIOException {
try (BufferedWriter out = new BufferedWriter(file.openWriter())) {
try (Writer fileWriter = file.openWriter();
BufferedWriter out = (fileWriter instanceof BufferedWriter b) ? b
: new BufferedWriter(fileWriter)) {
if (configuration.showModules) {
for (ModuleElement mdle : configuration.modulePackages.keySet()) {
if (!(options.noDeprecated() && utils.isDeprecated(mdle))) {

0 comments on commit 74f30ad

Please sign in to comment.