Skip to content

Commit

Permalink
Change test of TreeSet into test of HashSet (#1328)
Browse files Browse the repository at this point in the history
Also adds back the TreeSet test as a (skipped) test for #1330.
  • Loading branch information
mernst authored and smillst committed Jun 8, 2017
1 parent b64799e commit 68c80d6
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
20 changes: 20 additions & 0 deletions checker/tests/nullness/jdkannotations/HashtableTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import java.util.Hashtable;
import org.checkerframework.checker.nullness.qual.Nullable;

class HashtableTest {

public static void main(String[] args) {

//:: error: (type.argument.type.incompatible)
Hashtable<@Nullable Integer, String> ht1 = new Hashtable<>();

// Suffers null pointer exception
ht1.put(null, "hello");

//:: error: (type.argument.type.incompatible)
Hashtable<Integer, @Nullable String> ht2 = new Hashtable<>();

// Suffers null pointer exception
ht2.put(42, null);
}
}
6 changes: 6 additions & 0 deletions checker/tests/nullness/jdkannotations/TreeSetTest.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
// Partial test case for issue #1330: https://github.com/typetools/checker-framework/issues/1330
// This should be expanded to include all the cases in the issue.

// @skip-test until we fix the issue

import java.util.TreeSet;
import org.checkerframework.checker.nullness.qual.Nullable;

Expand All @@ -8,6 +13,7 @@ public static void main(String[] args) {
//:: error: (type.argument.type.incompatible)
TreeSet<@Nullable Integer> ts = new TreeSet<>();

// This throws a null pointer exception
ts.add(null);
}
}

0 comments on commit 68c80d6

Please sign in to comment.