8000 bugfix:第 15 章翻译有点问题 by chelintsien · Pull Request #515 · lingcoder/OnJava8 · GitHub
[go: up one dir, main page]

Skip to content

bugfix:第 15 章翻译有点问题 #515

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

Merged
merged 3 commits into from
Jul 21, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update 15-Exceptions.md
翻译问题
  • Loading branch information
chelintsien authored Jul 21, 2020
commit 1e7dd2adec630ec422b3b278cdbc8aa6cfb4fc7e
2 changes: 1 addition & 1 deletion docs/book/15-Exceptions.md
Original file line number Diff line number Diff line change
Expand Up @@ -1890,7 +1890,7 @@ Caught: CloseException

从技术上讲,我们并没有被迫在这里提供一个 catch 子句;你可以通过 **main() throws CloseException** 的方式来报告异常。但 catch 子句是放置错误处理代码的典型位置。

请注意,因为所有三个对象都已创建,所以它们都以相反的顺序关闭 - 即使 Closer.close() 抛出异常也是如此。仔细想想,这就是你想要的结果。但如果你必须自己编写所有的逻辑,你可能会错过一些东西,并把它弄错。想象一下那里所有的代码,程序员没有考虑清理的所有影响,并且做错了。因此,应始终尽可能使用 try-with-resources。它有助于实现该功能,使得生成的代码更清晰,更易于理解。
请注意,因为所有三个对象都已创建,所以它们都以相反的顺序关闭 - 即使 Closer.close() 抛出异常也是如此。仔细想想,这就是你想要的结果。但如果你必须亲手编写所有的逻辑,或许会丢失一些东西并使得逻辑出错。想想那些程序员没有考虑 Clean up 的所有影响并且出错的代码。因此,应始终尽可能使用 try-with-resources。它有助于实现该功能,使得生成的代码更清晰,更易于理解。
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

因此,应始终尽可能使用 try-with-resources。它有助于实现该功能,使得生成的代码更清晰,更易于理解。

这个英文原文是啥。

「始终尽可能」使用,这两个表示程度的词一起出现在中文是个病句。

贴出来咱们再一起看下

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For that reason you should always use try-with-resources
whenever you can. It helps a lot that the feature also makes the
resulting code much cleaner and easier to understand.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这句“它有助于实现该功能” 也是有问题的

应该是这特性有助于。。。

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

如果可以,你应当始终使用 try-with-resources。这个特性有助于生成更简洁,更易于理解的代码

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

后面半句的翻译也是完全不对了

Copy link
Contributor Author

Choose a reason for hiding this comment

5EDE The reason will be displayed to describe this comment to others. Learn more.

后面半句的翻译也是完全不对了

已经更新为你上面发的译文了


<!-- Exception Matching -->

Expand Down
0