hg: valhalla/valhalla/langtools: Add experimental support for generic class literals

Paul Benedict pbenedict at apache.org
Mon Aug 18 14:22:41 UTC 2014


I do find it interesting the specialization is activated by the
parametrized type, not the class itself. I suppose you could do something
like MyClass<any X, Y> where only some parameters are specialized, but not
quite sure why you would. Bikeshedding: could this hint at the keyword
should really belong at the class level than the type level?


Cheers,
Paul


On Mon, Aug 18, 2014 at 9:07 AM, Maurizio Cimadamore <
maurizio.cimadamore at oracle.com> wrote:

>
> On 18/08/14 14:51, Paul Benedict wrote:
>
> Just asking so I can understand.... are specialized classes fully
> reifiable?
>
> Yeah - stuff like Box<int> is considered to be fully reified, as the
> specializer will turn it into a specialized Box${T=int} version where all
> references to the type-variables have been replaced with their 'I'
> counterparts. This means you can lift all restrictions that apply to
> reified types, such as no array creation, no instance of, unchecked cast
> only, no class literals.
>
> Maurizio
>
>
>
> Cheers,
> Paul
>
>
> On Mon, Aug 18, 2014 at 8:29 AM, <maurizio.cimadamore at oracle.com> wrote:
>
>> Changeset: 459f251550d5
>> Author:    mcimadamore
>> Date:      2014-08-18 14:25 +0100
>> URL:
>> http://hg.openjdk.java.net/valhalla/valhalla/langtools/rev/459f251550d5
>>
>> Add experimental support for generic class literals
>> *) Now fully specialized classes literals are allowed with no warnings.
>> *) Specializable but not reifiable class literals are allowed with
>> warnings.
>> *) Non-specializable class literals rejected.
>> *) Add new tests
>>
>> ! src/share/classes/com/sun/tools/javac/comp/Attr.java
>> ! src/share/classes/com/sun/tools/javac/comp/Lower.java
>> ! src/share/classes/com/sun/tools/javac/comp/SpecializeTypes.java
>> ! src/share/classes/com/sun/tools/javac/jvm/Gen.java
>> ! src/share/classes/com/sun/tools/javac/parser/JavacParser.java
>> ! src/share/classes/com/sun/tools/javac/resources/compiler.properties
>> ! src/share/classes/com/sun/tools/javac/tree/JCTree.java
>> + test/tools/javac/diags/examples/IllegalGenericTypeForClassLit.java
>> + test/tools/javac/diags/examples/UncheckedGenericClassLit.java
>> ! test/tools/javac/failover/CheckAttributedTree.java
>> + test/tools/javac/valhalla/typespec/ClassLiterals01.java
>> + test/tools/javac/valhalla/typespec/ClassLiterals01.out
>> ! test/tools/javac/valhalla/typespec/items/Opcodes.java
>> + test/tools/javac/valhalla/typespec/items/tests/TestClassLit.java
>>
>>
>
>


More information about the valhalla-dev mailing list