-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9478 from retronym/ticket/12038-cyclic-found-refl…
…ection Fix cylic error in runtime reflection (protobuf)
- Loading branch information
Showing
7 changed files
with
54 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[BuilderType <: p1.J_1.AbstractMessageLite.Builder[BuilderType]]Object { | ||
def <init>(): p1.J_1.AbstractMessageLite[BuilderType] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package p1; | ||
|
||
public class J_1 { | ||
public abstract static class AbstractMessageLite< | ||
BuilderType extends AbstractMessageLite.Builder<BuilderType>> { | ||
|
||
public abstract static class Builder<BuilderType extends Builder<BuilderType>>{ | ||
|
||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
object Test { | ||
def main(args: Array[String]): Unit = { | ||
import reflect.runtime.universe._ | ||
val m = scala.reflect.runtime.currentMirror | ||
println(m.staticClass("p1.J_1.AbstractMessageLite").info.toString) // was cyclic error | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
(x$1: p1.J_1.O[Object]#$I[String])Unit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package p1; | ||
|
||
public class J_1 { | ||
public static abstract class O<A> { | ||
// non static, runtime reflection should use the generic owner type | ||
// in the type signature below. | ||
// | ||
// also doing for static inner classes runs into cyclic errors (see t12038a.scala) | ||
// in the current implementation of runtime reflection. | ||
// | ||
// This is fine as Java rejects the type selections in `notValidJava` below with: | ||
// | ||
// "cannot select a static class from a parameterized type" | ||
public abstract class I<B extends A> {} | ||
|
||
public abstract static class J<B> {} | ||
} | ||
static void test(O<Object>.I<String> oi) {} | ||
|
||
// static void notValidJava(O<Object>.J<String> oj) {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
object Test { | ||
def main(args: Array[String]): Unit = { | ||
import reflect.runtime.universe._ | ||
val m = scala.reflect.runtime.currentMirror | ||
println(m.staticClass("p1.J_1").companion.info.decl(TermName("test")).asMethod.info.toString) | ||
} | ||
} |