How to compile code calling unexpected classes to an older release?
Keimpe Bronkhorst
keimpe.bronkhorst at oracle.com
Fri Oct 28 17:29:10 UTC 2016
Joe,
I don't understand this, doesn't this make "-release 8" useless for any
code base that uses an internal JDK API, which is likely most production
code bases. For instance, the Windows PLAF classes are often used:
import com.sun.java.swing.plaf.windows.WindowsComboBoxUI;
class t1 { public static void main(String[] args) { } }
this will compile fine with either:
<jdk8_path>/javac t1.java
<jdk9_path>/javac --add-exports
java.desktop/com.sun.java.swing.plaf.windows=ALL-UNNAMED t1.java
but not with either of:
<jdk9_path>/javac --release 8 t1.java
<jdk9_path>/javac --release 8 --add-exports
java.desktop/com.sun.java.swing.plaf.windows=ALL-UNNAMED t1.java
Keimpe Bronkhorst
JDeveloper Team
On 10/27/2016 2:42 PM, compiler-dev-request at openjdk.java.net wrote:
> Message: 3
> Date: Thu, 27 Oct 2016 08:59:30 -0700
> From: joe darcy <joe.darcy at oracle.com>
> To: compiler-dev at openjdk.java.net
> Subject: Re: How to compile code calling unexpected classes to an
> older release?
> Message-ID: <ab2dcc37-9d49-b108-3c8b-26a862208749 at oracle.com>
> Content-Type: text/plain; charset=utf-8; format=flowed
>
> On 10/27/2016 2:14 AM, Claes Redestad wrote:
>> Hi,
>>
>> "-XDignore.symbol.file -source 8 -target 8" can get your code to
>> compile (add -nowarn or set a valid bootclasspath to get rid of the
>> warning).
>>
>> So, it seems --release 8 has issues with internal classes not visible
>> to javac in 9?
> By design, --release 8 does not expose internal classes :-)
>
> -Joe
>
>
More information about the compiler-dev
mailing list