由于 Java 中合法注释中的内容而导致的错误 [英] Error due to content in a legal Comment in Java

查看:37
本文介绍了由于 Java 中合法注释中的内容而导致的错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

关于这个coderanch 链接,我发现以下注释会导致编译器错误 :-

On this coderanch link, I found that the following comment will give compiler error :-

// Compiler Error due to this Unicode char 'u000a'

原因是,Unicode 序列直接替换为它对应的实际字符.由于'u000a'对应的是newLine字符,所以在找到'u000a'的地方放置一个newLine.

Reason being, the Unicode sequence is directly replaced by the actual character it corresponds to. Since 'u000a' corresponds to newLine character, a newLine is placed at the place where 'u000a' is found.

我的问题是,还有没有其他方法会因评论而导致编译错误?"

My question is that, "Is there any other way of having Compilation Error due to a comment?"

推荐答案

如果您在注释中定义了不推荐使用的函数 (@deprecated),并且您将编译器设置为在不推荐使用的方法时抛出错误使用(至少可以配置内部 Eclipse 编译器,AFAIK)

IF you define a function a deprecated in a comment (@deprecated), AND you set your compiler to throw errors when deprecated methods are used (at least the internal Eclipse compiler can be configured this was, AFAIK)

这篇关于由于 Java 中合法注释中的内容而导致的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