[ 
https://issues.apache.org/jira/browse/RATIS-703?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16947179#comment-16947179
 ] 

Henrik Hegardt edited comment on RATIS-703 at 10/8/19 9:09 PM:
---------------------------------------------------------------

You are right, the example I provided wasn't ambiguous, sorry about that.

I have changed to java version:
{code:java}
openjdk version "1.8.0_222"
OpenJDK Runtime Environment (AdoptOpenJDK)(build 1.8.0_222-b10)
OpenJDK 64-Bit Server VM (AdoptOpenJDK)(build 25.222-b10, mixed mode){code}
And they are still happening.
{code:java}
[ERROR] Tests run: 2, Failures: 1, Errors: 1, Skipped: 0, Time elapsed: 5.461 s 
<<< FAILURE! - in org.apache.ratis.grpc.TestInstallSnapshotNotificationWithGrpc
[ERROR] 
testAddNewFollowers(org.apache.ratis.grpc.TestInstallSnapshotNotificationWithGrpc)
 Time elapsed: 4.836 s <<< FAILURE!
java.lang.AssertionError: Is not notified as a leader
[ERROR] 
testRestartFollower(org.apache.ratis.grpc.TestInstallSnapshotNotificationWithGrpc)
 Time elapsed: 0.24 s <<< ERROR!
java.lang.Error: 
Unresolved compilation problem: 
 The method attempt(CheckedSupplier<Boolean,RuntimeException>, int, 
TimeDuration, String, Logger) is ambiguous for the type JavaUtils
{code}
I'm running the build from a shell and not from Eclipse, nor is eclipse started.

To be more precise the above errors are actually happening after the classes 
should have been compiled, the errors happens in the test phase.

This line in 
ratis-server/src/test/java/org/apache/ratis/InstallSnapshotNotificationTests on 
line 139 does return a boolean which at least Eclipse (which has a different 
compiler than the jdk) is complaining about.
{code:java}
JavaUtils.attempt(() -> 
snapshotFiles.stream().anyMatch(RaftSnapshotBaseTest::exists), 10, ONE_SECOND, 
"snapshotFile.exist", LOG);
{code}
I assume its the same error as the one that the error msg above represents.

I have attached an image what Eclipse is reporting. I know that Eclipse have 
another compiler and sometimes have a different idea of what's right, and 
unless I haven't gotten the above error I wouldn't have filed this issue.

Though applying the patch, neither errors are happening any more (I haven't run 
it that many times).

