mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
NullableNotNullManager: remove all default nullables from not-nulls and vice versa
+ Simple sanity test. Review ID: IDEA-CR-33648
This commit is contained in:
@@ -50,7 +50,7 @@ public class NullableNotNullManagerImpl extends NullableNotNullManager implement
|
||||
public void setNotNulls(@NotNull String... annotations) {
|
||||
LinkedHashSet<String> set = ContainerUtil.newLinkedHashSet(annotations);
|
||||
Collections.addAll(set, DEFAULT_NOT_NULLS);
|
||||
set.remove(NULLABLE);
|
||||
set.removeAll(Arrays.asList(DEFAULT_NULLABLES));
|
||||
myNotNulls = new ArrayList<>(set);
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ public class NullableNotNullManagerImpl extends NullableNotNullManager implement
|
||||
public void setNullables(@NotNull String... annotations) {
|
||||
LinkedHashSet<String> set = ContainerUtil.newLinkedHashSet(annotations);
|
||||
Collections.addAll(set, DEFAULT_NULLABLES);
|
||||
set.remove(NOT_NULL);
|
||||
set.removeAll(Arrays.asList(DEFAULT_NOT_NULLS));
|
||||
myNullables = new ArrayList<>(set);
|
||||
}
|
||||
|
||||
@@ -135,8 +135,8 @@ public class NullableNotNullManagerImpl extends NullableNotNullManager implement
|
||||
|
||||
readJdomList(state.myNullables, myNullables, DEFAULT_NULLABLES);
|
||||
readJdomList(state.myNotNulls, myNotNulls, DEFAULT_NOT_NULLS);
|
||||
myNullables.remove(NOT_NULL);
|
||||
myNotNulls.remove(NULLABLE);
|
||||
myNullables.removeAll(Arrays.asList(DEFAULT_NOT_NULLS));
|
||||
myNotNulls.removeAll(Arrays.asList(DEFAULT_NULLABLES));
|
||||
}
|
||||
|
||||
private static void readJdomList(@Nullable Element src, @NotNull List<String> to, @NotNull String[] defaults) {
|
||||
|
||||
@@ -34,6 +34,9 @@ public class NullableNotNullManagerTest extends LightPlatformTestCase {
|
||||
public void testCannotAddNotNullToNullable() {
|
||||
assertNotNull(myManager);
|
||||
checkAnnotations();
|
||||
myManager.setNotNulls("foo.NotNull");
|
||||
checkAnnotations();
|
||||
assertTrue(myManager.getNotNulls().contains("foo.NotNull"));
|
||||
myManager.setNotNulls(AnnotationUtil.NULLABLE);
|
||||
myManager.setNullables(AnnotationUtil.NOT_NULL);
|
||||
checkAnnotations();
|
||||
|
||||
Reference in New Issue
Block a user