Skip to content

Commit

Permalink
suppress eclipse warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
ben-manes committed Sep 2, 2024
1 parent 2c3eb58 commit 967f17a
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import java.io.Serializable;
import java.lang.System.Logger;
import java.lang.System.Logger.Level;
import java.util.Map;
import java.util.concurrent.CancellationException;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CompletionException;
Expand Down Expand Up @@ -135,7 +134,7 @@ Object writeReplace() {
* {@code 0} to indicate that the entry should not be evicted due to a size constraint. If the
* value is computed successfully then the entry must be reinserted so that the weight is updated
* and the expiration timeouts reflect the value once present. This can be done safely using
* {@link Map#replace(Object, Object, Object)}.
* {@link java.util.Map#replace(Object, Object, Object)}.
*/
static final class AsyncWeigher<K, V> implements Weigher<K, CompletableFuture<V>>, Serializable {
private static final long serialVersionUID = 1L;
Expand Down
6 changes: 3 additions & 3 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ commons-text = "1.12.0"
concurrentlinkedhashmap = "1.4.2"
config = "1.4.3"
coveralls = "2.12.2"
dependency-check = "10.0.3"
dependency-check = "10.0.4"
eclipse-collections = "12.0.0.M3"
ehcache3 = "3.10.8"
errorprone = "2.31.0"
Expand Down Expand Up @@ -207,8 +207,8 @@ zstd = { module = "com.github.luben:zstd-jni", version.ref = "zstd" }
[bundles]
coherence = ["coherence", "json-bind"]
constraints = ["bcel", "bouncycastle-jdk18on", "commons-compress", "commons-text", "h2",
"httpclient", "guava", "jcommander", "jgit", "jsoup", "protobuf", "snakeyaml" ]
errorprone-support = [ "errorprone-support", "errorprone-support-refaster" ]
"httpclient", "guava", "jcommander", "jgit", "jsoup", "protobuf", "snakeyaml"]
errorprone-support = ["errorprone-support", "errorprone-support-refaster"]
junit = ["junit4", "junit5"]
junit-engines = ["junit5-vintage", "junit5-testng"]
osgi-test-compile = ["pax-exam-junit4"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ eclipse {
excludeInfoFiles(this)
}
}
setProjectEncoding()
addPreferences("org.eclipse.core.resources.prefs", mapOf(
"encoding/<project>" to "UTF-8"))
addPreferences("org.eclipse.jdt.core.prefs", mapOf(
"org.eclipse.jdt.core.compiler.problem.unusedWarningToken" to "ignore"))
}

/** Exclude module-info and package-info when compiling through Eclipse. */
Expand All @@ -26,14 +29,16 @@ fun excludeInfoFiles(classpath: Classpath) {
}
}

/** Specifies the content encoding for the Eclipse project. */
fun setProjectEncoding() {
val prefs = file(".settings/org.eclipse.core.resources.prefs")
if (!prefs.exists()) {
prefs.parentFile.mkdirs()
prefs.writeText("eclipse.preferences.version=1\n")
}
if ("encoding/<project>" !in prefs.readText()) {
prefs.appendText("encoding/<project>=UTF-8\n")
/** Adds preferences to the Eclipse project. */
fun addPreferences(path: String, preferences: Map<String, String>) {
val settings = file(".settings/$path")
if (!settings.exists()) {
settings.parentFile.mkdirs()
settings.writeText("eclipse.preferences.version=1\n")
}
val text = settings.readLines()
.filter { line -> line.substringBefore('=') !in preferences }
.plus(preferences.map { (key, value) -> "$key=$value" })
.joinToString(separator = "\n", postfix = "\n")
settings.writeText(text)
}

0 comments on commit 967f17a

Please sign in to comment.