TODO: UGH: use reflection!
518237
public static HashMap<String, Object> makeEmptyFrameMeta() {
    HashMap<String,Object> hm = new LinkedHashMap<>(); // preserve insertion order
    for(String key: FrameMetadata.METAVALUES) hm.put(key,null);
    return hm;
  }
202330
public static java.lang.reflect.Method read(ObjectInput in)
            throws ClassNotFoundException, NoSuchMethodException, IOException {
        Class cl;
        Class[] types;
        String name;

        cl = ClassRef.read(in);
        if (cl == null) {
            return null;
        } else {
            name = (String) in.readUTF();
            types = ClassRef.readClasses(in);
            return cl.getMethod(name, types);
        }
    }
546317
@SuppressWarnings("unchecked")
    static <P> MutableLightMetaProperty<P> of(
            MetaBean metaBean,
            Field field,
            final Method getMethod,
            final Method setMethod,
            final String propertyName,
            int constructorIndex) {
        
        PropertyGetter getter = new PropertyGetter() {
            @Override
            public Object get(Bean bean) {
                try {
                    return getMethod.invoke(bean);
                } catch (IllegalArgumentException | IllegalAccessException ex) {
                    throw new UnsupportedOperationException("Property cannot be read: " + propertyName, ex);
                } catch (InvocationTargetException ex) {
                    if (ex.getCause() instanceof RuntimeException) {
                        throw (RuntimeException) ex.getCause();
                    }
                    throw new RuntimeException(ex);
                }
            }
        };
        PropertySetter setter = new PropertySetter() {
            @Override
            public void set(Bean bean, Object value) {
                try {
                    setMethod.invoke(bean, value);
                } catch (IllegalArgumentException | IllegalAccessException ex) {
                    throw new UnsupportedOperationException("Property cannot be written: " + propertyName, ex);
                } catch (InvocationTargetException ex) {
                    if (ex.getCause() instanceof RuntimeException) {
                        throw (RuntimeException) ex.getCause();
                    }
                    throw new RuntimeException(ex);
                }
            }
        };
        // special case for optional
        return new MutableLightMetaProperty<>(
                metaBean, 
                propertyName, 
                (Class<P>) field.getType(), 
                field.getGenericType(), 
                Arrays.asList(field.getAnnotations()), 
                getter,
                setter,
                constructorIndex);
    }
488341
def reflection_for(path, for_join_table_only = false)
      @join_table_joins << path if for_join_table_only and !reflections[path]
      reflections[path] ||= map_reflection_for( path )
    end
796864
@SuppressWarnings("unchecked")
	public static <S extends Serializable> S invokeGetter(Object object, Field field)
	{
		Method m = ReflectionUtils.findMethod(object.getClass(), ReflectUtils.toGetter(field.getName()));
		if (null == m) {
			for (String prefix : PREFIXES) {
				 m = ReflectionUtils.findMethod(object.getClass(), ReflectUtils.toGetter(field.getName(), prefix));
				 if (null != m) {
					 break;
				 }
			}
		}
		return (S) ReflectionUtils.invokeMethod(m, object);
	}
1162965
function Property(path, node, scope, getObjectRef, file) {
  if (!node.method && node.kind === "init") return;
  if (!t.isFunction(node.value)) return;

  var replaceSupers = new _helpersReplaceSupers2["default"]({
    getObjectRef: getObjectRef,
    methodNode: node,
    methodPath: path,
    isStatic: true,
    scope: scope,
    file: file
  });

  replaceSupers.replace();
}
967223
@SuppressWarnings("unchecked")
    public static <R> R invoke(Object obj, Method method, Object... args) {
        try {
            if (obj instanceof Class) {
                return (R) method.invoke(null, args);
            } else {
                return (R) method.invoke(obj, args);
            }
        } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
            throw new ReflectException("调用方法[" + method + "]失败", e);
        }
    }
481403
private function getPropertyValue(ReflectionClass $reflection, $property, $object)
    {
        $propertyReflection = $this->accessProperty($reflection, $property);
        $value = $propertyReflection->getValue($object);
        $propertyReflection->setAccessible(false);

        return $value;
    }
