The introduction of Sequenced collections is not a source compatible change

Joe Darcy joe.darcy at oracle.com
Wed May 17 16:08:54 UTC 2023


On 5/17/2023 7:07 AM, Ethan McCue wrote:
> > if they have setup their projects correctly.
>
> Can you be more clear about what "setup their projects correctly" 
> means? If you are referring to usage of --release, you seem to be 
> making a pretty strong argument that this will not be the case.
>

Use of "javac --release $OLD ..." rather than "javac -source $OLD 
-target $OLD ..." avoids certain categories of false compatibility problems.

In brief, " -source $OLD -target $OLD " alone doesn't set the 
bootclasspath equivalent to the libraries on the old release, meaning 
the compiled code can use newer methods in the core libraries, such as a 
new overload or a new  covariant override of an existing method. Those 
new methods do not exist when actually running against the old release.

That above situation doesn't happen all the time, but happened often 
enough to generate a steady trickle of bug reports before --release was 
introduced. To avoid this, --release also sets the bootclasspath 
equivalent to the older value.

HTH,

-Joe



More information about the core-libs-dev mailing list