Note that there are some explanatory texts on larger screens.

plurals
  1. POImport-on-demand declaration with subpackages only
    primarykey
    data
    text
    <p>Related : <a href="https://stackoverflow.com/questions/878685/how-can-i-compile-import-pack-with-ant-javac-when-there-are-no-such-classes">How can I compile &quot;import pack.*&quot; with ant/javac, when there are no such classes?</a></p> <p>Suppose we have the given package structure</p> <pre><code>parent | ---a ---b </code></pre> <p>where the package <code>parent</code> only contains the two subpackges <code>a</code> and <code>b</code> (no class is under the package <code>parent</code>).</p> <p>The code <code>import parent.*</code>, situated in a package other than <code>parent</code>, compiled with Maven (i.e. <code>javac</code>) throws a compile-time error. The error is:</p> <blockquote> <p>package parent does not exist</p> </blockquote> <p>I looked into the Java Language Specification about such a case (import-on-demand declaration where no types are actually imported). <a href="https://docs.oracle.com/javase/specs/jls/se8/html/jls-7.html#jls-7.5.2" rel="nofollow noreferrer">Paragraph 7.5.2 of the JLS</a> about import-on-demand declaration does not seem to specify this behavior.</p> <p>Is this a bug of <code>javac</code>? I am not asking how to circumvent the compile error. I would like to know why <code>javac</code> throws an error because I cannot find any reference in the JLS that it should; leading me to believe that this might be a bug.</p> <p>I tested with JDK 1.4, 1.6, 1.7 and 1.8, the error is the same.</p> <p>As a side note, there is no compile error with the same code in Eclipse (tested with Eclipse Indigo, Juno, Luna and Mars).</p> <p>NB: I encountered this behaviour when "mavenizing" an (old) existing project that only relied on the Eclipse compiler. It took me a while to identify that this was the root cause of the compile error I was getting.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload