JDK-8182649 : Unable to integrate due to compilation error
  • Type: Bug
  • Component: tools
  • Sub-Component: javac
  • Affected Version: 10
  • Priority: P2
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2017-06-21
  • Updated: 2017-07-06
  • Resolved: 2017-06-29
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 10
10 b14Fixed
Related Reports
Relates :  
Description
I've tried to integrate the latest changes from jdk10/jdk10 into jdk10/hs several times now, always ending up with the same problem:

/scratch/opt/jprt/T/P1/224118.jesper/s/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.word/src/org/graalvm/compiler/word/Word.java:719: error: reference to readWord is ambiguous
        return readWord(signed(offset), locationIdentity);
               ^
  both method <T#1>readWord(WordBase,LocationIdentity) in Word and method <T#2>readWord(int,LocationIdentity) in Word match
  where T#1,T#2 are type-variables:
    T#1 extends WordBase declared in method <T#1>readWord(WordBase,LocationIdentity)
    T#2 extends WordBase declared in method <T#2>readWord(int,LocationIdentity)
/scratch/opt/jprt/T/P1/224118.jesper/s/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.word/src/org/graalvm/compiler/word/Word.java:946: error: reference to readWord is ambiguous
        return readWord(signed(offset));
               ^
  both method <T#1>readWord(WordBase) in Word and method <T#2>readWord(int) in Word match
  where T#1,T#2 are type-variables:
    T#1 extends WordBase declared in method <T#1>readWord(WordBase)
    T#2 extends WordBase declared in method <T#2>readWord(int)
/scratch/opt/jprt/T/P1/224118.jesper/s/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.word/src/org/graalvm/compiler/word/Word.java:1119: error: reference to compareAndSwapWord is ambiguous
        return compareAndSwapWord(signed(offset), expectedValue, newValue, locationIdentity);
               ^
  both method <T#1>compareAndSwapWord(WordBase,T#1,T#1,LocationIdentity) in Word and method <T#2>compareAndSwapWord(int,T#2,T#2,LocationIdentity) in Word match
  where T#1,T#2 are type-variables:
    T#1 extends WordBase declared in method <T#1>compareAndSwapWord(WordBase,T#1,T#1,LocationIdentity)
    T#2 extends WordBase declared in method <T#2>compareAndSwapWord(int,T#2,T#2,LocationIdentity)
3 errors

A clean clone of jdk10/hs builds fine.

I have tried to replace the entire directory jdk.internal.vm.compiler with a copy from a clean 10/hs but still get the same error. For this reason I doubt the problem is in Graal. Vladimir Kozlov suggested that it might be a javac bug.
Comments
The workaround worked. I have now integrated jdk10/jdk10 to jdk10/hs.
22-06-2017

I'm lowering this to a P2. It is a serious compiler regression, but note that it can be worked around - in the above code you just need to add a cast: return readWord((WordBase)signed(10), "");
21-06-2017

Reduced test case: interface Signed { } interface WordBase { } class Test { <T extends Signed> T signed(int offset) { return null; } <T extends WordBase> T readWord(WordBase w,String s) { return null; } <T extends WordBase> T readWord(int i,String s) { return null; } <T extends WordBase> T test() { return readWord(signed(10), ""); } } This program works in 8, 9 but started to fail recently in 10.
21-06-2017