Skip to content

Commit 2c873b5

Browse files
committed
Disable potential resource leak warnings in Java
The Gson library that LSP4J is heavily dependent on uses the errorprone annotations. If Eclipse supported warning suppression based on the errorprone annotations, the dozens of potential resource leak warnings in the LSP4J code would be automatically suppressed. This happens because Gson classes such as JsonWriter returns `this` in many of its methods, and since JsonWriter is a Closeable, the JDT warns about it. See for example JsonWrite.nullValue. Gson annotates this method as CanIgnoreReturnValue, meaning no potential resource leak. If JDT gets support for error prone annotations, this warning can be re-enabled.
1 parent 52060cb commit 2c873b5

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ subprojects {
132132
properties['org.eclipse.jdt.core.compiler.problem.pessimisticNullAnalysisForFreeTypeVariables']='warning'
133133
properties['org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment']='warning'
134134
properties['org.eclipse.jdt.core.compiler.problem.potentialNullReference']='warning'
135-
properties['org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable']='warning'
135+
properties['org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable']='ignore'
136136
properties['org.eclipse.jdt.core.compiler.problem.rawTypeReference']='warning'
137137
properties['org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation']='warning'
138138
properties['org.eclipse.jdt.core.compiler.problem.redundantNullCheck']='warning'

0 commit comments

Comments
 (0)