0

I'm having an issue compiling the guava branch of jung found here. The jung-visualization's PluggableRenderContext.java has a compile error. It appears this problem has come up before as visible by this Google search, but the link redirects to the jung GitHub repository.

I've cloned the GitHub repository to my local machine and then imported a Maven project into eclipse. When running with the goals "clean install" I get the following output when building jung-visualization.


[INFO] ------------------------------------------------------------------------
[INFO] Building jung-visualization 2.0.2-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ jung-visualization ---
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ jung-visualization ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /Users/eric/Documents/Development/java/git/jung/jung/jung-visualization/src/main/resources
[INFO] 
[INFO] --- maven-compiler-plugin:2.0:compile (default-compile) @ jung-visualization ---
Compiling 158 source files to /Users/eric/Documents/Development/java/git/jung/jung/jung-visualization/target/classes
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO] 
[INFO] jung2 .............................................. SUCCESS [  0.570 s]
[INFO] jung-api ........................................... SUCCESS [  2.159 s]
[INFO] jung-graph-impl .................................... SUCCESS [  2.148 s]
[INFO] jung-algorithms .................................... SUCCESS [  4.028 s]
[INFO] jung-io ............................................ SUCCESS [  3.369 s]
[INFO] jung-visualization ................................. FAILURE [  1.770 s]
[INFO] jung-samples ....................................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 14.192 s
[INFO] Finished at: 2015-08-16T23:59:57-04:00
[INFO] Final Memory: 62M/369M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.0:compile (default-compile) on project jung-visualization: Compilation failure: Compilation failure:
[ERROR] /Users/eric/Documents/Development/java/git/jung/jung/jung-visualization/src/main/java/edu/uci/ics/jung/visualization/PluggableRenderContext.java:[47,7] error: PluggableRenderContext is not abstract and does not override abstract method getEdgeShapeTransformer() in RenderContext
[ERROR] 
[ERROR] could not parse error message:   where V,E are type-variables:
[ERROR] V extends Object declared in class PluggableRenderContext
[ERROR] E extends Object declared in class PluggableRenderContext
[ERROR] /Users/eric/Documents/Development/java/git/jung/jung/jung-visualization/src/main/java/edu/uci/ics/jung/visualization/PluggableRenderContext.java:310: error: getEdgeShapeTransformer() in PluggableRenderContext cannot implement getEdgeShapeTransformer() in RenderContext
[ERROR] public Function<? super Context<Graph<V,E>,E>,Shape> getEdgeShapeTransformer() {
[ERROR] ^
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
[ERROR] 
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR]   mvn <goals> -rf :jung-visualization

Any help would be appreciated! Best regards, MCG.

eric.mcgregor
  • 3,507
  • 2
  • 16
  • 16

1 Answers1

0

It looks like there's a bug in the declaration of the Guava-fied RenderContext.java; instead of this:

Function<Context<Graph<V,E>,E>,Shape> getEdgeShapeTransformer();

it should be this:

Function<? super Context<Graph<V,E>,E>,Shape> getEdgeShapeTransformer();

so that the signatures are compatible.

Joshua O'Madadhain
  • 2,704
  • 1
  • 14
  • 18
  • Thanks Joshua. Jung-visualization now compiles. When compiling jung-samples, we get the following: [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.0:compile (default-compile) on project jung-samples: Compilation failure: Compilation failure: [ERROR] /Users/eric/Documents/Development/java/git/jung/jung/jung/jung-samples/src/main/java/edu/uci/ics/jung/samples/EdgeLabelDemo.java:[219,111] error: incompatible types: Function cannot be converted to AbstractEdgeShapeTransformer – eric.mcgregor Aug 18 '15 at 01:01
  • I imagine I've broken the EdgeLabelDemo sample, but commenting out lines 219-221 in EdgeLabelDemo.java allows jung-samples to compile. A correct fix would be of course be better. – eric.mcgregor Aug 18 '15 at 01:25
  • I did some refactoring of the edge -> Shape related code and everything compiles now; the changes are updated in the guava branch of the Github JUNG repository. Please LMK if you see any problems. Thanks for the report. – Joshua O'Madadhain Aug 30 '15 at 05:28