{"id":2642,"date":"2015-09-18T21:00:22","date_gmt":"2015-09-18T21:00:22","guid":{"rendered":"http:\/\/www.garysieling.com\/blog\/?p=2642"},"modified":"2015-09-18T21:00:22","modified_gmt":"2015-09-18T21:00:22","slug":"fixing-scala-type-errors-in-gradle-incompatible-types-inference-variable-e-has-incompatible-bounds-cannot-infer-type-variable","status":"publish","type":"post","link":"https:\/\/www.garysieling.com\/blog\/fixing-scala-type-errors-in-gradle-incompatible-types-inference-variable-e-has-incompatible-bounds-cannot-infer-type-variable\/","title":{"rendered":"Fixing scala type errors in gradle (&#8220;incompatible types: inference variable E has incompatible bounds&#8221; + &#8220;cannot infer type-variable&#8221;)"},"content":{"rendered":"<p>I experienced an error, where gradle failed to build some Scala code using the ZincCompiler, with a Java 8 JDK:<\/p>\n<pre>\nFAILURE: Build failed with an exception.\n  (cannot infer type-variable(s) K#1,V#1\n  (actual and formal argument lists differ in length))\n\nerror: incompatible types: inference variable E has incompatible bounds\n<\/pre>\n<p>This error can be caused by having an older java in the JAVA_HOME, e.g.:<\/p>\n<pre>\nC:\\Program Files (x86)\\Java\\jdk1.8.0_25\n<\/pre>\n<p>The fix for me was to update to:<\/p>\n<pre>\nC:\\Program Files\\Java\\jdk1.8.0_60\n<\/pre>\n<p>If you run &#8220;java -version&#8221; and &#8220;javac -version&#8221; and they don&#8217;t match, you may have multiple paths to java in $PATH. <\/p>\n<p>The best thing is to have this at the front:<\/p>\n<pre>\n%JAVA_HOME%\/bin\n<\/pre>\n<p>Note that you may additionally have symlinks to java in one or both of these locations, in addition to things you&#8217;ve added:<\/p>\n<pre>\nc:\\windows\nc:\\ProgramData\\Oracle\\Java\\\n<\/pre>\n<p>For more information, this appears to match this issue with the ZincCompiler:<br \/>\n<a href=\"https:\/\/github.com\/typesafehub\/zinc\/issues\/82\">https:\/\/github.com\/typesafehub\/zinc\/issues\/82<\/a><\/p>\n<p>If this doesn&#8217;t resolve the issue, and you know that your build works on some other machine, you can run &#8220;gradlew -d [task]&#8221; to get verbose output, and compare them.<\/p>\n<p>You&#8217;ll see a section like this, which shows the classpath, all the paths on your machine, etc, which should help figure out what the difference is:<\/p>\n<pre>\n Compiling with Zinc Scala compiler.\n\n Setup = {\n    scala compiler = ...\n    scala library = ...\n    scala extra = {\n       ...\n    }\n\n    sbt interface = ...\n    compiler interface sources = ...\n    java home = C:\\Program Files (x86)\\Java\\jdk1.8.0_25\n    fork java = true\n    cache directory = C:\\Users\\gsieling\\.zinc\\0.3.7\n }\n Inputs = {\n    classpath = {\n       ...\n    }\n    sources = {\n       ...\n    }\n  }\n    output directory = ...\n    scalac options = {\n       -deprecation\n       -unchecked\n       -feature\n    }\n    javac options = {\n       -d\n         ...\n       -g\n       -encoding\n       UTF-8\n       -XDuseUnsharedTable=true\n    }\n    cache file = ...\n    analysis map = {\n       ...\n    }\n    force clean = false\n    java only = false\n    compile order = Mixed\n    incremental compiler options = {\n       transitive step = 3\n       recompile all fraction = 0.5\n       debug relations = false\n       debug api = false\n       api dump = \n       api diff context size = 5\n       transactional = false\n       backup directory = \n       recompile on macro def = true\n       name hashing = true\n    }\n    output relations = \n    output products = \n }\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>I experienced an error, where gradle failed to build some Scala code using the ZincCompiler, with a Java 8 JDK: FAILURE: Build failed with an exception. (cannot infer type-variable(s) K#1,V#1 (actual and formal argument lists differ in length)) error: incompatible types: inference variable E has incompatible bounds This error can be caused by having an &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.garysieling.com\/blog\/fixing-scala-type-errors-in-gradle-incompatible-types-inference-variable-e-has-incompatible-bounds-cannot-infer-type-variable\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Fixing scala type errors in gradle (&#8220;incompatible types: inference variable E has incompatible bounds&#8221; + &#8220;cannot infer type-variable&#8221;)&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[9],"tags":[258,300,480],"aioseo_notices":[],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/posts\/2642"}],"collection":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/comments?post=2642"}],"version-history":[{"count":0,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/posts\/2642\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/media?parent=2642"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/categories?post=2642"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/tags?post=2642"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}