Compiler creates broken classfiles although errors are shown in output

Sven Reimers sven.reimers at gmail.com
Mon Feb 15 16:47:15 UTC 2016


Due to missing interface classfiles wrong contents is generated (not
illegal),  e. g. An instance of fails n case of missing transitive
interface which is ok if interface is available at compilation time.

It seems (I believe)  the exit code is 0..

If necessary I will try to get more details and slimmed down example code.

Thanks

-Sven
Am 15.02.2016 17:21 schrieb "Jonathan Gibbons" <jonathan.gibbons at oracle.com
>:

> What sort of "broken classfiles" are you seeing?
>
> What exit code from javac are you seeing?
>
> -- Jon
>
>
> On 02/15/2016 08:02 AM, Sven Reimers wrote:
>
> There is an example in here
>
>
> http://www.oracle.com/technetwork/java/javase/8-compatibility-guide-2156366.html
>
> Area: Tools / javac
>
> Synopsis
>
> Interfaces need to be present when compiling against their implementations
>
> Description
>
> When compiling a class against another class implementing an interface
> which is defined in yet another class file, such class file (where
> interface is defined) must be available in the class path used
> by javac during compilation. This is a new requirement as of JDK 8 - a
> failure to do so will result in a compilation error.
>
> Example:
>
> Client.java:
>
> import p1.A;
>
> class Client {
>
>    void test() {
>
>        new A.m();
>
>    }
>
> }
>
>
>
> p1/A.java:
>
> package p1;
>
> public class A implements I {
>
>    public void m() { }
>
> }
>
> p1/I.java:
>
> package p1;
>
> public interface I {
>
>    void m();
>
> }
>
>
>
> If neither p1/I.java nor p1/I.class are available when compiling
> Client.java, the following error will be displayed:
>
> Client.java: error: cannot access I
>
>        new A().m();
>
>             ^
>
>   class file for p1.I not found
>
>
> If this does not reproduce the problem, I will try to reduce our code
> sample
>
> Thanks
>
> Sven
>
>
> Hi Sven,
>
> Would you have a testcase on which this can be seen?
>
> Thanks,
>     Jan
>
> On 15.2.2016 15:34, Sven Reimers wrote:
>
> >
> > Hi,
> >
> > I just ran into https://bugs.openjdk.java.net/browse/JDK-8145208
> >
> > The main problem is not to fix the error,  but our continuous
> > integration is not creating breaking builds,  so the error can get
> > unnoticed into builds and fails at runtime.
> >
> > Any idea if this can be fixed in an upcoming jdk 8u release?
> >
> > Any idea how to make the build break in this case?
> >
> > Thanks for your help
> >
> > -Sven
> >
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/compiler-dev/attachments/20160215/1fe65f42/attachment.html>


More information about the compiler-dev mailing list