-
Notifications
You must be signed in to change notification settings - Fork 1k
Simplify Chinese translation of Scala Tour: annotations.md #1210
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
Conversation
4da6767
to
88d4d24
Compare
_zh-cn/tour/annotations.md
Outdated
@@ -13,3 +13,114 @@ language: zh-cn | |||
next-page: default-parameter-values | |||
previous-page: by-name-parameters | |||
--- | |||
|
|||
注解将元信息与定义相关联。 例如,方法之前的注解 `@deprecated` 会导致编译器在该方法被调用时打印警告信息。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
被调用
-> 被使用
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot.
_zh-cn/tour/annotations.md
Outdated
``` | ||
这个程序可以编译,但编译器将打印一个警告信息: "there was one deprecation warning"。 | ||
|
||
注解子句适用于其后的第一个定义或声明。 在定义和声明之前可以有多个注解子句。 这些子句的顺序并不重要。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
适用于
--> 作用于
?
?子句
这些子句
-> 这些注解
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot.
_zh-cn/tour/annotations.md
Outdated
|
||
|
||
## 影响代码生成的注解 | ||
像 `@inline` 这样的注解会影响生成的代码(即你的 jar 文件可能与你没有使用注解时有不同的字节)。 内联表示在调用点插入被调用方法体中的代码。 生成的字节码更长,但有希望能运行得更快。 使用注解 `@inline` 并不能确保方法内联,但是当且仅当满足某些生成代码大小的启发式算法时,它会触发编译器执行此操作。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
但是当且仅当
它才会触发
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot.
_zh-cn/tour/annotations.md
Outdated
|
||
### Java 注解 ### | ||
在编写与 Java 互操作的 Scala 代码时,注解语法中存在一些差异需要注意。 | ||
**注意:** 确保你在使用 `-target:jvm-1.8` 选项时使用 Java 注解。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
你在使用 开启 -target:jvm-1.8
选项
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot.
_zh-cn/tour/annotations.md
Outdated
public class MyClass extends HisClass ... | ||
``` | ||
|
||
Scala 在这方面提供了更强的灵活性 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
更强
-> 更大
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot.
… to liufengyun's suggestion
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot @realwunan 🎉
Simplify Chinese translation of Scala Tour: Annotations