/*
* JavaInspect - Utility to visualize java software
- * Copyright (C) 2013-2015, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu
+ * Copyright (C) 2013-2017, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 3 of the GNU Lesser General Public License
public class ClassDescriptor implements GraphElement, Comparable<ClassDescriptor> {
private static final int MAX_REFERECNES_COUNT = 10;
- private final Map<String, FieldDescriptor> nameToFieldMap = new TreeMap<String, FieldDescriptor>();
+ private final Map<String, FieldDescriptor> nameToFieldMap = new TreeMap<>();
private final SortedSet<MethodDescriptor> methods = new TreeSet<MethodDescriptor>();
private final ClassGraph classGraph;
boolean isEnum;
if (!isVisible())
return;
- indexFields(clazz.getDeclaredFields());
- indexFields(clazz.getFields());
+ try {
+ indexFields(clazz.getDeclaredFields());
+ indexFields(clazz.getFields());
+ } catch (NoClassDefFoundError error){
+ // TODO: better logging of this error
+ System.out.println(error.toString());
+ }
indexMethods(clazz);
result.append("\n");
result.append(" // field references to other classes\n");
- for (final Map.Entry<String, FieldDescriptor> entry : nameToFieldMap
- .entrySet())
- result.append(entry.getValue().getDot());
+ nameToFieldMap.forEach((fieldName, field) -> result.append(field.getDot()));
}
private void enlistFields(final StringBuffer result) {
+ fullyQualifiedName
.replace('.', '_')
.replace(";", "")
- .replace("[L", "")
.replace("[[", "")
+ .replace("[L", "")
+ .replace("[[L", "") // array of arrays
+ .replace("[[[L", "") // array of arrays of arrays
.replace('$', '_');
+
return result;
}