为什么声纳需要二进制文件 (sonar.binaries) [英] Why sonar requires binary files (sonar.binaries)
问题描述
为什么声纳需要二进制文件(sonar.binaries)?它如何使用二进制文件来完成它对二进制文件所做的事情?
Why sonar requires binary files (sonar.binaries)? How it uses binaries to do what ever it does with the binaries?
推荐答案
sonar.binaries
是一个已弃用的属性:您现在应该使用 sonar.java.binaries
sonar.binaries
is a deprecated property : you should now use sonar.java.binaries
此属性由 java 分析使用(所以我假设您正在分析 java 代码).
This property is used by the java analysis (so I'm assuming you are analyzing java code).
分析是在源代码级别逐个文件完成的,为了正确进行语义分析,java 分析器从 .class
文件中读取外部依赖项的信息.
The analysis is done file by file at source level, and in order to properly do a semantic analysis the java analyzer reads information of external dependencies from the .class
files.
具体来说,它是这样工作的:在分析 A.java
时声明:
Concretely this is how it works : While analyzing A.java
which declares :
class A {
B b;
}
java分析器会构建A类的语义模型,对于外部依赖,查找B.class
的字节码,完成其语义分析.
The java analyzer will construct semantic model of class A and for external dependencies look into bytecode for B.class
to complete its semantic analysis.
为什么要这样做?为了解决表达式的类型有一个更准确的分析.(即:回答问题:b.foo() 的类型是什么:我们需要找出 foo() 方法的定义).
Why is it doing that ? in order to solve type of expressions to have a more accurate analysis. (ie: answering the question : What is the type of b.foo(): we need to find out the definition of foo() method).
这是一个刻意选择的实现方式,它依赖于每个外部依赖项的字节码,即使我们有它们的源代码.
This is a deliberate choice of implementation to rely on bytecode for every external dependencies, even if we have the source for them.
这篇关于为什么声纳需要二进制文件 (sonar.binaries)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!