@Test(expected = Shared.InitializationException.class) public void raise_exception() { Shared<Integer> shared = new Shared<Integer>() { @Override protected Integer initialValue() throws IOException { throw new IOException(); } }; shared.get(); }
public final T get() { T cached = shared; if (cached != null) { return cached; } synchronized (this) { if (initialized == false) { try { set(initialValue()); } catch (IOException e) { throw new InitializationException("failed to initialize shared value", e); } } return shared; } }
Shared { public final T get() { T cached = shared; if (cached != null) { return cached; } synchronized (this) { if (initialized == false) { try { set(initialValue()); } catch (IOException e) { throw new InitializationException("failed to initialize shared value", e); } } return shared; } } }
Shared { public final T get() { T cached = shared; if (cached != null) { return cached; } synchronized (this) { if (initialized == false) { try { set(initialValue()); } catch (IOException e) { throw new InitializationException("failed to initialize shared value", e); } } return shared; } }  }
Shared { public final T get() { T cached = shared; if (cached != null) { return cached; } synchronized (this) { if (initialized == false) { try { set(initialValue()); } catch (IOException e) { throw new InitializationException("failed to initialize shared value", e); } } return shared; } }  final T get(); final void remove(); final void set(T value); final boolean isInitialzed(); }
Shared { public final T get() { T cached = shared; if (cached != null) { return cached; } synchronized (this) { if (initialized == false) { try { set(initialValue()); } catch (IOException e) { throw new InitializationException("failed to initialize shared value", e); } } return shared; } }  final T get(); final void remove(); final void set(T value); final boolean isInitialzed();  }