Skip to content

Commit

Permalink
Revert "Set o.e.j.c.compiler.problem.nullUncheckedConversion to ignor…
Browse files Browse the repository at this point in the history
…e by default"

This reverts commit 6d8eb7a.
  • Loading branch information
agriffis committed Jul 27, 2024
1 parent dd982b6 commit bbc4cfc
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2546,7 +2546,6 @@ private Map<String, String> generateProjectNullAnalysisOptions(String nonnullTyp
options.put(JavaCore.COMPILER_PB_NULL_SPECIFICATION_VIOLATION, defaultOptions.get(JavaCore.COMPILER_PB_NULL_SPECIFICATION_VIOLATION));
options.put(JavaCore.COMPILER_PB_NULL_ANNOTATION_INFERENCE_CONFLICT, defaultOptions.get(JavaCore.COMPILER_PB_NULL_ANNOTATION_INFERENCE_CONFLICT));
options.put(JavaCore.COMPILER_PB_SYNTACTIC_NULL_ANALYSIS_FOR_FIELDS, defaultOptions.get(JavaCore.COMPILER_PB_SYNTACTIC_NULL_ANALYSIS_FOR_FIELDS));
options.put(JavaCore.COMPILER_PB_NULL_UNCHECKED_CONVERSION, defaultOptions.get(JavaCore.COMPILER_PB_NULL_UNCHECKED_CONVERSION));
} else {
options.put(JavaCore.COMPILER_ANNOTATION_NULL_ANALYSIS, "enabled");
options.put(JavaCore.COMPILER_NONNULL_ANNOTATION_NAME, nonnullType != null ? nonnullType : "");
Expand All @@ -2558,7 +2557,6 @@ private Map<String, String> generateProjectNullAnalysisOptions(String nonnullTyp
options.put(JavaCore.COMPILER_PB_NULL_ANNOTATION_INFERENCE_CONFLICT, "warning");
options.put(JavaCore.COMPILER_PB_MISSING_NONNULL_BY_DEFAULT_ANNOTATION, "ignore");
options.put(JavaCore.COMPILER_PB_SYNTACTIC_NULL_ANALYSIS_FOR_FIELDS, JavaCore.ENABLED);
options.put(JavaCore.COMPILER_PB_NULL_UNCHECKED_CONVERSION, JavaCore.IGNORE);
}
return options;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@

import java.io.ByteArrayInputStream;
import java.util.Collections;
import java.util.Hashtable;
import java.util.List;
import java.util.Map;

Expand Down Expand Up @@ -108,21 +107,12 @@ public void testMixedNullAnalysis() throws Exception {
assertTrue(marker.getResource() instanceof IFile);
assertEquals("TestJDT.java", ((IFile) marker1.getResource()).getFullPath().lastSegment());
IMarker marker2 = getWarningMarker(project, "The return type is incompatible with '@Nonnull String' returned from TestJavax.A.nonnullMethod() (mismatching null constraints)");
assertNotNull(marker2);
assertTrue(marker2.getResource() instanceof IFile);
assertNotNull(marker);
assertTrue(marker.getResource() instanceof IFile);
assertEquals("TestJavax.java", ((IFile) marker2.getResource()).getFullPath().lastSegment());
IMarker marker3 = getWarningMarker(project, "Null type safety: The expression of type 'List<String>' needs unchecked conversion to conform to '@Nonnull List<String>'");
assertNull(marker3);
IJavaProject javaProject = JavaCore.create(project);
Map<String, String> options = javaProject.getOptions(true);
assertEquals(JavaCore.IGNORE, options.get(JavaCore.COMPILER_PB_NULL_UNCHECKED_CONVERSION));
Hashtable<String, String> defaultOptions = JavaCore.getDefaultOptions();
options.put(JavaCore.COMPILER_PB_NULL_UNCHECKED_CONVERSION, defaultOptions.get(JavaCore.COMPILER_PB_NULL_UNCHECKED_CONVERSION));
javaProject.setOptions(options);
waitForBackgroundJobs();
marker3 = getWarningMarker(project, "Null type safety: The expression of type 'List<String>' needs unchecked conversion to conform to '@Nonnull List<String>'");
assertNotNull(marker3);
assertTrue(marker3.getResource() instanceof IFile);
assertNotNull(marker);
assertTrue(marker.getResource() instanceof IFile);
assertEquals("TestJavax.java", ((IFile) marker3.getResource()).getFullPath().lastSegment());
assertNoErrors(project);
} finally {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -379,5 +379,4 @@ public void testTelemetrySettings() throws Exception {
assertEquals(false, preferenceManager.getPreferences().isTelemetryEnabled());
}
}

}

0 comments on commit bbc4cfc

Please sign in to comment.