GoogleCloudPlatform / GoogleCloudPlatform/cloud-opensource-java

Static Linkage Checker

未关闭
#110 4 条评论 0 个 reaction 已指派 1 人 已被 @suztomo 认领 在 GitHub 查看
enhancement
主要语言
Java
星标
163
派生
80
PR 合并指标
30 天内没有已合并 PR

描述

We need a tool that can verify that a single artifact is linkage compatible. This should verify that all static references in a given classpath are valid. This is a necessary tool to verify that we're actually meeting the objective of not surfacing conflicts to users. (Verifying version agreement is not sufficient.)

The tool takes the Maven coordinates?/pom.xml file? as input. It resolves the dependency tree according to the usual Maven dependency mediation algorithm. Thus all artifacts are assigned specific versions. This is the runtime classpath. Then it checks this for linkage conflicts.

Linkage conflict: The signature of a non-private method or class in a dependency has changed in an incompatible way between the version supplied at compile time and the version invoked at runtime. For example, a public method may be removed from a class or a class may be made final. Linkage conflicts detected at runtime manifest as ReflectiveOperationException, NoClassDefFoundError, NoSuchFieldException, MethodNotFoundException, LinkageError, or other related exceptions.
Or, another perspective: In cases where binary compatibility and source compatibility are the same, a linkage conflict is when compilation would fail if the libraries in the classpath were all built together from their originating source code, or when reflection would fail.
Opposite: Linkage-compatible.
Sub-type: Static linkage conflict: A linkage conflict caused by a direct code reference (non-reflective).
Sub-type: Reflective linkage conflict: A linkage conflict caused by a reflective reference.

It runs through the classpath, finds every statically referenced class, interface, method, and field and verifies the signatures match up. E.g. no signature has changed or been removed in an incompatible way in the specific version found in the classpath.

We are not considering access via reflection.

Implementation: maven plugin? main() method? dashboard report? all of this?

Start with a one page design doc?

How does this differ from simple compilation checking?
Are these errors common in practice?

@garrettjonesgoogle Can you flesh this issue out a bit?

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。