/** * Checks the classes mentioned in the given class specifications, printing * notes if necessary. */ public void checkClassSpecifications(List classSpecifications) { if (classSpecifications != null) { for (int index = 0; index < classSpecifications.size(); index++) { ClassSpecification classSpecification = (ClassSpecification)classSpecifications.get(index); checkType(classSpecification.annotationType); checkClassName(classSpecification.className); checkType(classSpecification.extendsAnnotationType); checkClassName(classSpecification.extendsClassName); checkMemberSpecifications(classSpecification.fieldSpecifications, true); checkMemberSpecifications(classSpecification.methodSpecifications, false); } } }
/** * Checks the classes mentioned in the given class member specifications, * printing notes if necessary. */ private void checkMemberSpecifications(List memberSpecifications, boolean isField) { if (memberSpecifications != null) { for (int index = 0; index < memberSpecifications.size(); index++) { MemberSpecification memberSpecification = (MemberSpecification)memberSpecifications.get(index); checkType(memberSpecification.annotationType); if (isField) { checkType(memberSpecification.descriptor); } else { checkDescriptor(memberSpecification.descriptor); } } } }
new FullyQualifiedClassNameChecker(programClassPool, libraryClassPool, fullyQualifiedClassNameNotePrinter); fullyQualifiedClassNameChecker.checkClassSpecifications(configuration.keep); fullyQualifiedClassNameChecker.checkClassSpecifications(configuration.assumeNoSideEffects); fullyQualifiedClassNameChecker.checkClassSpecifications(configuration.assumeNoExternalSideEffects); fullyQualifiedClassNameChecker.checkClassSpecifications(configuration.assumeNoEscapingParameters); fullyQualifiedClassNameChecker.checkClassSpecifications(configuration.assumeNoExternalReturnValues);
/** * Checks the class mentioned in the given type (if any), * printing notes if necessary. */ private void checkType(String type) { if (type != null) { checkClassName(ClassUtil.internalClassNameFromType(type)); } }
/** * Checks the classes mentioned in the given class member descriptor, * printing notes if necessary. */ private void checkDescriptor(String descriptor) { if (descriptor != null) { InternalTypeEnumeration internalTypeEnumeration = new InternalTypeEnumeration(descriptor); checkType(internalTypeEnumeration.returnType()); while (internalTypeEnumeration.hasMoreTypes()) { checkType(internalTypeEnumeration.nextType()); } } }
/** * Checks the specified class (if any), * printing notes if necessary. */ private void checkClassName(String className) { if (className != null && !containsWildCards(className) && programClassPool.getClass(className) == null && libraryClassPool.getClass(className) == null && notePrinter.accepts(className)) { notePrinter.print(className, "Note: the configuration refers to the unknown class '" + ClassUtil.externalClassName(className) + "'"); // Strip "/class" or replace the package name by a wildcard. int lastSeparatorIndex = className.lastIndexOf(ClassConstants.PACKAGE_SEPARATOR); String fullyQualifiedClassName = className.endsWith(INVALID_CLASS_EXTENSION) ? className.substring(0, lastSeparatorIndex) : "**" + ClassConstants.PACKAGE_SEPARATOR + className.substring(lastSeparatorIndex + 1); // Suggest matching classes. ClassNameFilter classNameFilter = new ClassNameFilter(fullyQualifiedClassName, this); programClassPool.classesAccept(classNameFilter); libraryClassPool.classesAccept(classNameFilter); } }
WarningPrinter descriptorKeepNotePrinter = new WarningPrinter(System.out, configuration.note); new FullyQualifiedClassNameChecker(programClassPool, libraryClassPool, fullyQualifiedClassNameNotePrinter).checkClassSpecifications(configuration.keep);
new FullyQualifiedClassNameChecker(programClassPool, libraryClassPool, fullyQualifiedClassNameNotePrinter); fullyQualifiedClassNameChecker.checkClassSpecifications(configuration.keep); fullyQualifiedClassNameChecker.checkClassSpecifications(configuration.assumeNoSideEffects); fullyQualifiedClassNameChecker.checkClassSpecifications(configuration.assumeNoExternalSideEffects); fullyQualifiedClassNameChecker.checkClassSpecifications(configuration.assumeNoEscapingParameters); fullyQualifiedClassNameChecker.checkClassSpecifications(configuration.assumeNoExternalReturnValues);
/** * Checks the class mentioned in the given type (if any), * printing notes if necessary. */ private void checkType(String type) { if (type != null) { checkClassName(ClassUtil.internalClassNameFromType(type)); } }
/** * Checks the classes mentioned in the given class member descriptor, * printing notes if necessary. */ private void checkDescriptor(String descriptor) { if (descriptor != null) { InternalTypeEnumeration internalTypeEnumeration = new InternalTypeEnumeration(descriptor); checkType(internalTypeEnumeration.returnType()); while (internalTypeEnumeration.hasMoreTypes()) { checkType(internalTypeEnumeration.nextType()); } } }
/** * Checks the specified class (if any), * printing notes if necessary. */ private void checkClassName(String className) { if (className != null && !containsWildCards(className) && programClassPool.getClass(className) == null && libraryClassPool.getClass(className) == null && notePrinter.accepts(className)) { notePrinter.print(className, "Note: the configuration refers to the unknown class '" + ClassUtil.externalClassName(className) + "'"); // Strip "/class" or replace the package name by a wildcard. int lastSeparatorIndex = className.lastIndexOf(ClassConstants.PACKAGE_SEPARATOR); String fullyQualifiedClassName = className.endsWith(INVALID_CLASS_EXTENSION) ? className.substring(0, lastSeparatorIndex) : "**" + ClassConstants.PACKAGE_SEPARATOR + className.substring(lastSeparatorIndex + 1); // Suggest matching classes. ClassNameFilter classNameFilter = new ClassNameFilter(fullyQualifiedClassName, this); programClassPool.classesAccept(classNameFilter); libraryClassPool.classesAccept(classNameFilter); } }
/** * Checks the classes mentioned in the given class specifications, printing * notes if necessary. Returns the number of notes printed. */ public void checkClassSpecifications(List classSpecifications) { if (classSpecifications != null) { for (int index = 0; index < classSpecifications.size(); index++) { ClassSpecification classSpecification = (ClassSpecification)classSpecifications.get(index); checkType(classSpecification.annotationType); checkClassName(classSpecification.className); checkType(classSpecification.extendsAnnotationType); checkClassName(classSpecification.extendsClassName); checkMemberSpecifications(classSpecification.fieldSpecifications, true); checkMemberSpecifications(classSpecification.methodSpecifications, false); } } }
/** * Checks the classes mentioned in the given class member specifications, * printing notes if necessary. */ private void checkMemberSpecifications(List memberSpecifications, boolean isField) { if (memberSpecifications != null) { for (int index = 0; index < memberSpecifications.size(); index++) { MemberSpecification memberSpecification = (MemberSpecification)memberSpecifications.get(index); checkType(memberSpecification.annotationType); if (isField) { checkType(memberSpecification.descriptor); } else { checkDescriptor(memberSpecification.descriptor); } } } }
new FullyQualifiedClassNameChecker(programClassPool, libraryClassPool, fullyQualifiedClassNameNotePrinter); fullyQualifiedClassNameChecker.checkClassSpecifications(configuration.keep); fullyQualifiedClassNameChecker.checkClassSpecifications(configuration.assumeNoSideEffects); fullyQualifiedClassNameChecker.checkClassSpecifications(configuration.assumeNoExternalSideEffects); fullyQualifiedClassNameChecker.checkClassSpecifications(configuration.assumeNoEscapingParameters); fullyQualifiedClassNameChecker.checkClassSpecifications(configuration.assumeNoExternalReturnValues);
/** * Checks the class mentioned in the given type (if any), * printing notes if necessary. */ private void checkType(String type) { if (type != null) { checkClassName(ClassUtil.internalClassNameFromType(type)); } }
/** * Checks the classes mentioned in the given class member descriptor, * printing notes if necessary. */ private void checkDescriptor(String descriptor) { if (descriptor != null) { InternalTypeEnumeration internalTypeEnumeration = new InternalTypeEnumeration(descriptor); checkType(internalTypeEnumeration.returnType()); while (internalTypeEnumeration.hasMoreTypes()) { checkType(internalTypeEnumeration.nextType()); } } }
/** * Checks the specified class (if any), * printing notes if necessary. */ private void checkClassName(String className) { if (className != null && !containsWildCards(className) && programClassPool.getClass(className) == null && libraryClassPool.getClass(className) == null && notePrinter.accepts(className)) { notePrinter.print(className, "Note: the configuration refers to the unknown class '" + ClassUtil.externalClassName(className) + "'"); // Strip "/class" or replace the package name by a wildcard. int lastSeparatorIndex = className.lastIndexOf(ClassConstants.PACKAGE_SEPARATOR); String fullyQualifiedClassName = className.endsWith(INVALID_CLASS_EXTENSION) ? className.substring(0, lastSeparatorIndex) : "**" + ClassConstants.PACKAGE_SEPARATOR + className.substring(lastSeparatorIndex + 1); // Suggest matching classes. ClassNameFilter classNameFilter = new ClassNameFilter(fullyQualifiedClassName, this); programClassPool.classesAccept(classNameFilter); libraryClassPool.classesAccept(classNameFilter); } }
/** * Checks the classes mentioned in the given class specifications, printing * notes if necessary. */ public void checkClassSpecifications(List classSpecifications) { if (classSpecifications != null) { for (int index = 0; index < classSpecifications.size(); index++) { ClassSpecification classSpecification = (ClassSpecification)classSpecifications.get(index); checkType(classSpecification.annotationType); checkClassName(classSpecification.className); checkType(classSpecification.extendsAnnotationType); checkClassName(classSpecification.extendsClassName); checkMemberSpecifications(classSpecification.fieldSpecifications, true); checkMemberSpecifications(classSpecification.methodSpecifications, false); } } }
/** * Checks the classes mentioned in the given class member specifications, * printing notes if necessary. */ private void checkMemberSpecifications(List memberSpecifications, boolean isField) { if (memberSpecifications != null) { for (int index = 0; index < memberSpecifications.size(); index++) { MemberSpecification memberSpecification = (MemberSpecification)memberSpecifications.get(index); checkType(memberSpecification.annotationType); if (isField) { checkType(memberSpecification.descriptor); } else { checkDescriptor(memberSpecification.descriptor); } } } }
/** * Checks the class mentioned in the given type (if any), * printing notes if necessary. */ private void checkType(String type) { if (type != null) { checkClassName(ClassUtil.internalClassNameFromType(type)); } }