<div dir="ltr">Ok so here is an example - copy and paste into a shell script, make javac available and run...<div><br></div><div>See the script / output for details.</div><div><br></div><div>Hope this helps<br><div><br></div><div>Sven</div><div><br></div><div>-------- snip here ---------</div><div><div>#!/bin/bash</div><div>mkdir interface</div><div>cat <<EOF >interface/I.java</div><div>public interface I {}</div><div>EOF</div><div><br></div><div>mkdir abstract</div><div>cat <<EOF >abstract/AImpl.java</div><div>public abstract class AImpl implements I {}</div><div>EOF</div><div><br></div><div>mkdir impl</div><div>cat <<EOF >impl/Impl.java</div><div>public class Impl extends AImpl {}</div><div>EOF</div><div><br></div><div>#Now create an AnnotationProcessor:</div><div><br></div><div>mkdir processor</div><div><br></div><div>cat <<EOF >processor/A.java</div><div>import javax.annotation.processing.*;</div><div>import java.util.Set;</div><div>import javax.lang.model.element.TypeElement;</div><div>import javax.lang.model.SourceVersion;</div><div><br></div><div>@SupportedSourceVersion(SourceVersion.RELEASE_8)</div><div>public class A extends AbstractProcessor {</div><div><br></div><div>  Â  Â  Â  @Override</div><div>  Â  Â  Â  public synchronized void init(ProcessingEnvironment env){ System.out.println("Init");}</div><div><br></div><div>  Â  Â  Â  @Override</div><div>  Â  Â  Â  public boolean process(Set<? extends TypeElement> annoations, RoundEnvironment env) { System.out.println("process");return true; }</div><div><br></div><div>}</div><div>EOF</div><div>mkdir processor/META-INF</div><div>mkdir processor/META-INF/services</div><div><br></div><div>cat <<EOF >processor/META-INF/services/javax.annotation.processing.Processor</div><div>A</div><div>EOF</div><div>#Now compile all of them to different directories:</div><div><br></div><div>mkdir build</div><div><br></div><div>mkdir build/interface</div><div>javac -d build/interface interface/I.java</div><div><br></div><div>mkdir build/abstract</div><div>javac -cp build/interface -d build/abstract abstract/AImpl.java</div><div><br></div><div>mkdir build/processor</div><div>javac -d build/processor processor/A.java</div><div>cp -r processor/META-INF build/processor</div><div><br></div><div>#Now try to compile Impl.java</div><div><br></div><div>mkdir build/impl-v1</div><div>echo Variant 1:</div><div>echo javac -cp build/abstract -d build/impl-v1 impl/Impl.java</div><div>javac -cp build/abstract -d build/impli-v1 impl/Impl.java</div><div>echo $?</div><div><br></div><div>#Fails due to missing interface class... exit code = 1</div><div><br></div><div>mkdir build/impl-v2</div><div>echo Variant 2</div><div>echo javac -cp build/abstract -processorpath build/processor -d build/impl-v2 impl/Impl.java</div><div>javac -cp build/abstract -processorpath build/processor -d build/impl-v2 impl/Impl.java</div><div>echo $?</div><div>ls -la build/impl-v2/Impl.class</div><div>#Does not fail due to missing interface class although output shows the problem... exit code = 0, class file generated but should not</div><div><br></div><div>mkdir build/impl-v3</div><div>echo Variant 3</div><div>echo javac -cp build/abstract:build/interface -processorpath build/processor -d build/impl-v3 impl/Impl.java</div><div>javac -cp build/abstract:build/interface -processorpath build/processor -d build/impl-v3 impl/Impl.java</div><div>echo $?</div><div>ls -la build/impl-v3/Impl.class</div><div><br></div><div>#Succeeds and good class file</div></div></div><div>-------- snip here ---------<br></div><div>---</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Feb 16, 2016 at 3:08 PM, Sven Reimers <span dir="ltr"><<a href="mailto:sven.reimers@gmail.com" target="_blank">sven.reimers@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><p dir="ltr">Hi Jan, </p>
<p dir="ltr">seems the problem is caused by using an annotation processor.. </p>
<p dir="ltr">It seems sufficient to have an annotation processor doing nothing to trigger the behaviour. </p>
<p dir="ltr">Will try to post an example, if you need one.. </p><span class="HOEnZb"><font color="#888888">
<p dir="ltr">-Sven </p>
</font></span><div class="gmail_quote"><span class="">Am 15.02.2016 20:03 schrieb "Jan Lahoda" <<a href="mailto:jan.lahoda@oracle.com" target="_blank">jan.lahoda@oracle.com</a>>:<br type="attribution"></span><div><div class="h5"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Sven,<br>
<br>
I tried the example with:<br>
$ javac -fullversion<br>
javac full version "1.8.0_40-b25"<br>
<br>
And it produced:<br>
$ javac  Client.java<br>
Client.java:7: error: cannot access I<br>
  Â  Â  Â new A().m();<br>
  Â  Â  Â  Â  Â  Â  ^<br>
  class file for p1.I not found<br>
1 error<br>
<br>
No classfile was written.<br>
<br>
With:<br>
$ javac -fullversion<br>
javac full version "1.7.0_45-b35"<br>
<br>
$ javac  Client.java<br>
<br>
produced no errors, and written a (correct as far as I can tell) classfile (equivalent to a classfile written when I.class is available).<br>
<br>
Do you have a testcase where javac produces an error, but writes an (incorrect) classfile?<br>
<br>
Thanks,<br>
  Â  Jan<br>
