@Test @SuppressWarnings("unchecked") public void test_factory_param_type() { TokenBuilder tb = new TestTokenBuilder(null, null, null, S, MR, TF()); tb.setValue(2.0); assertThat(call_setFactory.with(tb, IntegerToken.FACTORY), returns()); assertThat(call_newToken.with(tb), raises(ClassCastException.class, "Invalid argument")); }
@Override public void setValue(V value) { checkArgument(value); this.value = value; }
AbstractTokenBuilder implements TokenBuilder<V, T> { @Override public void setValue(V value) { checkArgument(value); this.value = value; } }
AbstractTokenBuilder implements TokenBuilder<V, T> { @Override public void setValue(V value) { checkArgument(value); this.value = value; } AbstractTokenBuilder(String input, MatchResult groupProvider, TokenFactory<V, T> defaultFactory); @SuppressWarnings("unchecked")  AbstractTokenBuilder(Class<T> tokenType, Class<?> tValueType, Class<V> paramType, String input, MatchResult groupProvider, TokenFactory<? super V, ? extends T> defaultFactory); }
AbstractTokenBuilder implements TokenBuilder<V, T> { @Override public void setValue(V value) { checkArgument(value); this.value = value; } AbstractTokenBuilder(String input, MatchResult groupProvider, TokenFactory<V, T> defaultFactory); @SuppressWarnings("unchecked")  AbstractTokenBuilder(Class<T> tokenType, Class<?> tValueType, Class<V> paramType, String input, MatchResult groupProvider, TokenFactory<? super V, ? extends T> defaultFactory); @Override MatchResult getMatchResult(); @Override int getStart(); @Override void setStart(int start); @Override int getEnd(); @Override void setEnd(int end); @Override int getLength(); @Override void setLength(int length); @Override void setLength(int start, int length); @Override void setMatch(int start, int end); @Override void setMatch(String match); @Override void setKey(String key); @Override String getKey(); @Override void setValue(V value); @Override V getValue(); @Override void setChannel(int channel); @Override int getChannel(); @Override String getGroup(int i); @Override int getGroupCount(); @Override String getMatch(); @Override abstract int getDefaultIndex(); @Override abstract int getInputIndex(); @Override String getString(); @Override String getRemainingString(); @Override void setFactory(TokenFactory<?, ? extends T> factory); @Override T newToken(); @Override T newToken(String key); @Override T newToken(String key, V value); @Override T parseToken(String key, String match); @Override T newToken(int channel); @Override T newToken(int channel, String key); @Override T newToken(int channel, String key, V value); @Override T2 newToken(TokenFactory<? super V2, ? extends T2> factory); @Override T2 newToken(TokenFactory<? super V2, ? extends T2> factory, String key); @Override T2 newToken(TokenFactory<? super V2, ? extends T2> factory, V2 value); @Override T2 newToken(TokenFactory<? super V2, ? extends T2> factory, String key, V2 value); @Override T2 newToken(TokenFactory<? super V2, ? extends T2> factory, String key, String match); @Override T2 newToken(TokenFactory<? super V2, ? extends T2> factory, int channel); @Override T2 newToken(TokenFactory<? super V2, ? extends T2> factory, int channel, String key); @Override T2 newToken(TokenFactory<? super V2, ? extends T2> factory, int channel, String key, V2 value); @Override T getCurrentToken(); @Override void setCurrentToken(T token); }
AbstractTokenBuilder implements TokenBuilder<V, T> { @Override public void setValue(V value) { checkArgument(value); this.value = value; } AbstractTokenBuilder(String input, MatchResult groupProvider, TokenFactory<V, T> defaultFactory); @SuppressWarnings("unchecked")  AbstractTokenBuilder(Class<T> tokenType, Class<?> tValueType, Class<V> paramType, String input, MatchResult groupProvider, TokenFactory<? super V, ? extends T> defaultFactory); @Override MatchResult getMatchResult(); @Override int getStart(); @Override void setStart(int start); @Override int getEnd(); @Override void setEnd(int end); @Override int getLength(); @Override void setLength(int length); @Override void setLength(int start, int length); @Override void setMatch(int start, int end); @Override void setMatch(String match); @Override void setKey(String key); @Override String getKey(); @Override void setValue(V value); @Override V getValue(); @Override void setChannel(int channel); @Override int getChannel(); @Override String getGroup(int i); @Override int getGroupCount(); @Override String getMatch(); @Override abstract int getDefaultIndex(); @Override abstract int getInputIndex(); @Override String getString(); @Override String getRemainingString(); @Override void setFactory(TokenFactory<?, ? extends T> factory); @Override T newToken(); @Override T newToken(String key); @Override T newToken(String key, V value); @Override T parseToken(String key, String match); @Override T newToken(int channel); @Override T newToken(int channel, String key); @Override T newToken(int channel, String key, V value); @Override T2 newToken(TokenFactory<? super V2, ? extends T2> factory); @Override T2 newToken(TokenFactory<? super V2, ? extends T2> factory, String key); @Override T2 newToken(TokenFactory<? super V2, ? extends T2> factory, V2 value); @Override T2 newToken(TokenFactory<? super V2, ? extends T2> factory, String key, V2 value); @Override T2 newToken(TokenFactory<? super V2, ? extends T2> factory, String key, String match); @Override T2 newToken(TokenFactory<? super V2, ? extends T2> factory, int channel); @Override T2 newToken(TokenFactory<? super V2, ? extends T2> factory, int channel, String key); @Override T2 newToken(TokenFactory<? super V2, ? extends T2> factory, int channel, String key, V2 value); @Override T getCurrentToken(); @Override void setCurrentToken(T token);  }