hg: valhalla/valhalla: 8222784: [lworld] Remove stale compiler options: -XDallowGenericsOverValues and -XDdisallowValueConstructors

forax at univ-mlv.fr forax at univ-mlv.fr
Sat Apr 20 12:06:27 UTC 2019


ok,
i've found only one another one, with

import java.util.stream.IntStream;

public @__value__ class StreamBug {
  final int value;
  
  public StreamBug(int value) {
    this.value = value;
  }
  
  public static void main(String[] args) {
    //var bug = new StreamBug?(7);
    
    IntStream.range(0, 10).mapToObj(StreamBug::new).forEach(System.out::println);
  }
}

in mapToObj(), it should be StreamBug?::new which doesn't compile, which also means that new StreamBug?(7) should be valid.

but i don't think it's the right solution, i think the inference as to be smarter and infers that when you capture a value type to a type variable, the nullable version has to be inferred automatically.

Rémi

----- Mail original -----
> De: "Srikanth" <srikanth.adayapalam at oracle.com>
> À: "Remi Forax" <forax at univ-mlv.fr>
> Cc: "valhalla-dev" <valhalla-dev at openjdk.java.net>
> Envoyé: Samedi 20 Avril 2019 13:44:22
> Objet: Re: hg: valhalla/valhalla: 8222784: [lworld] Remove stale compiler options: -XDallowGenericsOverValues and
> -XDdisallowValueConstructors

> Hi Remi,
> 
> Thanks for the test cases, I will take a look at these and see how
> straightforward the fixes will be.
> If necessary I can revert the withdrawal - do send me other cases as you
> iterate over your examples
> 
> Thanks!
> Srikanth
> 
> On 20/04/19 3:53 PM, Remi Forax wrote:
>> Hum,
>> i think you have been a little too fast on removing -XDallowGenericsOverValues,
>> there are still a lot of constructions that doesn't support the null projection.
>>
>> - you can not use '?' in 'implements Comparable<Foo?>' so the following code
>> doesn't compile
>>    public @__value__ class Foo implements Comparable<Foo?>{
>>      final int value;
>>    
>>      public Foo(int value) {
>>        this.value = value;
>>      }
>>
>>      @Override
>>      public int compareTo(Foo? o) {
>>        return Integer.compare(value, foo.value);
>>      }
>>   }
>>
>> - lambda with wildcard doesn't work
>>    import java.util.function.Consumer;
>>
>>    public @__value__ class CaptureBug {
>>      final int value;
>>    
>>      public CaptureBug(int value) {
>>        this.value = value;
>>      }
>>    
>>      private static void accept(Consumer<? super CaptureBug?> consumer) {
>>        consumer.accept(new CaptureBug(3));
>>      }
>>    
>>      public static void main(String[] args) {
>>        accept(value -> System.out.println(value));
>>      }
>>    }
>>
>> - .class notation is not supported
>>    public class DotClass {
>>      final int value;
>>    
>>      public DotClass(int value) {
>>        this.value = value;
>>      }
>>    
>>      private static <T> T foo(Class<T> type) {
>>        return null;
>>      }
>>    
>>      public static void main(String[] args) {
>>        foo(DotClass?.class);
>>      }
>>    }
>>
>>
>> I'm sure they are other cases, i will iterate over all my examples later this
>> week end.
>>
>> Rémi
>>
>> ----- Mail original -----
>>> De: "Srikanth" <srikanth.adayapalam at oracle.com>
>>> À: "valhalla-dev" <valhalla-dev at openjdk.java.net>
>>> Envoyé: Samedi 20 Avril 2019 07:38:21
>>> Objet: Re: hg: valhalla/valhalla: 8222784: [lworld] Remove stale compiler
>>> options: -XDallowGenericsOverValues and
>>> -XDdisallowValueConstructors
>>> I have removed the support for these two internal experimental options:
>>>
>>> (1) -XDdisallowValueConstructors: We have settled on value instance
>>> construction using the canonial construction syntax via new ().
>>>
>>> (2) -XDallowGenericsOverValues: Use the null projection type instead (V?)
>>>
>>> Here is a summary of current internal options: Of these the last two are
>>> supposed to be transitory. If you are the concerned contributor, let me
>>> know as soon as these can be withdrawn.
>>>
>>> -XDallowWithFieldOperator
>>> -XDallowValueBasedClasses
>>> -XDallowEmptyValues
>>> -XDnonCovariantValueArrays
>>> -XDallowValueMemberCycles
>>>
>>> Thanks!
>>> Srikanth
>>>
>>> On 20/04/19 11:04 AM, srikanth.adayapalam at oracle.com wrote:
>>>> Changeset: 49898238a5bb
>>>> Author:    sadayapalam
>>>> Date:      2019-04-20 11:04 +0530
>>>> URL:       http://hg.openjdk.java.net/valhalla/valhalla/rev/49898238a5bb
>>>>
>>>> 8222784: [lworld] Remove stale compiler options: -XDallowGenericsOverValues and
>>>> -XDdisallowValueConstructors
>>>>
>>>> ! src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java
>>>> ! src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java
>>>> !
>>>> src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties
>>>> ! test/langtools/tools/javac/diags/examples.not-yet.txt
>>>> ! test/langtools/tools/javac/valhalla/lworld-values/BoxValCastTest.java
>>>> ! test/langtools/tools/javac/valhalla/lworld-values/BoxValCastTest2.java
>>>> ! test/langtools/tools/javac/valhalla/lworld-values/CheckFinal.java
>>>> ! test/langtools/tools/javac/valhalla/lworld-values/CheckFinal.out
>>>> !
>>>> test/langtools/tools/javac/valhalla/lworld-values/CheckValueFactoryWithReference.java
>>>> !
>>>> test/langtools/tools/javac/valhalla/lworld-values/CheckValueFactoryWithReference.out
>>>> !
>>>> test/langtools/tools/javac/valhalla/lworld-values/InferredValueParameterizationTest.java
>>>> ! test/langtools/tools/javac/valhalla/lworld-values/ValueConstructorRef.java
>>>> ! test/langtools/tools/javac/valhalla/lworld-values/ValueOverGenericsTest.java
>>>> - test/langtools/tools/javac/valhalla/lworld-values/ValueOverGenericsTest2.out
> >>> ! test/langtools/tools/javac/valhalla/lworld-values/ValuesAsRefs.java



More information about the valhalla-dev mailing list