@Test public void primitiveIsWrapped() { int a = 1; final int total = a + 1; class Instantiated {{ assertEquals(2, total); }} FunkyFunction<Instantiated> executor = new FunkyFunction<Instantiated>(Instantiated.class, null, total); executor.execute(); }
public T execute() { try { return constructor.newInstance(constructionArguments); } catch (InvocationTargetException e) { Throwable cause = e.getCause(); if (cause instanceof Error) { throw ((Error) cause); } else { throw ((RuntimeException) cause); } } catch (Exception e) { throw new IllegalStateException("This should never happen. Due to previously checked constraints (see extractConstructor()), no exception may actually be caught here.", e); } }
FunkyFunction implements ClassFunction<T> { public T execute() { try { return constructor.newInstance(constructionArguments); } catch (InvocationTargetException e) { Throwable cause = e.getCause(); if (cause instanceof Error) { throw ((Error) cause); } else { throw ((RuntimeException) cause); } } catch (Exception e) { throw new IllegalStateException("This should never happen. Due to previously checked constraints (see extractConstructor()), no exception may actually be caught here.", e); } } }
FunkyFunction implements ClassFunction<T> { public T execute() { try { return constructor.newInstance(constructionArguments); } catch (InvocationTargetException e) { Throwable cause = e.getCause(); if (cause instanceof Error) { throw ((Error) cause); } else { throw ((RuntimeException) cause); } } catch (Exception e) { throw new IllegalStateException("This should never happen. Due to previously checked constraints (see extractConstructor()), no exception may actually be caught here.", e); } } FunkyFunction(Class<T> applyingClass, Object... constructorArguments); }
FunkyFunction implements ClassFunction<T> { public T execute() { try { return constructor.newInstance(constructionArguments); } catch (InvocationTargetException e) { Throwable cause = e.getCause(); if (cause instanceof Error) { throw ((Error) cause); } else { throw ((RuntimeException) cause); } } catch (Exception e) { throw new IllegalStateException("This should never happen. Due to previously checked constraints (see extractConstructor()), no exception may actually be caught here.", e); } } FunkyFunction(Class<T> applyingClass, Object... constructorArguments); T execute(); @Override String getClassSimpleName(); }
FunkyFunction implements ClassFunction<T> { public T execute() { try { return constructor.newInstance(constructionArguments); } catch (InvocationTargetException e) { Throwable cause = e.getCause(); if (cause instanceof Error) { throw ((Error) cause); } else { throw ((RuntimeException) cause); } } catch (Exception e) { throw new IllegalStateException("This should never happen. Due to previously checked constraints (see extractConstructor()), no exception may actually be caught here.", e); } } FunkyFunction(Class<T> applyingClass, Object... constructorArguments); T execute(); @Override String getClassSimpleName();  }