Search Options

Results per page
Sort
Preferred Languages
Advance

Results 61 - 70 of 105 for ClassCastException (1.25 sec)

  1. android/guava-tests/test/com/google/common/collect/MutableClassToInstanceMapTest.java

         * well-tested. A purist would object to this, but what can I say, we're dirty cheaters.
         */
        map.put(Integer.class, new Integer(5));
        assertThrows(ClassCastException.class, () -> map.put(Double.class, new Long(42)));
        // Won't compile: map.put(String.class, "x");
      }
    
      public void testPutAndGetInstance() {
        assertNull(map.putInstance(Integer.class, new Integer(5)));
    
    Registered: Fri Sep 05 12:43:10 UTC 2025
    - Last Modified: Tue Feb 11 18:34:30 UTC 2025
    - 4.9K bytes
    - Viewed (0)
  2. android/guava-testlib/src/com/google/common/collect/testing/SafeTreeSet.java

        return delegate.toArray();
      }
    
      @Override
      public <T> T[] toArray(T[] a) {
        return delegate.toArray(a);
      }
    
      @CanIgnoreReturnValue
      private <T> T checkValid(T t) {
        // a ClassCastException is what's supposed to happen!
        @SuppressWarnings("unchecked")
        E e = (E) t;
        int unused = comparator().compare(e, e);
        return t;
      }
    
      @Override
    Registered: Fri Sep 05 12:43:10 UTC 2025
    - Last Modified: Thu Feb 13 17:34:21 UTC 2025
    - 5.8K bytes
    - Viewed (0)
  3. android/guava-testlib/src/com/google/common/collect/testing/testers/CollectionRemoveTester.java

      }
    
      @CollectionFeature.Require(SUPPORTS_REMOVE)
      public void testRemove_wrongType() {
        try {
          assertFalse(collection.remove(WrongType.VALUE));
        } catch (ClassCastException tolerated) {
        }
        expectUnchanged();
      }
    Registered: Fri Sep 05 12:43:10 UTC 2025
    - Last Modified: Tue Feb 11 21:04:02 UTC 2025
    - 5.6K bytes
    - Viewed (0)
  4. android/guava-testlib/src/com/google/common/collect/testing/testers/CollectionRemoveAllTester.java

        try {
          assertFalse(
              "removeAll(containsWrongType) should return false or throw",
              collection.removeAll(MinimalCollection.of(WrongType.VALUE)));
        } catch (ClassCastException tolerated) {
        }
        expectUnchanged();
      }
    Registered: Fri Sep 05 12:43:10 UTC 2025
    - Last Modified: Thu Nov 14 23:40:07 UTC 2024
    - 7.7K bytes
    - Viewed (0)
  5. android/guava-tests/test/com/google/common/collect/AbstractTableTest.java

        }
      }
    
      @SuppressWarnings("unchecked") // C can only be @Nullable Character or Character
      protected @NonNull C cellValue(Character character) {
        return (C) character;
      }
    
      // Only safe wrt. ClassCastException. Not null-safe (can be used to test expected Table NPEs)
      @SuppressWarnings("unchecked")
      protected C nullableCellValue(@Nullable Character character) {
        return (C) character;
      }
    Registered: Fri Sep 05 12:43:10 UTC 2025
    - Last Modified: Sun Dec 22 03:38:46 UTC 2024
    - 5.8K bytes
    - Viewed (0)
  6. android/guava/src/com/google/common/collect/TreeRangeSet.java

              if (candidate != null && candidate.getValue().upperBound.equals(cut)) {
                return candidate.getValue();
              }
            } catch (ClassCastException e) {
              return null;
            }
          }
          return null;
        }
    
        @Override
        Iterator<Entry<Cut<C>, Range<C>>> entryIterator() {
          /*
    Registered: Fri Sep 05 12:43:10 UTC 2025
    - Last Modified: Mon Aug 11 19:31:30 UTC 2025
    - 32.3K bytes
    - Viewed (0)
  7. src/test/java/jcifs/smb/SmbTreeImplTest.java

            SmbTreeImpl unwrapped = tree.unwrap(SmbTreeImpl.class);
            assertEquals(tree, unwrapped);
            // Test unwrapping to a non-assignable type should fail
            assertThrows(ClassCastException.class, () -> {
                // Create a mock class that extends SmbTree but is not assignable from SmbTreeImpl
                class CustomSmbTree extends SmbTreeImpl {
                    CustomSmbTree() {
    Registered: Sun Sep 07 00:10:21 UTC 2025
    - Last Modified: Thu Aug 14 05:31:44 UTC 2025
    - 7.8K bytes
    - Viewed (0)
  8. guava-testlib/src/com/google/common/collect/testing/testers/CollectionRemoveAllTester.java

        try {
          assertFalse(
              "removeAll(containsWrongType) should return false or throw",
              collection.removeAll(MinimalCollection.of(WrongType.VALUE)));
        } catch (ClassCastException tolerated) {
        }
        expectUnchanged();
      }
    Registered: Fri Sep 05 12:43:10 UTC 2025
    - Last Modified: Thu Nov 14 23:40:07 UTC 2024
    - 7.7K bytes
    - Viewed (0)
  9. src/test/java/jcifs/smb/SmbRenewableCredentialsTest.java

            }
    
            @Override
            public <T extends Credentials> T unwrap(Class<T> type) {
                if (type.isInstance(this)) {
                    return type.cast(this);
                }
                throw new ClassCastException("Cannot unwrap to " + type.getName());
            }
        }
    
        static class SelfRenewingCreds extends BaseCreds {
            @Override
            public CredentialsInternal renew() {
    Registered: Sun Sep 07 00:10:21 UTC 2025
    - Last Modified: Thu Aug 14 05:31:44 UTC 2025
    - 7K bytes
    - Viewed (0)
  10. guava-tests/test/com/google/common/collect/AbstractTableTest.java

        }
      }
    
      @SuppressWarnings("unchecked") // C can only be @Nullable Character or Character
      protected @NonNull C cellValue(Character character) {
        return (C) character;
      }
    
      // Only safe wrt. ClassCastException. Not null-safe (can be used to test expected Table NPEs)
      @SuppressWarnings("unchecked")
      protected C nullableCellValue(@Nullable Character character) {
        return (C) character;
      }
    Registered: Fri Sep 05 12:43:10 UTC 2025
    - Last Modified: Sun Dec 22 03:38:46 UTC 2024
    - 5.8K bytes
    - Viewed (0)
Back to top