Search in sources :

Example 1 with Java9ClassReader

use of org.gradle.util.internal.Java9ClassReader in project gradle by gradle.

the class AbiExtractingClasspathContentHasher method hashClassBytes.

private void hashClassBytes(InputStream inputStream, Hasher hasher) throws IOException {
    // Use the ABI as the hash
    byte[] classBytes = ByteStreams.toByteArray(inputStream);
    ApiClassExtractor extractor = new ApiClassExtractor(Collections.<String>emptySet());
    Java9ClassReader reader = new Java9ClassReader(classBytes);
    if (extractor.shouldExtractApiClassFrom(reader)) {
        byte[] signature = extractor.extractApiClassFrom(reader);
        if (signature != null) {
            hasher.putBytes(signature);
        }
    }
}
Also used : Java9ClassReader(org.gradle.util.internal.Java9ClassReader) ApiClassExtractor(org.gradle.api.internal.tasks.compile.ApiClassExtractor)

Aggregations

ApiClassExtractor (org.gradle.api.internal.tasks.compile.ApiClassExtractor)1 Java9ClassReader (org.gradle.util.internal.Java9ClassReader)1