From: Svjatoslav Agejenko Date: Sun, 24 Dec 2017 11:50:07 +0000 (+0200) Subject: Merge improvements by Tony Bargnesi: X-Git-Tag: javainspect-1.7~31 X-Git-Url: http://www2.svjatoslav.eu/gitweb/?p=javainspect.git;a=commitdiff_plain;h=3c997802712d8f3d243832840f20757f6e2567da;hp=ce6df6b5338782411858f9e41361a879296bab94 Merge improvements by Tony Bargnesi: https://github.com/abargnesi/javainspect --- diff --git a/doc/JavaInspect full project.png b/doc/JavaInspect full project.png index 2fb9b51..4d5ebba 100644 Binary files a/doc/JavaInspect full project.png and b/doc/JavaInspect full project.png differ diff --git a/doc/JavaInspect.png b/doc/JavaInspect.png index c4f94b1..625a2da 100644 Binary files a/doc/JavaInspect.png and b/doc/JavaInspect.png differ diff --git a/doc/example.png b/doc/example.png index 8dffd47..d773c31 100644 Binary files a/doc/example.png and b/doc/example.png differ diff --git a/doc/example.resized.png b/doc/example.resized.png index d5e9c42..2a06982 100644 Binary files a/doc/example.resized.png and b/doc/example.resized.png differ diff --git a/doc/index.html b/doc/index.html index 4c426bf..f011ad8 100644 --- a/doc/index.html +++ b/doc/index.html @@ -1,164 +1,202 @@ - - - + + JavaInspect - Utility to visualize java software - - - - + + + + + + + +" + - -
-

JavaInspect - Utility to visualize java software

- -
+
+

JavaInspect - Utility to visualize java software

