Checkstyle规则JavadocStyle不允许使用标记<u>
.根据文档,在Sun提供的DocCheck doclet检查后,检查结果已经过模式化.不幸的是,我没有在任何地方找到DocCheck.我也没有在Javadoc中找到任何关于允许的HTML标记的官方文档.有没有?
我想写
http://www.foo.com/
Run Code Online (Sandbox Code Playgroud)
并获得URL作为文本的链接(例如,在HTML输出中).我不想写
[http://www.foo.com/](http://www.foo.com/)
Run Code Online (Sandbox Code Playgroud)
可能吗?
鉴于Kotlin 1.1.对于instance
一些类,instance::class.java
并instance.javaClass
似乎是等效的:
val i = 0
println(i::class.java) // int
println(i.javaClass) // int
println(i::class.java === i.javaClass) // true
Run Code Online (Sandbox Code Playgroud)
然而,有一个微妙的区别:
val c1: Class<out Int> = i::class.java
val c2: Class<Int> = i.javaClass
Run Code Online (Sandbox Code Playgroud)
instance.javaClass
可忽略地缩短,但instance::class.java
与类型的相应用法更加一致.虽然您可以.javaClass
在某些类型上使用,但结果可能不是您所期望的:
println(i::class.java === Int::class.java) // true
println(i.javaClass === Int.javaClass) // false
println(Int::class.java === Int.javaClass) // false
println(Int.javaClass) // class kotlin.jvm.internal.IntCompanionObject
Run Code Online (Sandbox Code Playgroud)
所以,我认为最好永远不要使用.javaClass
更多的一致性.有没有反对的论据?
该NHibernate的文档和书籍的NHibernate在行动状态高速缓存提供商NHibernate.Cache.HashtableCacheProvider
不能用于生产用途.但是,我找不到理由.有谁知道原因?
手动保持多个Visual Studio项目的属性同步是令人讨厌的.那么,您如何在多个项目之间共享属性?
编辑:我指的是条件编译符号,警告和错误处理等属性,即您可以在项目 - >属性选项卡中配置或通过编辑项目XML文件.
类似的问题已经被问过,见:1,2和3.但是,根据我的理解,答案是C++特有的.我正在寻找C#项目的答案.不过,如果你保持分离清晰,请不要犹豫,回答其他类型的项目(Visual Basic等),因为除了我之外的其他人可能会感兴趣.
这篇博客文章提出了解决问题的方法,但我更喜欢更简单的方法.
此外,您至少可以通过以下方式解决问题的一部分(请注意,虽然我测试了它,但我没有彻底测试它):
使用您要共享的程序集属性创建AssemblyInfo.cs文件.链接到各个项目中的此现有项目.使用原始(本地)AssemblyInfo.cs并将项目特定的程序集属性放在那里.不幸的是,覆盖属性似乎不起作用,现在通过GUI管理属性是有限的.
c# projects-and-solutions properties assembly-attributes visual-studio
对于盒装int
,例如object boxedInt = 0
在代码中定义,is object
并在Visual Studio的立即窗口中is int
返回false
.这是一个bug,不是吗?
码:
int normalInt = 0;
Debug.WriteLine(normalInt.GetType().FullName); // System.Int32
Debug.WriteLine(normalInt is object); // true
Debug.WriteLine(normalInt is int); // true
Debug.WriteLine(normalInt is System.Int32); // true
object boxedInt = 0;
Debug.WriteLine(boxedInt.GetType().FullName); // System.Int32
Debug.WriteLine(boxedInt is object); // true
Debug.WriteLine(boxedInt is int); // true
Debug.WriteLine(boxedInt is System.Int32); // true
Run Code Online (Sandbox Code Playgroud)
即时窗口:
normalInt.GetType().FullName
"System.Int32"
normalInt is object
true
normalInt is int
true
normalInt is System.Int32
true
boxedInt.GetType().FullName
"System.Int32"
boxedInt …
Run Code Online (Sandbox Code Playgroud) 当我开始使用 Chrome 的启动配置进行调试时,浏览器将打开。但是当我使用 Firefox 的启动配置时,浏览器无法打开。但 Firefox 进程已启动。没有错误消息。
.vscode/launch.json:
{
"version": "0.2.0",
"configurations": [
{
"type": "chrome",
"request": "launch",
"name": "Chrome + localhost",
"url": "http://localhost:4200",
"webRoot": "${workspaceFolder}"
},
{
"type": "firefox",
"request": "launch",
"reAttach": true,
"name": "Firefox + localhost",
"url": "http://localhost:4200",
"webRoot": "${workspaceFolder}"
},
]
}
Run Code Online (Sandbox Code Playgroud) 配置Eclipse 4.2.0以执行空分析(配置为使用@javax.annotation.Nonnull
等)时,以下代码将生成警告
空类型安全:int类型的表达式需要未经检查的转换以符合'@Nonnull Integer'
class C
{
static void foo(int i)
{
bar(i); // Warning
}
static void bar(@javax.annotation.Nonnull Integer i)
{
}
}
Run Code Online (Sandbox Code Playgroud)
我该如何解决这个问题(不使用@SuppressWarnings("null")
)?似乎分析器不知道盒装基元不可能null
.
注意:我以 C# 为例,但在 Java 和许多其他语言中问题几乎相同。
假设您实现了一个值对象(如M. Fowler 的值对象模式)并且它有一些可为空的字段:
class MyValueObject
{
// Nullable field (with public access to keep the example short):
public string MyField;
}
Run Code Online (Sandbox Code Playgroud)
然后,当覆盖 Equals() 时,您如何处理两个值对象的 MyField 都设置为 null 的情况?它们是否相等?
在 C# 中,平等对待它们似乎很明显,因为:
这是当您使用 C# 结构而不是类并且不覆盖 Equals() 时 Equals() 的行为。
以下表达式为真:
null == null
object.ReferenceEquals(null, null)
object.Equals(null, null)
Run Code Online (Sandbox Code Playgroud)然而,在 SQL 中(至少在 SQL Server 的方言中),NULL = NULL
是假的,反之则NULL is NULL
是真的。
我想知道在使用 O/R 映射器(在我的例子中是 NHibernate)时需要什么样的实现。如果你实现了“自然”的 C# 相等语义,当 O/R 映射器将它们映射到数据库时会不会有任何不良影响?
或者也许允许值对象中的可为空字段无论如何都是错误的?
此问题可能是特定于Windows的.我还没有在Linux或Mac上测试它.
我用:
node my-cli.js > foo.txt
:错误 output is not a tty
node my-cli.js < foo.txt
:错误input is not a tty
.
c# ×2
nhibernate ×2
null ×2
checkstyle ×1
eclipse ×1
equals ×1
firefox ×1
git-bash ×1
html ×1
hyperlink ×1
java ×1
javadoc ×1
kotlin ×1
markdown ×1
mingw-w64 ×1
node.js ×1
non-nullable ×1
properties ×1
reflection ×1
stdin ×1
stdout ×1
types ×1