You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Performing runtime subtype checks with <:< sometimes fails on Java classes.
With this code
I get:
$ javac Test.java
$ scalac RunTest.scala
$ scala RunTest
Test <:< Test:true
----------------------------------------------
Test <:< Bar:illegal cyclic reference involving type T
----------------------------------------------
Bar <:< Test:illegal cyclic inheritance involving class Test
----------------------------------------------
Bar <:< Bar:true
----------------------------------------------
I tested Scala versions 2.10.6, 2.11.8 and 2.12.2, which all have the same problem. I'm using Java version 1.8.0_112.
Note that turning the lambda function in Test.java into an anonymous inner class solves the issue. There is an article on InfoQ with details about the differences between lambdas and anonymous inner classes, which might be relevant.
The bug also disappears when using
classRefType<TextendsRefType<?>> extendsBase {}
instead of
classRefType<TextendsRefType> extendsBase {}
This might also be related to #3809 , but -Ybreak-cycles during compilation can and does not help here.
Here are full stacktraces for Test <: Bar and Bar <: Test.
Note that oddly getLocalizedMessage for Bar <: Test also seems to be different from the stacktrace without any try/catch block, while it is identical in the Test <: Bar case.
The text was updated successfully, but these errors were encountered:
Performing runtime subtype checks with
<:<
sometimes fails on Java classes.With this code
I get:
I tested Scala versions
2.10.6
,2.11.8
and2.12.2
, which all have the same problem. I'm using Java version1.8.0_112
.Note that turning the lambda function in Test.java into an anonymous inner class solves the issue. There is an article on InfoQ with details about the differences between lambdas and anonymous inner classes, which might be relevant.
The bug also disappears when using
instead of
This might also be related to #3809 , but -Ybreak-cycles during compilation can and does not help here.
I ran into this bug, because of NodeWithThrownExceptions and MethodDeclaration in the current JavaParser release 3.2.3.
Here are full stacktraces for
Test <: Bar
andBar <: Test
.Note that oddly
getLocalizedMessage
forBar <: Test
also seems to be different from the stacktrace without any try/catch block, while it is identical in theTest <: Bar
case.The text was updated successfully, but these errors were encountered: