From dc6e3152bd35e2bfe5baaf4e47041f57c67b79e8 Mon Sep 17 00:00:00 2001 From: Jon Bratseth Date: Mon, 30 Sep 2024 13:54:18 +0200 Subject: [PATCH] Less warnings --- .../config/codegen/JavaClassBuilder.java | 20 +++++++++---------- .../src/test/resources/allfeatures.reference | 6 ++---- .../com/yahoo/jdisc/AbstractResource.java | 1 + .../main/java/com/yahoo/jdisc/Request.java | 2 ++ .../com/yahoo/jdisc/core/ActiveContainer.java | 1 + .../yahoo/jdisc/core/ApplicationLoader.java | 1 + .../yahoo/jdisc/handler/RequestDispatch.java | 2 ++ .../refcount/DebugReferencesWithStack.java | 1 + .../yahoo/jdisc/core/ExportPackagesIT.java | 1 - jrt/src/com/yahoo/jrt/Connection.java | 4 ++-- jrt/src/com/yahoo/jrt/Supervisor.java | 1 + .../concurrent/maintenance/Maintainer.java | 1 + .../java/com/yahoo/io/AbstractByteWriter.java | 1 + 13 files changed, 24 insertions(+), 18 deletions(-) diff --git a/configgen/src/main/java/com/yahoo/config/codegen/JavaClassBuilder.java b/configgen/src/main/java/com/yahoo/config/codegen/JavaClassBuilder.java index 1c0047871ded..4a6def38bf5b 100644 --- a/configgen/src/main/java/com/yahoo/config/codegen/JavaClassBuilder.java +++ b/configgen/src/main/java/com/yahoo/config/codegen/JavaClassBuilder.java @@ -61,17 +61,15 @@ public String getConfigClass(String className) { } private String getHeader() { - return "/**\n" + // - " * This file is generated from a config definition file.\n" + // - " * ------------ D O N O T E D I T ! ------------\n" + // - " */\n" + // - "\n" + // - "package " + javaPackage + ";\n" + // - "\n" + // - "import java.util.*;\n" + // - "import java.io.File;\n" + // - "import java.nio.file.Path;\n" + // - "import com.yahoo.config.*;"; + return "// ------------ D O N O T E D I T ! ------------\n" + // + "// This file is generated from a config definition file.\n" + // + "\n" + // + "package " + javaPackage + ";\n" + // + "\n" + // + "import java.util.*;\n" + // + "import java.io.File;\n" + // + "import java.nio.file.Path;\n" + // + "import com.yahoo.config.*;"; } // TODO: remove the extra comment line " *" if root.getCommentBlock is empty diff --git a/configgen/src/test/resources/allfeatures.reference b/configgen/src/test/resources/allfeatures.reference index d068853b167a..2f03a45e6593 100644 --- a/configgen/src/test/resources/allfeatures.reference +++ b/configgen/src/test/resources/allfeatures.reference @@ -1,7 +1,5 @@ -/** - * This file is generated from a config definition file. - * ------------ D O N O T E D I T ! ------------ - */ +// ------------ D O N O T E D I T ! ------------ +// This file is generated from a config definition file. package com.yahoo.configgen; diff --git a/jdisc_core/src/main/java/com/yahoo/jdisc/AbstractResource.java b/jdisc_core/src/main/java/com/yahoo/jdisc/AbstractResource.java index fa7acea47aaa..461c4e668622 100644 --- a/jdisc_core/src/main/java/com/yahoo/jdisc/AbstractResource.java +++ b/jdisc_core/src/main/java/com/yahoo/jdisc/AbstractResource.java @@ -22,6 +22,7 @@ public abstract class AbstractResource implements SharedResource { private final References references; + @SuppressWarnings("this-escape") protected AbstractResource() { DestructableResource destructable = new WrappedResource(this); if (debug == Debug.STACK) { diff --git a/jdisc_core/src/main/java/com/yahoo/jdisc/Request.java b/jdisc_core/src/main/java/com/yahoo/jdisc/Request.java index 91741fc7d4d6..2aeb78f1bed7 100644 --- a/jdisc_core/src/main/java/com/yahoo/jdisc/Request.java +++ b/jdisc_core/src/main/java/com/yahoo/jdisc/Request.java @@ -87,6 +87,7 @@ public Request(CurrentContainer current, URI uri, boolean isServerRequest) { this(current, uri, isServerRequest, -1); } + @SuppressWarnings("this-escape") public Request(CurrentContainer current, URI uri, boolean isServerRequest, long creationTime) { this.parent = null; this.container = current.newReference(uri, this); @@ -121,6 +122,7 @@ public Request(CurrentContainer current, URI uri, boolean isServerRequest, long * @param parent The parent Request of this. * @param uri The identifier of this request. */ + @SuppressWarnings("this-escape") public Request(Request parent, URI uri) { this.parent = parent; this.container = null; diff --git a/jdisc_core/src/main/java/com/yahoo/jdisc/core/ActiveContainer.java b/jdisc_core/src/main/java/com/yahoo/jdisc/core/ActiveContainer.java index d3abfa77fcac..0c7d1c9667ae 100644 --- a/jdisc_core/src/main/java/com/yahoo/jdisc/core/ActiveContainer.java +++ b/jdisc_core/src/main/java/com/yahoo/jdisc/core/ActiveContainer.java @@ -33,6 +33,7 @@ public class ActiveContainer extends AbstractResource implements CurrentContaine private final BindingSetSelector bindingSetSelector; private final TimeoutManagerImpl timeoutMgr; + @SuppressWarnings("this-escape") public ActiveContainer(ContainerBuilder builder) { serverProviders = builder.serverProviders().activate(); serverProviders.forEach(resourceReferences::retain); diff --git a/jdisc_core/src/main/java/com/yahoo/jdisc/core/ApplicationLoader.java b/jdisc_core/src/main/java/com/yahoo/jdisc/core/ApplicationLoader.java index d6618d50bc39..6b8fced8aed8 100644 --- a/jdisc_core/src/main/java/com/yahoo/jdisc/core/ApplicationLoader.java +++ b/jdisc_core/src/main/java/com/yahoo/jdisc/core/ApplicationLoader.java @@ -46,6 +46,7 @@ public class ApplicationLoader implements BootstrapLoader, ContainerActivator, C private Application application; private ApplicationInUseTracker applicationInUseTracker; + @SuppressWarnings("this-escape") public ApplicationLoader(OsgiFramework osgiFramework, Iterable guiceModules) { LogSetup.initVespaLogging("Container"); this.osgiFramework = osgiFramework; diff --git a/jdisc_core/src/main/java/com/yahoo/jdisc/handler/RequestDispatch.java b/jdisc_core/src/main/java/com/yahoo/jdisc/handler/RequestDispatch.java index c39a70c70934..5e985d636ab1 100644 --- a/jdisc_core/src/main/java/com/yahoo/jdisc/handler/RequestDispatch.java +++ b/jdisc_core/src/main/java/com/yahoo/jdisc/handler/RequestDispatch.java @@ -50,6 +50,8 @@ public abstract class RequestDispatch implements Future, ResponseHandler { private final FutureConjunction completions = new FutureConjunction(); + + @SuppressWarnings("this-escape") private final FutureResponse futureResponse = new FutureResponse(this); /** diff --git a/jdisc_core/src/main/java/com/yahoo/jdisc/refcount/DebugReferencesWithStack.java b/jdisc_core/src/main/java/com/yahoo/jdisc/refcount/DebugReferencesWithStack.java index 0dd3df3cf131..1ae871ca851e 100644 --- a/jdisc_core/src/main/java/com/yahoo/jdisc/refcount/DebugReferencesWithStack.java +++ b/jdisc_core/src/main/java/com/yahoo/jdisc/refcount/DebugReferencesWithStack.java @@ -23,6 +23,7 @@ public class DebugReferencesWithStack implements References { private final DestructableResource resource; private final DebugResourceReference initialreference; + @SuppressWarnings("this-escape") public DebugReferencesWithStack(DestructableResource resource) { final Throwable referenceStack = new Throwable(); this.activeReferences.put(referenceStack, this); diff --git a/jdisc_core/src/test/java/com/yahoo/jdisc/core/ExportPackagesIT.java b/jdisc_core/src/test/java/com/yahoo/jdisc/core/ExportPackagesIT.java index b44c9ce4d79b..20c444e04d04 100644 --- a/jdisc_core/src/test/java/com/yahoo/jdisc/core/ExportPackagesIT.java +++ b/jdisc_core/src/test/java/com/yahoo/jdisc/core/ExportPackagesIT.java @@ -29,7 +29,6 @@ */ public class ExportPackagesIT { - private static final File expectedExportPackages = new File("src/test/resources" + ExportPackages.PROPERTIES_FILE); private static final String JAR_PATH = "target/dependency/"; diff --git a/jrt/src/com/yahoo/jrt/Connection.java b/jrt/src/com/yahoo/jrt/Connection.java index db9dc629aeba..c757a3240c1e 100644 --- a/jrt/src/com/yahoo/jrt/Connection.java +++ b/jrt/src/com/yahoo/jrt/Connection.java @@ -425,9 +425,9 @@ public boolean completeRequest(TieBreaker done) { return true; } - /////////////////////////////////////////////////////////////////////////// + // ------------------------------------------------------------------------- // Methods defined in the Target superclass - /////////////////////////////////////////////////////////////////////////// + // ------------------------------------------------------------------------- public boolean isValid() { return (state != CLOSED); diff --git a/jrt/src/com/yahoo/jrt/Supervisor.java b/jrt/src/com/yahoo/jrt/Supervisor.java index 5ae6afc90cb3..c8e13042553c 100644 --- a/jrt/src/com/yahoo/jrt/Supervisor.java +++ b/jrt/src/com/yahoo/jrt/Supervisor.java @@ -27,6 +27,7 @@ public class Supervisor { * * @param transport object performing low-level operations for this Supervisor */ + @SuppressWarnings("this-escape") public Supervisor(Transport transport) { this.transport = transport; new MandatoryMethods(this); diff --git a/vespajlib/src/main/java/com/yahoo/concurrent/maintenance/Maintainer.java b/vespajlib/src/main/java/com/yahoo/concurrent/maintenance/Maintainer.java index 8dbca0bfccde..37b8f45fa5df 100644 --- a/vespajlib/src/main/java/com/yahoo/concurrent/maintenance/Maintainer.java +++ b/vespajlib/src/main/java/com/yahoo/concurrent/maintenance/Maintainer.java @@ -40,6 +40,7 @@ public abstract class Maintainer implements Runnable { private final double successFactorBaseline; private final boolean acquireLock; + @SuppressWarnings("this-escape") public Maintainer(String name, Duration interval, Clock clock, JobControl jobControl, JobMetrics jobMetrics, List clusterHostnames, boolean ignoreCollision, double successFactorBaseline, boolean acquireLock) { diff --git a/vespajlib/src/main/java/com/yahoo/io/AbstractByteWriter.java b/vespajlib/src/main/java/com/yahoo/io/AbstractByteWriter.java index 2efb008c089f..3b9ab92f54df 100644 --- a/vespajlib/src/main/java/com/yahoo/io/AbstractByteWriter.java +++ b/vespajlib/src/main/java/com/yahoo/io/AbstractByteWriter.java @@ -22,6 +22,7 @@ public abstract class AbstractByteWriter extends GenericWriter implements Writab protected final BufferChain buffer; protected final CharBuffer charBuffer = CharBuffer.allocate(2); + @SuppressWarnings("this-escape") protected AbstractByteWriter(final CharsetEncoder encoder) { this.encoder = encoder; buffer = new BufferChain(this);