Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "Set o.e.j.c.compiler.problem.nullUncheckedConversion to ignore by default" #3225

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2624,7 +2624,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 @@ -2636,7 +2635,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());
}
}

}