+
-
  • other applications hosted at svjatoslav.eu +
  • other applications hosted at svjatoslav.eu
  • @@ -227,7 +265,7 @@ bitmap graph in PNG format. By default on your Desktop directory.

    -Note: GraphViz is developed and tested so far only on GNU Linux. +Note: GraphViz is developed and tested so far only on GNU/Linux.

    @@ -239,23 +277,23 @@ Note: GraphViz is developed and tested so far only on GNU Linux.
  • A very simple example: -
    -

    example.resized.png +

    +

    example.resized.png

    -
    +

    Graph legend:

    -
    -

    legend.png +

    +

    legend.png

    -
    +
  • -
  • Example visualization of Sixth project: architecture graphs. +
  • Example visualization of Sixth 3D project: architecture graphs.
  • @@ -405,7 +443,7 @@ Result:
    1. Download project Sixth code snapshot.
    2. -
    3. Inspect and run DataGraph.java. +
    4. Inspect and run *DataGraph.java*.
    @@ -425,7 +463,7 @@ Declare JavaInspect as dependency: <dependency> <groupId>eu.svjatoslav</groupId> <artifactId>javainspect</artifactId> - <version>1.5-SNAPSHOT</version> + <version>1.6</version> </dependency> ... </dependencies> @@ -470,13 +508,14 @@ On Ubuntu/Debian use:
    -

    6 TODO

    +

    6 TO DO

      -
    • BUG: Should not hide references if there are too many of them to -classes if referring classes are not visible anyway because of -blacklist/whitelist rules. Basically reference counting should -exclude not visible classes. +
    • BUG: Should not hide references if there are too many of them to classes if +referring classes are not visible anyway because of blacklist/whitelist rules. +Basically reference counting should exclude not visible classes. +
    • +
    • FEATURE: integarte with PlantUML.
    • FEATURE: add dark theme
    • @@ -504,12 +543,30 @@ project build/release process
    +
    +
    + diff --git a/doc/index.org b/doc/index.org index 9ee436a..6e0cbda 100644 --- a/doc/index.org +++ b/doc/index.org @@ -12,7 +12,17 @@ - Homepage: http://svjatoslav.eu - Email: mailto://svjatoslav@svjatoslav.eu -- [[http://svjatoslav.eu/programs.jsp][other applications hosted at svjatoslav.eu]] +- [[http://www.svjatoslav.eu/programs.jsp][other applications hosted at svjatoslav.eu]] + +* (document settings) :noexport: +** use dark style for TWBS-HTML exporter +#+HTML_HEAD: +#+HTML_HEAD: +#+HTML_HEAD: " +#+HTML_HEAD: * General Goal: simplify/speed up understanding the computer program code by @@ -41,7 +51,7 @@ unimportant parts, JavaInspect produces GraphViz dot file that describes data to be visualized. Then launches GraphViz to generate bitmap graph in PNG format. By default on your Desktop directory. -Note: GraphViz is developed and tested so far only on GNU Linux. +Note: GraphViz is developed and tested so far only on GNU/Linux. * Example graphs + A very simple example: @@ -52,7 +62,7 @@ Note: GraphViz is developed and tested so far only on GNU Linux. file:legend.png -+ Example visualization of [[http://www2.svjatoslav.eu/gitbrowse/sixth/doc/][Sixth]] project: [[http://www2.svjatoslav.eu/projects/sixth/codegraphs/][architecture graphs]]. ++ Example visualization of [[http://www2.svjatoslav.eu/gitbrowse/sixth-3d/doc/][Sixth 3D]] project: [[http://www2.svjatoslav.eu/gitbrowse/sixth-3d/doc/codeGraph/][architecture graphs]]. * Usage Currently the only way to control JavaInspect is by using Java @@ -154,7 +164,7 @@ Declare JavaInspect as dependency: eu.svjatoslav javainspect - 1.5-SNAPSHOT + 1.6 ... @@ -182,10 +192,10 @@ On Ubuntu/Debian use: sudo apt-get install graphviz #+END_SRC * TO DO -- BUG: Should not hide references if there are too many of them to - classes if referring classes are not visible anyway because of - blacklist/whitelist rules. Basically reference counting should - exclude not visible classes. +- BUG: Should not hide references if there are too many of them to classes if + referring classes are not visible anyway because of blacklist/whitelist rules. + Basically reference counting should exclude not visible classes. +- FEATURE: integarte with [[http://plantuml.com/class-diagram][PlantUML]]. - FEATURE: add dark theme - FEATURE: sort Class fields by alphabet - FEATURE: visualize also concrete field values so it could be used as diff --git a/doc/legend.png b/doc/legend.png index 91505a8..e206b4f 100644 Binary files a/doc/legend.png and b/doc/legend.png differ 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/pom.xml b/pom.xml index 51c135d..fbdb534 100644 --- a/pom.xml +++ b/pom.xml @@ -2,7 +2,7 @@ 4.0.0 eu.svjatoslav javainspect - 1.6-SNAPSHOT + 1.7-SNAPSHOT jar Java inspect Utility to visualize Java code @@ -59,6 +59,19 @@ + + org.apache.maven.plugins + maven-release-plugin + 2.5.2 + + + org.apache.maven.scm + maven-scm-provider-gitexe + 1.9.4 + + + + org.apache.maven.plugins maven-shade-plugin diff --git a/src/main/java/eu/svjatoslav/inspector/java/structure/ClassDescriptor.java b/src/main/java/eu/svjatoslav/inspector/java/structure/ClassDescriptor.java index c21761c..13d87b8 100755 --- a/src/main/java/eu/svjatoslav/inspector/java/structure/ClassDescriptor.java +++ b/src/main/java/eu/svjatoslav/inspector/java/structure/ClassDescriptor.java @@ -73,8 +73,13 @@ public class ClassDescriptor implements GraphElement, Comparable 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); } @@ -74,16 +74,17 @@ public class FieldDescriptor implements GraphElement { + "\", color=\"" + classDescriptor.getColor() + "\", style=\"bold\"];\n"); + if (type == null) return result.toString(); if (!type.isVisible()) return result.toString(); // 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,14 +104,14 @@ 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"); } else { result.append(" "); result.append(""); - result.append(type.getClassName(true) + ""); + result.append(describeType() + ""); result.append(""); result.append(name + "\n"); @@ -118,9 +119,14 @@ public class FieldDescriptor implements GraphElement { return result.toString(); } + private String describeType() { + if (type == null) return "-null-"; + return type.getClassName(true); + } + @Override public String getGraphId() { - return parentClass.getGraphId() + ":" + name; + return parentClassDescriptior.getGraphId() + ":" + name; } protected int getOutsideVisibleReferencesCount() { diff --git a/src/main/java/eu/svjatoslav/inspector/java/structure/MethodDescriptor.java b/src/main/java/eu/svjatoslav/inspector/java/structure/MethodDescriptor.java index d411cb0..1929348 100755 --- a/src/main/java/eu/svjatoslav/inspector/java/structure/MethodDescriptor.java +++ b/src/main/java/eu/svjatoslav/inspector/java/structure/MethodDescriptor.java @@ -98,8 +98,8 @@ public class MethodDescriptor implements GraphElement, + classDescriptor.getColor() + "\", style=\"dotted, bold\"];\n"); - if (!returnType.isVisible()) - return result.toString(); + if (returnType == null) return result.toString(); + if (!returnType.isVisible()) return result.toString(); // main type if (returnType.areReferencesShown()) @@ -121,7 +121,7 @@ public class MethodDescriptor implements GraphElement, result.append(" // " + methodName + "\n"); result.append(" " - + "" + returnType.getClassName(true) + + "" + describeReturnType() + "" + "" + getMethodLabel() + "\n"); @@ -129,6 +129,12 @@ public class MethodDescriptor implements GraphElement, return result.toString(); } + private String describeReturnType() { + if (returnType == null) return "-null-"; + + return returnType.getClassName(true); + } + @Override public String getGraphId() { return parentClass.getGraphId() + ":" + methodName; @@ -141,8 +147,9 @@ public class MethodDescriptor implements GraphElement, protected int getOutsideVisibleReferencesCount() { int result = 0; - if (returnType.isVisible()) - result++; + if (returnType != null) + if (returnType.isVisible()) + result++; for (final ClassDescriptor classDescriptor : argumentTypes) if (classDescriptor.isVisible()) diff --git a/src/main/java/eu/svjatoslav/inspector/java/structure/Utils.java b/src/main/java/eu/svjatoslav/inspector/java/structure/Utils.java index 41dc633..9f28ad1 100755 --- a/src/main/java/eu/svjatoslav/inspector/java/structure/Utils.java +++ b/src/main/java/eu/svjatoslav/inspector/java/structure/Utils.java @@ -96,7 +96,7 @@ public class Utils { lightColors.add("peachpuff2"); lightColors.add("seagreen1"); lightColors.add("violet"); - lightColors.add("aqua"); + lightColors.add("cyan"); lightColors.add("orange"); }