<br>
On 15.2.2016 17:02, Sven Reimers wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
There is an example in here<br>
<br>
<a href="http://www.oracle.com/technetwork/java/javase/8-compatibility-guide-2156366.html" rel="noreferrer" target="_blank">http://www.oracle.com/technetwork/java/javase/8-compatibility-guide-2156366.html</a><br>
<br>
Area: Tools / javac<br>
<br>
Synopsis<br>
<br>
Interfaces need to be present when compiling against their implementations<br>
<br>
Description<br>
<br>
When compiling a class against another class implementing an interface<br>
which is defined in yet another class file, such class file (where<br>
interface is defined) must be available in the class path used<br>
by javac during compilation. This is a new requirement as of JDK 8 - a<br>
failure to do so will result in a compilation error.<br>
<br>
Example:<br>
<br>
Client.java:<br>
<br>
import p1.A;<br>
<br>
class Client {<br>
<br>
  Â  void test() {<br>
<br>
  Â  Â  Â  new A.m();<br>
<br>
  Â  }<br>
<br>
}<br>
<br>
p1/A.java:<br>
<br>
package p1;<br>
<br>
public class A implements I {<br>
<br>
  Â  public void m() { }<br>
<br>
}<br>
<br>
p1/I.java:<br>
<br>
package p1;<br>
<br>
public interface I {<br>
<br>
  Â  void m();<br>
<br>
}<br>
<br>
If neither p1/I.java nor p1/I.class are available when compiling<br>
Client.java, the following error will be displayed:<br>
<br>
Client.java: error: cannot access I<br>
<br>
  Â  Â  Â  new A().m();<br>
<br>
  Â  Â  Â  Â  Â  Â ^<br>
<br>
  Â class file for p1.I not found<br>
<br>
<br>
If this does not reproduce the problem, I will try to reduce our code sample<br>
<br>
Thanks<br>
<br>
Sven<br>
<br>
<br>
Hi Sven,<br>
<br>
Would you have a testcase on which this can be seen?<br>
<br>
Thanks,<br>
  Â  Â Jan<br>
<br>
On 15.2.2016 15:34, Sven Reimers wrote:<br>
<br>
  Â  Â ><br>
  Â  Â > Hi,<br>
  Â  Â ><br>
  Â  Â > I just ran intohttps://<a href="http://bugs.openjdk.java.net/browse/JDK-8145208" rel="noreferrer" target="_blank">bugs.openjdk.java.net/browse/JDK-8145208</a><br>
  Â  <<a href="https://bugs.openjdk.java.net/browse/JDK-8145208" rel="noreferrer" target="_blank">https://bugs.openjdk.java.net/browse/JDK-8145208</a>><br>
  Â  Â ><br>
  Â  Â > The main problem is not to fix the error,  but our continuous<br>
  Â  Â > integration is not creating breaking builds,  so the error can get<br>
  Â  Â > unnoticed into builds and fails at runtime.<br>
  Â  Â ><br>
  Â  Â > Any idea if this can be fixed in an upcoming jdk 8u release?<br>
  Â  Â ><br>
  Â  Â > Any idea how to make the build break in this case?<br>
  Â  Â ><br>
  Â  Â > Thanks for your help<br>
  Â  Â ><br>
  Â  Â > -Sven<br>
  Â  Â ><br>
<br>
</blockquote>
</blockquote></div></div></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div>Sven Reimers<br><br>* Senior Expert Software Architect</div><div>* Java Champion<br>* NetBeans Dream Team Member: <a href="http://dreamteam.netbeans.org" target="_blank">http://dreamteam.netbeans.org</a><br>* Community Leader  NetBeans: <a href="http://community.java.net/netbeans" target="_blank">http://community.java.net/netbeans</a><br>  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Desktop Java: <a href="http://community.java.net/javadesktop" target="_blank">http://community.java.net/javadesktop</a><br></div>* JUG Leader JUG Bodensee: <a href="http://www.jug-bodensee.de" target="_blank">http://www.jug-bodensee.de</a><br><div>* Duke's Choice Award Winner 2009<br>* Blog: <a href="https://www.java.net//blog/sven" target="_blank">https://www.java.net//blog/sven</a><br><br>* XING: <a href="https://www.xing.com/profile/Sven_Reimers8" target="_blank">https://www.xing.com/profile/Sven_Reimers8</a><br>* LinkedIn: <a href="http://www.linkedin.com/in/svenreimers" target="_blank">http://www.linkedin.com/in/svenreimers</a><br><br>Join the NetBeans Groups:<br>* XING: <a href="http://www.xing.com/group-20148.82db20" target="_blank">http://www.xing.com/group-20148.82db20</a><br>* NUGM: <a href="http://haug-server.dyndns.org/display/NUGM/Home" target="_blank">http://haug-server.dyndns.org/display/NUGM/Home</a><br>* LinkedIn: <a href="http://www.linkedin.com/groups?gid=1860468" target="_blank">http://www.linkedin.com/groups?gid=1860468</a><br>  Â  Â  Â  Â  Â  Â  Â  Â Â  <a href="http://www.linkedin.com/groups?gid=107402" target="_blank">http://www.linkedin.com/groups?gid=107402</a><br>  Â  Â  Â  Â  Â  Â  Â  Â Â  <a href="http://www.linkedin.com/groups?gid=1684717" target="_blank">http://www.linkedin.com/groups?gid=1684717</a><br>* Oracle: <a href="https://mix.oracle.com/groups/18497" target="_blank">https://mix.oracle.com/groups/18497</a></div></div></div></div></div>
</div>