Unable to compile Jenkins itself with compilation level set to Java 8

30 views
Skip to first unread message

Marcin Zajączkowski

unread,
Feb 3, 2017, 7:46:41 AM2/3/17
to Jenkins Developers
Hi,

I was playing with the issue related to searchable nested views [1] and it turned out that the implementation would be much easier with Java 8's default methods in interfaces. Unfortunately after switching compiler in Maven configuration to Java 8 the compilation fails with quite complex looking generics related error:

<code>
[INFO] --- maven-compiler-plugin:3.0:compile (default-compile) @ jenkins-core ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1046 source files to /home/foo/code/jenkins/core/target/classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /home/foo/code/jenkins/core/src/main/java/hudson/model/User.java:[658,22] error: method fromJobs in class RunList<R#2> cannot be applied to given types;
[ERROR]   required: Iterable<? extends J#1>
  found: Iterable<Job>
  reason: inferred type does not conform to lower bound(s)
    inferred: J#2
    lower bound(s): T,Job
  where J#1,R#1,R#2,J#2,R#3,T are type-variables:
    J#1 extends Job<J#1,R#1> declared in method <J#1,R#1>fromJobs(Iterable<? extends J#1>)
    R#1 extends Run<J#1,R#1> declared in method <J#1,R#1>fromJobs(Iterable<? extends J#1>)
    R#2 extends Run declared in class RunList
    J#2 extends Job<J#2,R#3>
    R#3 extends Run<J#2,R#3>
    T extends J#2
/home/foo/code/jenkins/core/src/main/java/hudson/model/Computer.java:[781,22] error: method fromJobs in class RunList<R#2> cannot be applied to given types;
[INFO] 2 errors
</code>

I wonder if it is a known issue or maybe even anyone gave a look at it already?

Changes in the configuration triggering that error are available in my branch [2] (just in case :) ).

[1] - https://groups.google.com/forum/#!topic/jenkinsci-dev/GTjiXQkN4Fs
[2] - https://github.com/szpak/jenkins/tree/feature/searchableNestedViews

Marcin

--
http://blog.solidsoft.info - Solid Soft - Working code is not enough

Marcin Zajączkowski

unread,
Mar 13, 2017, 8:25:06 AM3/13/17
to Jenkins Developers
I created an issue for that: https://issues.jenkins-ci.org/browse/JENKINS-42709\

Marcin

Marcin Zajączkowski

unread,
Mar 13, 2017, 8:25:36 AM3/13/17
to Jenkins Developers


On Monday, March 13, 2017 at 1:25:06 PM UTC+1, Marcin Zajączkowski wrote:
Reply all
Reply to author
Forward
0 new messages