From: Svjatoslav Agejenko Date: Wed, 19 Apr 2017 19:48:36 +0000 (+0300) Subject: Better variable names. X-Git-Tag: javainspect-1.6~3 X-Git-Url: http://www2.svjatoslav.eu/gitweb/?a=commitdiff_plain;h=fa90e6506de0c6c93a087a6edbb52a378b5cded1;p=javainspect.git Better variable names. --- diff --git a/javainspect.iml b/javainspect.iml index 9036949..ea566de 100644 --- a/javainspect.iml +++ b/javainspect.iml @@ -1,6 +1,6 @@ - + diff --git a/src/main/java/eu/svjatoslav/inspector/java/structure/FieldDescriptor.java b/src/main/java/eu/svjatoslav/inspector/java/structure/FieldDescriptor.java index 59f93fc..b6de871 100755 --- a/src/main/java/eu/svjatoslav/inspector/java/structure/FieldDescriptor.java +++ b/src/main/java/eu/svjatoslav/inspector/java/structure/FieldDescriptor.java @@ -1,6 +1,6 @@ /* * 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 @@ -21,35 +21,35 @@ import java.util.List; public class FieldDescriptor implements GraphElement { - private final ClassDescriptor parentClass; + private final ClassDescriptor parentClassDescriptior; private final List typeArguments = new ArrayList(); private String name; private ClassDescriptor type; private boolean isInherited; public FieldDescriptor(final ClassDescriptor parent) { - parentClass = parent; + parentClassDescriptior = parent; } public void analyzeField(final Field field) { if (!field.getDeclaringClass().getName() - .equals(parentClass.getFullyQualifiedName())) + .equals(parentClassDescriptior.getFullyQualifiedName())) isInherited = true; name = field.getName(); - type = parentClass.getClassGraph().getOrCreateClassDescriptor( + type = parentClassDescriptior.getClassGraph().getOrCreateClassDescriptor( field.getType()); type.registerReference(); - final Type genericType = field.getGenericType(); - if (genericType instanceof ParameterizedType) { - final ParameterizedType pt = (ParameterizedType) genericType; - for (final Type t : pt.getActualTypeArguments()) - if (t instanceof Class) { - final Class cl = (Class) t; - final ClassDescriptor genericTypeDescriptor = parentClass - .getClassGraph().getOrCreateClassDescriptor(cl); + final Type fieldGenericType = field.getGenericType(); + if (fieldGenericType instanceof ParameterizedType) { + final ParameterizedType fieldParameterizedGenericType = (ParameterizedType) fieldGenericType; + for (final Type type : fieldParameterizedGenericType.getActualTypeArguments()) + if (type instanceof Class) { + final Class aClass = (Class) type; + final ClassDescriptor genericTypeDescriptor = parentClassDescriptior + .getClassGraph().getOrCreateClassDescriptor(aClass); genericTypeDescriptor.registerReference(); typeArguments.add(genericTypeDescriptor); } @@ -80,10 +80,10 @@ public class FieldDescriptor implements GraphElement { // main type boolean showLink = type.areReferencesShown(); - if (type == parentClass) + if (type == parentClassDescriptior) showLink = false; - if (parentClass.isEnum) + if (parentClassDescriptior.isEnum) showLink = false; if (showLink) @@ -103,7 +103,7 @@ public class FieldDescriptor implements GraphElement { final StringBuffer result = new StringBuffer(); result.append(" // " + name + "\n"); - if (parentClass.isEnum && (type == parentClass)) { + if (parentClassDescriptior.isEnum && (type == parentClassDescriptior)) { result.append(" "); result.append(name + "\n"); @@ -120,7 +120,7 @@ public class FieldDescriptor implements GraphElement { @Override public String getGraphId() { - return parentClass.getGraphId() + ":" + name; + return parentClassDescriptior.getGraphId() + ":" + name; } protected int getOutsideVisibleReferencesCount() {