From d4b1f26cc1e34328d859a0a3e083c32e4d0d6bf9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Kubitz?= Date: Thu, 9 Nov 2023 13:25:22 +0100 Subject: [PATCH] fix some ecj markers Especially after moving files to compiler.batch - which has no resource warnings - the @SuppressWarnings("resource") is not used - leading to a marker --- JCL/converterJclMin9/src/java/lang/invoke/MethodHandle.java | 1 - .../src/java/lang/invoke/MethodHandles.java | 1 - .../src/org/eclipse/jdt/apt/tests/MixedModeTesting.java | 1 - .../apt/dispatch/BatchAnnotationProcessorManager.java | 2 +- .../compiler/apt/dispatch/HookedJavaFileObject.java | 4 ++-- .../jdt/internal/compiler/tool/EclipseFileManager.java | 6 +++--- .../src/org/eclipse/jdt/core/tests/dom/ASTMatcherTest.java | 2 ++ 7 files changed, 8 insertions(+), 9 deletions(-) diff --git a/JCL/converterJclMin9/src/java/lang/invoke/MethodHandle.java b/JCL/converterJclMin9/src/java/lang/invoke/MethodHandle.java index 69736475bd0..8a1fdd030e9 100644 --- a/JCL/converterJclMin9/src/java/lang/invoke/MethodHandle.java +++ b/JCL/converterJclMin9/src/java/lang/invoke/MethodHandle.java @@ -16,7 +16,6 @@ import java.lang.annotation.Retention; import java.lang.annotation.Target; -import java.lang.invoke.MethodType; public abstract class MethodHandle { @Target(METHOD) diff --git a/JCL/converterJclMin9/src/java/lang/invoke/MethodHandles.java b/JCL/converterJclMin9/src/java/lang/invoke/MethodHandles.java index 582995d9d86..f40dc8200bc 100644 --- a/JCL/converterJclMin9/src/java/lang/invoke/MethodHandles.java +++ b/JCL/converterJclMin9/src/java/lang/invoke/MethodHandles.java @@ -1,5 +1,4 @@ package java.lang.invoke; -import java.lang.invoke.MethodType; public class MethodHandles { public static final class Lookup { diff --git a/org.eclipse.jdt.apt.tests/src/org/eclipse/jdt/apt/tests/MixedModeTesting.java b/org.eclipse.jdt.apt.tests/src/org/eclipse/jdt/apt/tests/MixedModeTesting.java index c645e0f99f5..6bd37431239 100644 --- a/org.eclipse.jdt.apt.tests/src/org/eclipse/jdt/apt/tests/MixedModeTesting.java +++ b/org.eclipse.jdt.apt.tests/src/org/eclipse/jdt/apt/tests/MixedModeTesting.java @@ -19,7 +19,6 @@ import junit.framework.TestSuite; import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IPath; import org.eclipse.jdt.apt.core.internal.util.FactoryContainer; import org.eclipse.jdt.apt.core.internal.util.FactoryPath; diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/apt/dispatch/BatchAnnotationProcessorManager.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/apt/dispatch/BatchAnnotationProcessorManager.java index e5e904fe8eb..b020ff16133 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/apt/dispatch/BatchAnnotationProcessorManager.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/apt/dispatch/BatchAnnotationProcessorManager.java @@ -77,7 +77,7 @@ public void configure(Object batchCompiler, String[] commandLineArguments) { } BatchProcessingEnvImpl processingEnv = new BatchProcessingEnvImpl(this, (Main) batchCompiler, commandLineArguments); this._processingEnv = processingEnv; - @SuppressWarnings("resource") // fileManager is not opened here + // @SuppressWarnings("resource") // fileManager is not opened here JavaFileManager fileManager = processingEnv.getFileManager(); if (fileManager instanceof StandardJavaFileManager) { Iterable location = null; diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/apt/dispatch/HookedJavaFileObject.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/apt/dispatch/HookedJavaFileObject.java index 7776c12a893..1dbec234bd6 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/apt/dispatch/HookedJavaFileObject.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/apt/dispatch/HookedJavaFileObject.java @@ -209,13 +209,13 @@ public HookedJavaFileObject(JavaFileObject fileObject, String fileName, String t this._typeName = typeName; } - @SuppressWarnings("resource") // ForwardingOutputStream forwards close() too + // @SuppressWarnings("resource") // ForwardingOutputStream forwards close() too @Override public OutputStream openOutputStream() throws IOException { return new ForwardingOutputStream(super.openOutputStream()); } - @SuppressWarnings("resource") // ForwardingWriter forwards close() too + // @SuppressWarnings("resource") // ForwardingWriter forwards close() too @Override public Writer openWriter() throws IOException { return new ForwardingWriter(super.openWriter()); diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/tool/EclipseFileManager.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/tool/EclipseFileManager.java index 317480ea22c..5cc961102b9 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/tool/EclipseFileManager.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/tool/EclipseFileManager.java @@ -163,7 +163,7 @@ private void collectAllMatchingFiles(Location location, File file, String normal } } } else if (isArchive(file)) { - @SuppressWarnings("resource") // cached archive is closed in EclipseFileManager.close() + // @SuppressWarnings("resource") // cached archive is closed in EclipseFileManager.close() Archive archive = this.getArchive(file); if (archive != Archive.UNKNOWN_ARCHIVE) { String key = normalizedPackageName; @@ -442,7 +442,7 @@ public FileObject getFileForInput(Location location, String packageName, String return null; } - @SuppressWarnings("resource") // cached archive is closed in EclipseFileManager.close() + // @SuppressWarnings("resource") // cached archive is closed in EclipseFileManager.close() private ArchiveFileObject getFileObject(File archiveFile, String normalizedFileName) { Archive archive = getArchive(archiveFile); if (archive == Archive.UNKNOWN_ARCHIVE) { @@ -454,7 +454,7 @@ private ArchiveFileObject getFileObject(File archiveFile, String normalizedFileN return null; } - @SuppressWarnings("resource") // cached archive is closed in EclipseFileManager.close() + // @SuppressWarnings("resource") // cached archive is closed in EclipseFileManager.close() private Boolean containsFileObject(File archiveFile, String normalizedFileName) { Archive archive = getArchive(archiveFile); if (archive == Archive.UNKNOWN_ARCHIVE) { diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTMatcherTest.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTMatcherTest.java index 72790bb0dba..d11379d4ad2 100644 --- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTMatcherTest.java +++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTMatcherTest.java @@ -1152,6 +1152,8 @@ public void testParenthesizedExpression() { ParenthesizedExpression x1 = this.ast.newParenthesizedExpression(); basicMatch(x1); } + + @SuppressWarnings("deprecation") public void testPatternInstanceofExpression() { if (this.ast.apiLevel() < AST.JLS17) { return;