749025
private static Object __applyObject(Object defaultObj, Object custom) {
        if (custom != null)
            return custom;
        
        return defaultObj;
    }
132808
public <T> T get(String key, Class<T> clazz, T defaultValue) {
        Object obj = argMap.get(key);
        if (obj == null) {
            return defaultValue;
        }
        return Reflection.toType(obj, clazz);
    }
600912
int writeJavaAnnotations(List<Attribute.Compound> attrs) {
        if (attrs.isEmpty()) return 0;
        ListBuffer<Attribute.Compound> visibles = new ListBuffer<Attribute.Compound>();
        ListBuffer<Attribute.Compound> invisibles = new ListBuffer<Attribute.Compound>();
        for (Attribute.Compound a : attrs) {
            switch (types.getRetention(a)) {
            case SOURCE: break;
            case CLASS: invisibles.append(a); break;
            case RUNTIME: visibles.append(a); break;
            default: ;// /* fail soft */ throw new AssertionError(vis);
            }
        }

        int attrCount = 0;
        if (visibles.length() != 0) {
            int attrIndex = writeAttr(names.RuntimeVisibleAnnotations);
            databuf.appendChar(visibles.length());
            for (Attribute.Compound a : visibles)
                writeCompoundAttribute(a);
            endAttr(attrIndex);
            attrCount++;
        }
        if (invisibles.length() != 0) {
            int attrIndex = writeAttr(names.RuntimeInvisibleAnnotations);
            databuf.appendChar(invisibles.length());
            for (Attribute.Compound a : invisibles)
                writeCompoundAttribute(a);
            endAttr(attrIndex);
            attrCount++;
        }
        return attrCount;
    }
1143576
public static <T> T invokeMethod(final Object target, final String name, final Class<?>[] parameterTypes, final Object[] parameterValues) {
		Method method = getAccessibleMethod(target, name, parameterTypes);
		if (method == null) {
			throw new IllegalArgumentException("Could not find method [" + name + "] on target [" + target + ']');
		}

		try {
			return (T) method.invoke(target, parameterValues);
		} catch (ReflectiveOperationException e) {
			throw new ReflectionRuntimeException(e);
		}
	}
567661
private static <T, F> FieldAugment<T, F> tryCreateReflectionAugment(Class<T> type, Class<? super F> fieldType, String name, F defaultValue) {
		Field f = findField(type, fieldType, name);
		if (f != null && typeIsAssignmentCompatible(f.getType(), fieldType)) return new ReflectionFieldAugment<T, F>(f, fieldType, defaultValue);
		return null;
	}
727968
private static Reflect on(Constructor<?> constructor, Object... args) throws ReflectException {
        try {
            return on(constructor.getDeclaringClass(), accessible(constructor).newInstance(args));
        }
        catch (Exception e) {
            throw new ReflectException(e);
        }
    }
692251
private static void unwrapArgs(final Class<?>[] types, final Object[] args) {
        if (args == null) {
            return;
        }
        try {
            for (int i = 0; i < args.length; ++i) {
                args[i] = ReflectionHelper.unwrap(types[i], args[i]);
            }
        } catch (Exception e) {
            throw new IllegalArgumentException(e);
        }

    }
