private MetaMethod specialCasedOverrideForCreate ( final Method m ) { return new MetaMethod ( ) { @ Override public int getModifiers ( ) { return m . getModifiers ( ) ; } @ Override public String getName ( ) { return m . getName ( ) ; } @ Override public Class < ? > getReturnType ( ) { return m . getReturnType ( ) ; } @ Override public CachedClass getDeclaringClass ( ) { return ReflectionCache . getCachedClass ( m . getDeclaringClass ( ) ) ; } @ Override @ SuppressWarnings ( "unchecked" ) public Object invoke ( Object object , final Object [ ] arguments ) { return Observable . create ( new GroovyCreateWrapper ( ( Closure ) arguments [ 0 ] ) ) ; } @ Override public CachedClass [ ] getParameterTypes ( ) { if ( parameterTypes == null ) { getParametersTypes0 ( ) ; } return parameterTypes ; } private synchronized void getParametersTypes0 ( ) { if ( parameterTypes != null ) return ; Class [ ] npt = nativeParamTypes == null ? getPT ( ) : nativeParamTypes ; CachedClass [ ] pt = new CachedClass [ npt . length ] ; for ( int i = 0 ; i != npt . length ; ++ i ) { if ( Function . class . isAssignableFrom ( npt [ i ] ) ) { // function type to be replaced by closure pt [ i ] = ReflectionCache . getCachedClass ( Closure . class ) ; } else { // non-function type pt [ i ] = ReflectionCache . getCachedClass ( npt [ i ] ) ; } } nativeParamTypes = npt ; setParametersTypes ( pt ) ; } @ Override protected Class [ ] getPT ( ) { return m . getParameterTypes ( ) ; } } ; }
Special case until we finish migrating off the deprecated create method signature