From f6b20c53787e55895c45abf6af3d1f2dd2704204 Mon Sep 17 00:00:00 2001 From: Ville Oikarinen Date: Wed, 14 Feb 2024 12:39:26 +0200 Subject: [PATCH] new ecj warning enabled --- .../java/org/fluentjava/iwant/api/javamodules/CodeStyle.java | 2 ++ .../org/fluentjava/iwant/api/javamodules/CodeStylePolicy.java | 2 ++ .../iwant/eclipsesettings/OrgEclipseJdtCorePrefs.java | 2 ++ .../iwant/eclipsesettings/OrgEclipseJdtCorePrefsTest.java | 2 ++ 4 files changed, 8 insertions(+) diff --git a/essential/iwant-api-javamodules/src/main/java/org/fluentjava/iwant/api/javamodules/CodeStyle.java b/essential/iwant-api-javamodules/src/main/java/org/fluentjava/iwant/api/javamodules/CodeStyle.java index 113332bd..dc91532d 100644 --- a/essential/iwant-api-javamodules/src/main/java/org/fluentjava/iwant/api/javamodules/CodeStyle.java +++ b/essential/iwant-api-javamodules/src/main/java/org/fluentjava/iwant/api/javamodules/CodeStyle.java @@ -24,6 +24,8 @@ public enum CodeStyle { ENUM_IDENTIFIER, + EXPLICITLY_CLOSED_AUTO_CLOSEABLE, + FALLTHROUGH_CASE, FATAL_OPTIONAL_ERROR, diff --git a/essential/iwant-api-javamodules/src/main/java/org/fluentjava/iwant/api/javamodules/CodeStylePolicy.java b/essential/iwant-api-javamodules/src/main/java/org/fluentjava/iwant/api/javamodules/CodeStylePolicy.java index 28b0ba9d..0e19aa5a 100644 --- a/essential/iwant-api-javamodules/src/main/java/org/fluentjava/iwant/api/javamodules/CodeStylePolicy.java +++ b/essential/iwant-api-javamodules/src/main/java/org/fluentjava/iwant/api/javamodules/CodeStylePolicy.java @@ -11,6 +11,7 @@ import static org.fluentjava.iwant.api.javamodules.CodeStyle.DISCOURAGED_REFERENCE; import static org.fluentjava.iwant.api.javamodules.CodeStyle.EMPTY_STATEMENT; import static org.fluentjava.iwant.api.javamodules.CodeStyle.ENUM_IDENTIFIER; +import static org.fluentjava.iwant.api.javamodules.CodeStyle.EXPLICITLY_CLOSED_AUTO_CLOSEABLE; import static org.fluentjava.iwant.api.javamodules.CodeStyle.FALLTHROUGH_CASE; import static org.fluentjava.iwant.api.javamodules.CodeStyle.FATAL_OPTIONAL_ERROR; import static org.fluentjava.iwant.api.javamodules.CodeStyle.FIELD_HIDING; @@ -103,6 +104,7 @@ public static CodeStylePolicySpex defaultsExcept() { d.warn(DISCOURAGED_REFERENCE); d.warn(EMPTY_STATEMENT); d.fail(ENUM_IDENTIFIER); + d.warn(EXPLICITLY_CLOSED_AUTO_CLOSEABLE); d.warn(FALLTHROUGH_CASE); d.ignore(FATAL_OPTIONAL_ERROR); d.warn(FIELD_HIDING); diff --git a/essential/iwant-eclipse-settings/src/main/java/org/fluentjava/iwant/eclipsesettings/OrgEclipseJdtCorePrefs.java b/essential/iwant-eclipse-settings/src/main/java/org/fluentjava/iwant/eclipsesettings/OrgEclipseJdtCorePrefs.java index 685d45db..bfa8c1e9 100644 --- a/essential/iwant-eclipse-settings/src/main/java/org/fluentjava/iwant/eclipsesettings/OrgEclipseJdtCorePrefs.java +++ b/essential/iwant-eclipse-settings/src/main/java/org/fluentjava/iwant/eclipsesettings/OrgEclipseJdtCorePrefs.java @@ -48,6 +48,8 @@ private static String asPropertyLine(CodeStyle style, return ignoreable("emptyStatement", value); case ENUM_IDENTIFIER: return ignoreable("enumIdentifier", value); + case EXPLICITLY_CLOSED_AUTO_CLOSEABLE: + return ignoreable("explicitlyClosedAutoCloseable", value); case FALLTHROUGH_CASE: return ignoreable("fallthroughCase", value); case FATAL_OPTIONAL_ERROR: diff --git a/essential/iwant-eclipse-settings/src/test/java/org/fluentjava/iwant/eclipsesettings/OrgEclipseJdtCorePrefsTest.java b/essential/iwant-eclipse-settings/src/test/java/org/fluentjava/iwant/eclipsesettings/OrgEclipseJdtCorePrefsTest.java index 85c395e0..e836edbb 100644 --- a/essential/iwant-eclipse-settings/src/test/java/org/fluentjava/iwant/eclipsesettings/OrgEclipseJdtCorePrefsTest.java +++ b/essential/iwant-eclipse-settings/src/test/java/org/fluentjava/iwant/eclipsesettings/OrgEclipseJdtCorePrefsTest.java @@ -117,6 +117,8 @@ public void testDefaultsAsFileContent() { "org.eclipse.jdt.core.compiler.problem.emptyStatement=warning\n"); b.append( "org.eclipse.jdt.core.compiler.problem.enumIdentifier=error\n"); + b.append( + "org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=warning\n"); b.append( "org.eclipse.jdt.core.compiler.problem.fallthroughCase=warning\n"); b.append(