[Gradle 5.2.1] Wrong artifact reuse

I’m using Gradle 5.2.1 to custom a configuration but meet something wrong when fetching artifacts.
Here is a part of my maven module file

"variants": [
    {
      "name": "debugLink",
      "attributes": {
        "org.gradle.native.architecture": "armeabi-v7a",
        "org.gradle.native.debuggable": true,
        "org.gradle.native.linkage": "STATIC",
        "org.gradle.native.operatingSystem": "android",
        "org.gradle.native.optimized": false,
        "org.gradle.usage": "native-link"
      },
      "files": [
        {
          "name": "libstringutils.a",
          "url": "stringutils_debug-1.0-android_armeabi-v7a.a",
          "size": 29942,
          "sha1": "38d007f7e896f3da325dd24e66b13cddc53b255d",
          "md5": "167a21197cbc599982a7fc2971360b4b"
        }
      ]
    },
    {
      "name": "debugLink",
      "attributes": {
        "org.gradle.native.architecture": "arm64-v8a",
        "org.gradle.native.debuggable": true,
        "org.gradle.native.linkage": "STATIC",
        "org.gradle.native.operatingSystem": "android",
        "org.gradle.native.optimized": false,
        "org.gradle.usage": "native-link"
      },
      "files": [
        {
          "name": "libstringutils.a",
          "url": "stringutils_debug-1.0-android_arm64-v8a.a",
          "size": 32794,
          "sha1": "e0395f266e0dac5b53b133e35a7394c1991218d0",
          "md5": "e57f5bdc654da25b9ed86aaf11acc793"
        }
      ]
    },

I have two artifacts, there have different attributes and file SHA1.
But when I try to fetch the artifacts, I always get the same file for these two configurations.
From the source code and debug, I found the root cause is Gradle’s cached resolved artifacts.
Below is the Gradle source code(DefaultArtifactSet.class):

private static ResolvedVariant toResolvedVariant(VariantResolveMetadata variant, ModuleVersionIdentifier ownerId, ModuleSource moduleSource, ModuleExclusion exclusions, ArtifactResolver artifactResolver, Map<ComponentArtifactIdentifier, ResolvableArtifact> allResolvedArtifacts, ArtifactTypeRegistry artifactTypeRegistry) {
        List<? extends ComponentArtifactMetadata> artifacts = variant.getArtifacts();
        Builder<ResolvableArtifact> resolvedArtifacts = ImmutableSet.builder();
        ImmutableAttributes attributes = artifactTypeRegistry.mapAttributesFor(variant);
        Iterator var10 = artifacts.iterator();

        while(var10.hasNext()) {
            ComponentArtifactMetadata artifact = (ComponentArtifactMetadata)var10.next();
            IvyArtifactName artifactName = artifact.getName();
            if (!exclusions.excludeArtifact(ownerId.getModule(), artifactName)) {
                ResolvableArtifact resolvedArtifact = (ResolvableArtifact)allResolvedArtifacts.get(artifact.getId());
                if (resolvedArtifact == null) {
                    Factory<File> artifactSource = new DefaultArtifactSet.LazyArtifactSource(artifact, moduleSource, artifactResolver);
                    resolvedArtifact = new DefaultResolvedArtifact(ownerId, artifactName, artifact.getId(), artifact.getBuildDependencies(), artifactSource);
                    allResolvedArtifacts.put(artifact.getId(), resolvedArtifact);
                }

                resolvedArtifacts.add(resolvedArtifact);
            }
        }

        return ArtifactBackedResolvedVariant.create(variant.asDescribable(), attributes, resolvedArtifacts.build());
    }

Gradle just use the artifact.getId() to match the cache. But in my case, these two artifacts has same id, but different file SHA1 and classifier. So I always get the wrong file from the cache.
So, Are there any way to fix it?

This looks like a bug, discussion to be followed on the filed GitHub issue.