Some fixes for compilation under java 18 (#4397)

This commit is contained in:
Anuraag Agrawal 2022-04-22 07:43:55 +09:00 committed by GitHub
parent 783237805f
commit e999fa0d5a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 20 additions and 37 deletions

View File

@ -216,10 +216,10 @@ final class StrictContextStorage implements ContextStorage, AutoCloseable {
}
}
// Don't care about serialization of this private class.
@SuppressWarnings("serial")
static class CallerStackTrace extends Throwable {
private static final long serialVersionUID = 783294061323215387L;
final String threadName = currentThread().getName();
final long threadId = currentThread().getId();
final Context context;

View File

@ -15,3 +15,12 @@ dependencies {
compileOnly("io.grpc:grpc-protobuf")
compileOnly("io.grpc:grpc-stub")
}
tasks {
compileJava {
with(options) {
// Generated code so can't control serialization.
compilerArgs.add("-Xlint:-serial")
}
}
}

View File

@ -68,3 +68,12 @@ sourceSets {
java.srcDir("$buildDir/generated/source/wire")
}
}
tasks {
compileJava {
with(options) {
// Generated code so can't control serialization.
compilerArgs.add("-Xlint:-serial")
}
}
}

View File

@ -1,35 +0,0 @@
/*
* Copyright The OpenTelemetry Authors
* SPDX-License-Identifier: Apache-2.0
*/
package io.opentelemetry.sdk.metrics.internal.state;
import io.opentelemetry.sdk.metrics.internal.descriptor.MetricDescriptor;
/**
* There are multiple metrics defined with the same name/identity.
*
* <p>This class is internal and is hence not for public use. Its APIs are unstable and can change
* at any time.
*/
class DuplicateMetricStorageException extends IllegalArgumentException {
private static final long serialVersionUID = 1547329629200005982L;
private final MetricDescriptor existing;
private final MetricDescriptor conflict;
DuplicateMetricStorageException(
MetricDescriptor existing, MetricDescriptor next, String message) {
super(message + " Found previous metric: " + existing + ", cannot register metric: " + next);
this.existing = existing;
this.conflict = next;
}
public MetricDescriptor getExisting() {
return existing;
}
public MetricDescriptor getConflict() {
return conflict;
}
}