Since I have no good explanation, I have tried to read up on the issue and 
found this [https://bugs.openjdk.java.net/browse/JDK-8170361] which is a 
follow-up JEP on lambdas which might shed some light on the issue. But it 
should happen more frequently and not just for me.

For reference I'm running Eclipse with the above jdk as the project jdk.
{code:java}
Version: 2019-09 R (4.13.0)
Build id: 20190917-1200{code}


was (Author: hheg):
You are right, the example I provided wasn't ambiguous, sorry about that.

I have changed to java version:
{code:java}
openjdk version "1.8.0_222"
OpenJDK Runtime Environment (AdoptOpenJDK)(build 1.8.0_222-b10)
OpenJDK 64-Bit Server VM (AdoptOpenJDK)(build 25.222-b10, mixed mode){code}
And they are still happening.
{code:java}
[ERROR] Tests run: 2, Failures: 1, Errors: 1, Skipped: 0, Time elapsed: 5.461 s 
<<< FAILURE! - in org.apache.ratis.grpc.TestInstallSnapshotNotificationWithGrpc
[ERROR] 
testAddNewFollowers(org.apache.ratis.grpc.TestInstallSnapshotNotificationWithGrpc)
 Time elapsed: 4.836 s <<< FAILURE!
java.lang.AssertionError: Is not notified as a leader
[ERROR] 
testRestartFollower(org.apache.ratis.grpc.TestInstallSnapshotNotificationWithGrpc)
 Time elapsed: 0.24 s <<< ERROR!
java.lang.Error: 
Unresolved compilation problem: 
 The method attempt(CheckedSupplier<Boolean,RuntimeException>, int, 
TimeDuration, String, Logger) is ambiguous for the type JavaUtils
{code}
I'm running the build from a shell and not from Eclipse, nor is eclipse started.

To be more accurate the above errors are actually happening after the classes 
should have been compiled, the errors happens in the test phase.

This line in 
ratis-server/src/test/java/org/apache/ratis/InstallSnapshotNotificationTests on 
line 139 does return a boolean which at least Eclipse (which has a different 
compiler than the jdk) is complaining about.
{code:java}
JavaUtils.attempt(() -> 
snapshotFiles.stream().anyMatch(RaftSnapshotBaseTest::exists), 10, ONE_SECOND, 
"snapshotFile.exist", LOG);
{code}
I assume its the same error as the one that the error msg above represents.

I have attached an image what Eclipse is reporting. I know that Eclipse have 
another compiler and sometimes have a different idea of what's right, and 
unless I haven't gotten the above error I wouldn't have filed this issue.

Though applying the patch, neither errors are happening any more (I haven't run 
it that many times).

Since I have no good explanation, I have tried to read up on the issue and 
found this https://bugs.openjdk.java.net/browse/JDK-8170361 which is a 
follow-up JEP on lambdas which might shed some light on the issue. But it 
should happen more frequently and not just for me.

For reference I'm running Eclipse with the above jdk as the project jdk.
{code:java}
Version: 2019-09 R (4.13.0)
Build id: 20190917-1200{code}

> Intermittent ambiguous method reference
> ---------------------------------------
>
>                 Key: RATIS-703
>                 URL: https://issues.apache.org/jira/browse/RATIS-703
>             Project: Ratis
>          Issue Type: Bug
>            Reporter: Henrik Hegardt
>            Assignee: Henrik Hegardt
>            Priority: Major
>         Attachments: RATIS-703.00.patch, errors.png
>
>
> I'm getting intermittent ambiguous method reference compilation errors. It 
> seems like it's a real bug since the method is ambigious when the referenced 
> generic types have been ereased. Though I'm not sure why this is not always 
> failing, it should, but it's probably a bug in Javac. I'm running Eclipse and 
> it consistently complains about it.
> Output from Maven:
> [ERROR] 
> testRevertConfigurationChange(org.apache.ratis.server.simulation.TestRaftReconfigurationWithSimulatedRpc)
>  Time elapsed: 0.108 s <<< ERROR!
>  java.lang.Error: 
>  Unresolved compilation problems: 
>  The method attempt(CheckedSupplier<Boolean,RuntimeException>, int, 
> TimeDuration, String, Logger) is ambiguous for the type JavaUtils
>  The method attempt(CheckedSupplier<Boolean,RuntimeException>, int, 
> TimeDuration, String, Logger) is ambiguous for the type JavaUtils
> [INFO] Running 
> org.apache.ratis.server.simulation.TestServerRestartWithSimulatedRpc
>  [ERROR] Tests run: 5, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: 
> 4.013 s <<< FAILURE! - in 
> org.apache.ratis.server.simulation.TestServerRestartWithSimulatedRpc
>  [ERROR] 
> testRestartCommitIndex(org.apache.ratis.server.simulation.TestServerRestartWithSimulatedRpc)
>  Time elapsed: 0.081 s <<< ERROR!
>  java.lang.Error: 
>  Unresolved compilation problems: 
>  The method attempt(CheckedSupplier<Boolean,RuntimeException>, int, 
> TimeDuration, String, Logger) is ambiguous for the type JavaUtils
>  The method attempt(CheckedSupplier<Boolean,RuntimeException>, int, 
> TimeDuration, String, Logger) is ambiguous for the type JavaUtils
> [ERROR] 
> testRestartFollower(org.apache.ratis.server.simulation.TestServerRestartWithSimulatedRpc)
>  Time elapsed: 0.074 s <<< ERROR!
>  java.lang.Error: 
>  Unresolved compilation problem: 
>  The method attempt(CheckedSupplier<Boolean,RuntimeException>, int, 
> TimeDuration, String, Logger) is ambiguous for the type JavaUtils
> A fix (but ugly) would just to be to re arrange the arguments.
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to