Anonymous classes with diamond, subexpression excludes bounds of type variable
Georgiy Rakov
georgiy.rakov at oracle.com
Tue Jun 2 17:37:32 UTC 2015
Hello,
new assertion for the new "anonymous classes with diamond" feature
specified in JDK-8073593
<https://bugs.openjdk.java.net/browse/JDK-8073593?focusedCommentId=13622110&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-13622110>
comment states:
The term "subexpression" includes type arguments of parameterized
types (4.5), bounds of wildcards (4.5.1), and element types of array
types (10.1). /_*It excludes bounds of type variables*_/.***
The part of assertion I'm interested in is emphasized above. Could you
please tell if you consider this part of assertion as testable and if
you do could you please provide the example of the code verifying this
assertion.
The example I can think out is presented below:
class Foo<T, U extends T> {...}
that is type variable U is bounded by type variable T which can be
inferred as a capture variable, inaccessible type or intersection type.
But if this happens instance creation of anonymous Foo class will still
result in compiler error because Foo will get parameterized by the
inferred type T (T is a Foo type variable besides the fact that it's a
bound of U).
Thank you,
Georgiy.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/compiler-dev/attachments/20150602/453f5ece/attachment.html>
More information about the compiler-dev
mailing list