506440
public final void mFUNCT() throws RecognitionException {
        try {
            int _type = FUNCT;
            int _channel = DEFAULT_TOKEN_CHANNEL;
            // C:\\Project\\Obdalib\\obdalib-parent\\obdalib-core\\src\\main\\java\\it\\unibz\\inf\\obda\\gui\\swing\\utils\\MappingFilter.g:122:6: ( ( 'F' | 'f' ) ( 'U' | 'u' ) ( 'N' | 'n' ) ( 'C' | 'c' ) ( 'T' | 't' ) )
            // C:\\Project\\Obdalib\\obdalib-parent\\obdalib-core\\src\\main\\java\\it\\unibz\\inf\\obda\\gui\\swing\\utils\\MappingFilter.g:122:8: ( 'F' | 'f' ) ( 'U' | 'u' ) ( 'N' | 'n' ) ( 'C' | 'c' ) ( 'T' | 't' )
            {
            if ( input.LA(1)=='F'||input.LA(1)=='f' ) {
                input.consume();
            }
            else {
                MismatchedSetException mse = new MismatchedSetException(null,input);
                recover(mse);
                throw mse;
            }


            if ( input.LA(1)=='U'||input.LA(1)=='u' ) {
                input.consume();
            }
            else {
                MismatchedSetException mse = new MismatchedSetException(null,input);
                recover(mse);
                throw mse;
            }


            if ( input.LA(1)=='N'||input.LA(1)=='n' ) {
                input.consume();
            }
            else {
                MismatchedSetException mse = new MismatchedSetException(null,input);
                recover(mse);
                throw mse;
            }


            if ( input.LA(1)=='C'||input.LA(1)=='c' ) {
                input.consume();
            }
            else {
                MismatchedSetException mse = new MismatchedSetException(null,input);
                recover(mse);
                throw mse;
            }


            if ( input.LA(1)=='T'||input.LA(1)=='t' ) {
                input.consume();
            }
            else {
                MismatchedSetException mse = new MismatchedSetException(null,input);
                recover(mse);
                throw mse;
            }


            }

            state.type = _type;
            state.channel = _channel;
        }
        finally {
        	// do for sure before leaving
        }
    }
1077584
function ({className, methodName, target, self, ownLibrary, dependencyLibs, text}) {
		let sResult;

		function searchInSymbol(oSymbol) {
			function findProperty(oEntity, sName, sTarget) {
				if (!oEntity || !oEntity.properties) {
					return;
				}
				return oEntity.properties.find(({name}) => name === sName || name === sTarget);
			}

			function findMethod(oEntity, sName, sTarget) {
				if (!oEntity || !oEntity.methods) {
					return;
				}
				return oEntity.methods.find(({name}) => name === sName || name === sTarget);
			}

			function findEvent(oEntity, sName) {
				if (!oEntity || !oEntity.events) {
					return;
				}
				return oEntity.events.find(({name}) => name === sName);
			}

			if (oSymbol.name === target) {
				sResult = this.createLink({
					name: oSymbol.name,
					text: text
				});
				return true;
			}
			if (oSymbol.name === className) {
				let oProperty = findProperty(oSymbol, methodName, target);
				if (oProperty) {
					sResult = this.createLink({
						name: oProperty.name,
						text: text
					});
					return true;
				}
				let oMethod = findMethod(oSymbol, methodName, target);
				if (oMethod) {
					sResult = this.createLink({
						name: oMethod.static ? target : oMethod.name,
						type: "methods",
						text: text,
						className: className
					});
					return true;
				}

				let oEvent = findEvent(oSymbol, methodName);
				if (oEvent) {
					sResult = this.createLink({
						name: oEvent.name,
						type: "events",
						text: text,
						className: className
					});
					return true;
				}
			}

			return false;
		}

		// Self link
		if (self.name === target) {
			return this.createLink({
				name: target,
				text: text
			});
		}

		// Own methods search
		if (self.name === className && self.methods) {
			let oResult = self.methods.find(({name}) => name === methodName);
			if (oResult) {
				return this.createLink({
					name: oResult.static ? [self.name, oResult.name].join(".") : oResult.name,
					type: "methods",
					className: className,
					text: text,
					local: true
				});
			}
		}

		// Local library symbols
		ownLibrary.symbols.find(oSymbol => {
			return searchInSymbol.call(this, oSymbol);
		});

		if (sResult) return sResult;

		// Dependent library symbols
		dependencyLibs && Object.keys(dependencyLibs).find(sLib => {
			if (sLib === target) {
				sResult = this.createLink({
					name: sLib,
					text: text
				});
				return true;
			}
			return dependencyLibs[sLib].find(oSymbol => {
				return searchInSymbol.call(this, oSymbol);
			});
		});

		return sResult;
	}