ClassAnalyzer { public static boolean isModifiable(CtBehavior behavior) { return !Modifier.isNative(behavior.getModifiers()) && !Modifier.isAbstract(behavior.getModifiers()); }  static List<CtMethod> getDeclaredMethods(CtClass clazz, BehaviorFilter... filters); static List<CtBehavior> getDeclaredBehaviors(CtClass clazz, BehaviorFilter... filters); static List<CtConstructor> getDeclaredConstructors(CtClass clazz, BehaviorFilter... filters); static boolean isModifiable(CtBehavior behavior); static boolean isDynamic(CtBehavior behavior); static boolean isStatic(CtBehavior behavior); static boolean isPrivate(CtBehavior behavior); static boolean constructorHasAdditionalParameter(CtClass affectedClass); static boolean isInitializer(CtBehavior behavior); static boolean isClassInitializer(CtBehavior behavior); static String getSimpleName(CtBehavior behavior); static String getSimpleName(CtField field); static String getSimplerName(Class<?> clazz); static CtConstructor getDeclaredConstructor(CtClass clazz, CtClass... parameters); static CtMethod getDeclaredMethod(CtClass clazz, String methodName, CtClass... parameters); static CtMethod getMethod(CtClass clazz, String methodName, String signature); static CtField getField(CtClass clazz, String fieldName); static boolean isSynthetic(CtBehavior behavior); static CtClass[] getConstructorParameterTypes(CtClass affectedClass, CtBehavior contractBehavior);  }
@Test public void testIsModifiable() throws Throwable { CtClass objectClass = pool.get(Object.class.getName()); assertTrue(ClassAnalyzer.isModifiable(objectClass.getDeclaredMethod("finalize"))); assertFalse(ClassAnalyzer.isModifiable(objectClass.getDeclaredMethod("hashCode"))); }