private static void scanForFinalModifiers(Class<?> clazz) throws FinalModifierException { LOGGER.debug(Constants.LOG_ENTRY, "scanForFinalModifiers", new Object[] { clazz }); if (isFinal(clazz.getModifiers())) { throw new FinalModifierException(clazz); } List<String> finalMethods = new ArrayList<String>(); // we don't want to check for final methods on java.* or javax.* Class // also, clazz can never be null here (we will always hit // java.lang.Object first) while (!clazz.getName().startsWith("java.") && !clazz.getName().startsWith("javax.")) { for (Method m : clazz.getDeclaredMethods()) { //Static finals are ok, because we won't be overriding them :) if (isFinal(m.getModifiers()) && !Modifier.isStatic(m.getModifiers())) { finalMethods.add(m.toGenericString()); } } clazz = clazz.getSuperclass(); } if (!finalMethods.isEmpty()) { String methodList = finalMethods.toString(); methodList = methodList.substring(1, methodList.length() - 1); throw new FinalModifierException(clazz, methodList); } LOGGER.debug(Constants.LOG_EXIT, "scanForFinalModifiers"); }
private static void scanForFinalModifiers(Class<?> clazz) throws FinalModifierException { LOGGER.debug(Constants.LOG_ENTRY, "scanForFinalModifiers", new Object[] { clazz }); if (isFinal(clazz.getModifiers())) { throw new FinalModifierException(clazz); } List<String> finalMethods = new ArrayList<String>(); // we don't want to check for final methods on java.* or javax.* Class // also, clazz can never be null here (we will always hit // java.lang.Object first) while (!clazz.getName().startsWith("java.") && !clazz.getName().startsWith("javax.")) { for (Method m : clazz.getDeclaredMethods()) { //Static finals are ok, because we won't be overriding them :) if (isFinal(m.getModifiers()) && !Modifier.isStatic(m.getModifiers())) { finalMethods.add(m.toGenericString()); } } clazz = clazz.getSuperclass(); } if (!finalMethods.isEmpty()) { String methodList = finalMethods.toString(); methodList = methodList.substring(1, methodList.length() - 1); throw new FinalModifierException(clazz, methodList); } LOGGER.debug(Constants.LOG_EXIT, "scanForFinalModifiers"); }
throw new FinalModifierException(superclass);
throw new FinalModifierException(superclass);
String[] exceptionParts = className.substring(1).split(":"); if (exceptionParts.length == 1) { throw new FinalModifierException(aClass); } else { throw new FinalModifierException(aClass, exceptionParts[1]);
String[] exceptionParts = className.substring(1).split(":"); if (exceptionParts.length == 1) { throw new FinalModifierException(aClass); } else { throw new FinalModifierException(aClass, exceptionParts[1]);
throw new RuntimeException(new FinalModifierException( superToCopy, name));
throw new RuntimeException(new FinalModifierException( superToCopy, name));