hg: lambda/lambda/langtools: Enhancement: Add support for more aggressive type-inference
Mike Duigou
mike.duigou at oracle.com
Mon Aug 6 11:22:07 PDT 2012
On Aug 6 2012, at 11:15 , Andrew Hughes wrote:
> ----- Original Message -----
>> To further highlight what Erik said:
>>
>> javac handles lint -Werror differently depending on wether the file
>> is being compiled explicitly or implicitly. Files which are being
>> compiled because they are referenced by explicitly compiled files
>> will not generate warnings or cause -Werror to stop the compilation.
>>
>> In incremental compilation situations this can result in surprising
>> failures because some files containing warnings were compiled
>> implicitly in a full build.
>>
>> There's been suggestions to treat warnings in implicit and explicit
>> files the same (which would certainly break the current build) and
>> also to allow disabling of implicit compilation (which would also
>> break the current build). Both of these would eventually help avoid
>> introducing unrecognized warnings in the future but require that the
>> warnings cleanup be complete in order to be usable.
>>
>
> That definitely sounds like the right way to go to me, as having random
> errors appearing because a file just happens to have not been compiled
> on this build, but was on the previous one, is very confusing.
>
> I'd say -Werror should be turned on in one central place and not by default.
> Those who want to catch such errors can build with it on, without it affecting
> general users just building OpenJDK and others not interested in fixing warnings
> right at this moment. This is how other FOSS projects I've seen handle it.
>
> The same goes for -Xlint:all and other options. Having different options for
> different sets of files makes things confusing and really hard to maintain.
The current mix of settings is transitional. As directories are made warnings free the -Werror and -Xlint options are turned on so that warnings don't creep back in. Having a single setting is definitely the goal and good progress is being made towards that goal. Inevitably, not quickly enough, but it will get there.
Mike
>> Mike
>>
>> On Aug 6 2012, at 04:03 , Erik Joelsson wrote:
>>
>>> We haven't addressed the problem of applying the correct warning
>>> levels on the java compilation yet. Hopefully we will be able to
>>> readd the correct -Xlint flags to an approximation of the correct
>>> set of source files. This is tricky because of implicit
>>> compilation and the old build suffers from this too.
>>>
>>> /Erik
>>>
>>> On 2012-08-03 19:06, Maurizio Cimadamore wrote:
>>>> Not sure what happened here - when building the lambda repository
>>>> using the new build, I do not get errors in certain files -
>>>> either those files are not being compiled, or the -Xlint flag is
>>>> not passed to the compiler.
>>>>
>>>> Maurizio
>>>>
>>>>
>>>> -------- Original Message --------
>>>> Subject: Re: hg: lambda/lambda/langtools: Enhancement: Add
>>>> support for more aggressive type-inference
>>>> Date: Fri, 03 Aug 2012 15:27:45 +0100
>>>> From: Maurizio Cimadamore <maurizio.cimadamore at oracle.com>
>>>> Organization: Oracle
>>>> To: Henri Gomez <henri.gomez at gmail.com>
>>>> CC: lambda-dev at openjdk.java.net
>>>>
>>>>
>>>>
>>>> On 03/08/12 15:11, Maurizio Cimadamore wrote:
>>>>> Good catch - the compiler now catches more 'redundant casts' as a
>>>>> side-effect of a change I made... I will correct this (and other
>>>>> issues)
>>>>> asap
>>>> Interesting - this is not caught by the new build system (the one
>>>> I used
>>>> to check that everything was ok)...
>>>>
>>>> Maurizio
>>>>> Maurizio
>>>>>
>>>>> On 03/08/12 14:11, Henri Gomez wrote:
>>>>>> Everything has been commited ?
>>>>>>
>>>>>> Got following build error :
>>>>>>
>>>>>> ../../../../src/share/classes/sun/security/x509/CertParseError.java
>>>>>> # Running javac: 150 files; in
>>>>>> /Users/henri/Documents/jenkins/data/jobs/openjdk-jdk8-lambda/workspace/jdk/make/sun/security/other
>>>>>> /Library/Java/JavaVirtualMachines/1.7.0u6.jdk/Contents/Home/bin/java
>>>>>> -XX:-PrintVMOptions -XX:+UnlockDiagnosticVMOptions
>>>>>> -XX:-LogVMOutput
>>>>>> -Djava.awt.headless=true -Xmx512m -Xms512m -XX:PermSize=32m
>>>>>> -XX:MaxPermSize=160m
>>>>>> -Xbootclasspath/p:/Users/henri/Documents/jenkins/data/jobs/openjdk-jdk8-lambda/workspace/build/macosx-x86_64/langtools/dist/bootstrap/lib/javac.jar
>>>>>> -jar
>>>>>> /Users/henri/Documents/jenkins/data/jobs/openjdk-jdk8-lambda/workspace/build/macosx-x86_64/langtools/dist/bootstrap/lib/javac.jar
>>>>>> -Werror -Xlint:all,-deprecation -Xlint:all -Xlint:-path -source
>>>>>> 8
>>>>>> -target 8 -encoding ascii
>>>>>> -Xbootclasspath:/Users/henri/Documents/jenkins/data/jobs/openjdk-jdk8-lambda/workspace/build/macosx-x86_64/classes
>>>>>> -sourcepath
>>>>>> /Users/henri/Documents/jenkins/data/jobs/openjdk-jdk8-lambda/workspace/build/macosx-x86_64/gensrc:::/Users/henri/Documents/jenkins/data/jobs/openjdk-jdk8-lambda/workspace/jdk/src/macosx/classes:/Users/henri/Documents/jenkins/data/jobs/openjdk-jdk8-lambda/workspace/jdk/src/solaris/classes:/Users/henri/Documents/jenkins/data/jobs/openjdk-jdk8-lambda/workspace/jdk/src/share/classes
>>>>>> -d
>>>>>> /Users/henri/Documents/jenkins/data/jobs/openjdk-jdk8-lambda/workspace/build/macosx-x86_64/classes
>>>>>> @/Users/henri/Documents/jenkins/data/jobs/openjdk-jdk8-lambda/workspace/build/macosx-x86_64/tmp/sun/sun.security.other/.classes.list.filtered
>>>>>> ../../../../src/share/classes/sun/security/provider/certpath/PKIX.java:252:
>>>>>> warning: [cast] redundant cast to Collection<? extends
>>>>>> Certificate>
>>>>>> (Collection<? extends Certificate>)
>>>>>> ^
>>>>>> error: warnings found and -Werror specified
>>>>>> Note: Some input files use or override a deprecated API.
>>>>>> Note: Recompile with -Xlint:deprecation for details.
>>>>>> 1 error
>>>>>> 1 warning
>>>>>> make[5]: *** [.compile.classlist] Error 1
>>>>>> make[4]: *** [all] Error 1
>>>>>> make[3]: *** [all] Error 1
>>>>>> make[2]: *** [all] Error 1
>>>>>> make[1]: *** [jdk-build] Error 2
>>>>>>
>>>>>>
>>>>>> 2012/8/3 <maurizio.cimadamore at oracle.com>:
>>>>>>> Changeset: 56419f06ad92
>>>>>>> Author: mcimadamore
>>>>>>> Date: 2012-08-03 12:48 +0100
>>>>>>> URL:
>>>>>>> http://hg.openjdk.java.net/lambda/lambda/langtools/rev/56419f06ad92
>>>>>>>
>>>>>>> Enhancement: Add support for more aggressive type-inference
>>>>>>>
>>>>>>> Experimental aggressive inference support can be enabled using
>>>>>>> the flag -XDuseGraphInference.
>>>>>>> The new inferencer (disabled by default) solves a number of
>>>>>>> outstanding problems in the legacy JDK 5/6/7 type-inferencer
>>>>>>> (which means it is also slightly backwards incompatible).
>>>>>>>
>>>>>>> Examples:
>>>>>>>
>>>>>>> *) Foo<Number> fn = new Foo<>(1);
>>>>>>>
>>>>>>> *) Set<String> ss = listInt.map(x->x.toString()).into(new
>>>>>>> HashSet<>);
>>>>>>>
>>>>>>> *) <Z> void call(SAM<Z> x, SAM<Z> y) { ... }
>>>>>>> call(() -> Collections.emptyList(), () -> new
>>>>>>> ArrayList<String>());
>>>>>>>
>>>>>>> Misc fixes:
>>>>>>> *) remove unused class in com/sun/runtime
>>>>>>> *) fix build.properties to generate right amount of stubs
>>>>>>> *) fix regression tests failures triggered when running against
>>>>>>> lambda binary snapshot
>>>>>>>
>>>>>>> ! make/build.properties
>>>>>>> - src/share/classes/com/sun/runtime/DefenderMethod.java
>>>>>>> ! src/share/classes/com/sun/tools/javac/code/Source.java
>>>>>>> ! src/share/classes/com/sun/tools/javac/code/Symtab.java
>>>>>>> ! src/share/classes/com/sun/tools/javac/code/Type.java
>>>>>>> ! src/share/classes/com/sun/tools/javac/code/Types.java
>>>>>>> ! src/share/classes/com/sun/tools/javac/comp/Attr.java
>>>>>>> ! src/share/classes/com/sun/tools/javac/comp/Check.java
>>>>>>> ! src/share/classes/com/sun/tools/javac/comp/DeferredAttr.java
>>>>>>> + src/share/classes/com/sun/tools/javac/comp/GraphInfer.java
>>>>>>> ! src/share/classes/com/sun/tools/javac/comp/Infer.java
>>>>>>> + src/share/classes/com/sun/tools/javac/comp/InferFactory.java
>>>>>>> + src/share/classes/com/sun/tools/javac/comp/LegacyInfer.java
>>>>>>> ! src/share/classes/com/sun/tools/javac/comp/Resolve.java
>>>>>>> !
>>>>>>> src/share/classes/com/sun/tools/javac/resources/compiler.properties
>>>>>>> ! src/share/classes/com/sun/tools/javac/util/List.java
>>>>>>> ! test/tools/javac/6758789/T6758789b.out
>>>>>>> ! test/tools/javac/Diagnostics/6722234/T6722234b_1.out
>>>>>>> ! test/tools/javac/Diagnostics/6722234/T6722234b_2.out
>>>>>>> ! test/tools/javac/Diagnostics/6799605/T6799605.out
>>>>>>> ! test/tools/javac/api/TestJavacTaskScanner.java
>>>>>>> ! test/tools/javac/cast/7123100/T7123100a.out
>>>>>>> ! test/tools/javac/defender/Pos01.java
>>>>>>> ! test/tools/javac/diags/examples.not-yet.txt
>>>>>>> ! test/tools/javac/diags/examples/CantApplyDiamond1.java
>>>>>>> +
>>>>>>> test/tools/javac/diags/examples/IncompatibleEqUpperBounds.java
>>>>>>> ! test/tools/javac/diags/examples/IncompatibleTypes1.java
>>>>>>> +
>>>>>>> test/tools/javac/diags/examples/InferNoConformingAssignment.java
>>>>>>> -
>>>>>>> test/tools/javac/diags/examples/InferredDoNotConformToBounds.java
>>>>>>> + test/tools/javac/diags/examples/InferredDoNotConformToEq.java
>>>>>>> +
>>>>>>> test/tools/javac/diags/examples/InferredDoNotConformToLower.java
>>>>>>> +
>>>>>>> test/tools/javac/diags/examples/InferredDoNotConformToUpper.java
>>>>>>> ! test/tools/javac/diags/examples/WhereCaptured.java
>>>>>>> ! test/tools/javac/diags/examples/WhereCaptured1.java
>>>>>>> ! test/tools/javac/generics/7015430/T7015430.out
>>>>>>> ! test/tools/javac/generics/7151802/T7151802.out
>>>>>>> ! test/tools/javac/generics/diamond/neg/Neg06.out
>>>>>>> ! test/tools/javac/generics/diamond/neg/Neg07.out
>>>>>>> ! test/tools/javac/generics/diamond/neg/Neg10.java
>>>>>>> ! test/tools/javac/generics/diamond/neg/Neg10.out
>>>>>>> ! test/tools/javac/generics/inference/6315770/T6315770.out
>>>>>>> ! test/tools/javac/generics/inference/6611449/T6611449.out
>>>>>>> ! test/tools/javac/generics/inference/6638712/T6638712b.out
>>>>>>> ! test/tools/javac/generics/inference/6638712/T6638712d.out
>>>>>>> ! test/tools/javac/generics/inference/6638712/T6638712e.out
>>>>>>> ! test/tools/javac/generics/inference/6650759/T6650759m.out
>>>>>>> ! test/tools/javac/generics/inference/7086601/T7086601a.out
>>>>>>> ! test/tools/javac/lambda/TargetType10.java
>>>>>>> ! test/tools/javac/lambda/TargetType10.out
>>>>>>> ! test/tools/javac/lambda/TargetType20.java
>>>>>>> ! test/tools/javac/lambda/TargetType20.out
>>>>>>> ! test/tools/javac/multicatch/Neg07.out
>>>>>>>
>>>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>
>>
>
> --
> Andrew :)
>
> Free Java Software Engineer
> Red Hat, Inc. (http://www.redhat.com)
>
> PGP Key: 248BDC07 (https://keys.indymedia.org/)
> Fingerprint = EC5A 1F5E C0AD 1D15 8F1F 8F91 3B96 A578 248B DC07
>
More information about the build-infra-dev
mailing list