Skip to content

Linkage Checker Messages

Tomo Suzuki edited this page Jun 19, 2020 · 17 revisions

This page explains the meaning of the messages generated by Linkage Checker.

For the usage of Linkage Checker, read Linkage Checker Enforcer Rule Tutorial.

Class XXX is not found

This message means that the class XXX is not found in the class path while other classes have references to the class.

Example message:

Class com.jcraft.jzlib.JZlib is not found;
  referenced by 4 class files
    io.grpc.netty.shaded.io.netty.handler.codec.spdy.SpdyHeaderBlockJZlibEncoder (io.grpc:grpc-netty-shaded:1.28.1)
    io.grpc.netty.shaded.io.netty.handler.codec.compression.JZlibEncoder (io.grpc:grpc-netty-shaded:1.28.1)
    io.grpc.netty.shaded.io.netty.handler.codec.compression.ZlibUtil (io.grpc:grpc-netty-shaded:1.28.1)
    io.grpc.netty.shaded.io.netty.handler.codec.compression.JZlibDecoder (io.grpc:grpc-netty-shaded:1.28.1)

The diagram below illustrates the invalid references marked as red.

Screen Shot 2020-06-18 at 11 14 30

At runtime, the invalid references may cause NoClassDefFoundError. The Java Diamond Dependency conflict, insufficient dependency declaration in POM files, and shading of dependencies into one JAR file are the primary causes of such invalid references to missing classes.

If you want to suppress the error, use Linkage Checker Exclusion File to specify the references:

<LinkageCheckerFilter>
  <LinkageError>
    <Target>
      <Class name="com.jcraft.jzlib.JZlib" />
    </Target>
    <Source>
      <Class name="io.grpc.netty.shaded.io.netty.handler.codec.spdy.SpdyHeaderBlockJZlibEncoder" />
    </Source>
  </LinkageError>
  <LinkageError>
    <Target>
      <Class name="com.jcraft.jzlib.JZlib" />
    </Target>
    <Source>
      <Class name="io.grpc.netty.shaded.io.netty.handler.codec.compression.JZlibEncoder" />
    </Source>
  </LinkageError>
  <LinkageError>
    <Target>
      <Class name="com.jcraft.jzlib.JZlib" />
    </Target>
    <Source>
      <Class name="io.grpc.netty.shaded.io.netty.handler.codec.compression.ZlibUtil" />
    </Source>
  </LinkageError>
  <LinkageError>
    <Target>
      <Class name="com.jcraft.jzlib.JZlib" />
    </Target>
    <Source>
      <Class name="io.grpc.netty.shaded.io.netty.handler.codec.compression.JZlibDecoder" />
    </Source>
  </LinkageError>
</LinkageCheckerFilter>

(<artifact>) XXX's field YYY is not found

This message means that the class XXX in <artifact> does not have the field YYY , while some classes have references to the field.

Example message:

(io.grpc:grpc-core:1.29.0) io.grpc.internal.GrpcAttributes's field ATTR_LB_ADDRS is not found;
  referenced by 1 class file
    io.grpc.grpclb.GrpclbConstants (io.grpc:grpc-grpclb:1.28.1)

The diagram below illustrates the invalid references from the io.grpc.grpclb.GrpclbConstants to the missing field.

Screen Shot 2020-06-18 at 11 22 07

At runtime, the invalid references may cause NoSuchFieldError. The Java Diamond Dependency conflict is the primary cause of such invalid references to missing fields.

If you want to suppress the error, use Linkage Checker Exclusion File to specify the references:

<LinkageCheckerFilter>
  <LinkageError>
    <Target>
      <Field className="io.grpc.internal.GrpcAttributes" name="ATTR_LB_ADDRS" />
    </Target>
    <Source>
      <Class name="io.grpc.grpclb.GrpclbConstants" />
    </Source>
  </LinkageError>
</LinkageCheckerFilter>

(<artifact>) XXX's method YYY is not found

This error is the same as the previous section of the missing fields but for missing methods.

At runtime, the invalid references may cause NoSuchMethodError.