jigsaw vs. jsr166 CVS

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

jigsaw vs. jsr166 CVS

Martin Buchholz-3
Jigsawers:

I tried to use jigsaw EA with jsr166 CVS for the first time.

On a fresh jsr166 CVS checkout (http://g.oswego.edu/dl/concurrency-interest/), I did:
 ~/jsr166/jigsaw $ ant -v compile -Djdk9.home="$HOME/jdk/jigsaw-b80"

and got:

    [javac] /home/martin/jsr166/jigsaw/src/main/java/util/AbstractQueue.java:7: warning: package exists in another module: java.base
    [javac] package java.util;

and then more seriously

    [javac] /home/martin/jsr166/jigsaw/src/main/java/util/AbstractQueue.java:36: error: cannot find symbol
    [javac]     extends AbstractCollection<E>

I was surprised by that -- we don't fiddle with the boot environment here.  Is it not allowed to compile sources for which class files are in the same package but another module?  Alternatively, does the compile time environment need to include all the sources for the packages being compiled, i.e. do I need to add sourcepath for jdk/src/java.base/share/classes?

(Admittedly, developing jdk sources outside the jdk proper is a little bit unusual)

_______________________________________________
Concurrency-interest mailing list
[hidden email]
http://cs.oswego.edu/mailman/listinfo/concurrency-interest
Reply | Threaded
Open this post in threaded view
|

Re: jigsaw vs. jsr166 CVS

Martin Buchholz-3
I tried adding -Xoverride, but it didn't help.

--- build.xml 11 Sep 2015 18:43:46 -0000 1.177
+++ build.xml 11 Sep 2015 23:17:46 -0000
@@ -347,6 +347,7 @@
            fork="true">
 
       <include name="**/*.java"/>
+      <compilerarg value="-Xoverride:${src.dir}"/>
       <compilerarg value="-Xprefer:source"/>
       <compilerarg value="-XDignore.symbol.file=true"/>
       <compilerarg value="-Xlint:all"/>

I can see that the compiler is being invoked like this:
$ ant -v compile -Djdk9.home="$HOME/jdk/jigsaw-b80"
...
    [javac] Compilation arguments:
    [javac] '-d'
    [javac] '/home/martin/jsr166/jigsaw/build/classes'
    [javac] '-classpath'
    [javac] '/home/martin/jsr166/jigsaw/build/classes'
    [javac] '-sourcepath'
    [javac] '/home/martin/jsr166/jigsaw/src/main'
    [javac] '-g:source,lines,vars'
    [javac] '-Xoverride:/home/martin/jsr166/jigsaw/src/main'
    [javac] '-Xprefer:source'
    [javac] '-XDignore.symbol.file=true'
    [javac] '-Xlint:all'
    [javac] '-Werror'
    [javac] '-Xdoclint:all/protected'
    [javac] '-Xmaxerrs'
    [javac] '1000'
    [javac] '-Xmaxwarns'
    [javac] '1000'

Maybe the problem is that the there is *nothing but* overriding source files here.
Does javac check that its actual argument source files might be in the Xoverride tree?

Can/should we make jsr166 files itself a sub-module of java.base?
Certainly, here in jsr166-developer-land, we act as if it were so.
We have independent source trees, binary artifacts, etc... must be a module!?
(You might not allow carving up java.util along module boundaries, but the reality as reflected in the bug system is that java.util contains portions of several "modules")
(but oops ... circular dependencies ...)



On Fri, Sep 11, 2015 at 3:49 PM, Alex Buckley <[hidden email]> wrote:
Hi Martin,

javac is compiling your classes (in the unnamed module) against all the named modules in the image. One of those named modules (java.base) contains the java.util package, so your code (in the unnamed module) cannot also contain that package. [That's not quite true but go with it for now.]

What you want is the -Xoverride flag -- see the "Overriding module content" section of JEP 261. You'll have to rename 'main' to 'java.base'. Also note the open design issues around -Xoverride.

Alex


On 9/11/2015 1:51 PM, Martin Buchholz wrote:
Jigsawers:

I tried to use jigsaw EA with jsr166 CVS for the first time.

On a fresh jsr166 CVS checkout (http://g.oswego.edu/dl/concurrency-interest/),
I did:
  ~/jsr166/jigsaw $ ant -v compile -Djdk9.home="$HOME/jdk/jigsaw-b80"

and got:

     [javac]
/home/martin/jsr166/jigsaw/src/main/java/util/AbstractQueue.java:7:
warning: package exists in another module: java.base
     [javac] package java.util;

and then more seriously

     [javac]
/home/martin/jsr166/jigsaw/src/main/java/util/AbstractQueue.java:36: error:
cannot find symbol
     [javac]     extends AbstractCollection<E>

I was surprised by that -- we don't fiddle with the boot environment here.
Is it not allowed to compile sources for which class files are in the same
package but another module?  Alternatively, does the compile time
environment need to include all the sources for the packages being
compiled, i.e. do I need to add sourcepath for
jdk/src/java.base/share/classes?

(Admittedly, developing jdk sources outside the jdk proper is a little bit
unusual)



_______________________________________________
Concurrency-interest mailing list
[hidden email]
http://cs.oswego.edu/mailman/listinfo/concurrency-interest
Reply | Threaded
Open this post in threaded view
|

Re: jigsaw vs. jsr166 CVS

Alan Bateman

On 12/09/2015 00:30, Martin Buchholz wrote:
> I tried adding -Xoverride, but it didn't help.
>
You'll need to use javac -Xmodule:java.base to compile the classes, then
use -Xoverride at run-time. As it happens, there is an example that
compiles and uses an development version of CHM here:

   http://openjdk.java.net/projects/jigsaw/quick-start#xoverride

Hopefully it won't too much to get the build.xml to do this.

-Alan
_______________________________________________
Concurrency-interest mailing list
[hidden email]
http://cs.oswego.edu/mailman/listinfo/concurrency-interest
Reply | Threaded
Open this post in threaded view
|

Re: jigsaw vs. jsr166 CVS

Martin Buchholz-3
Alan, thanks for that pointer.  I succeeded at building jsr166 and running tests with it after beating ant into submission.

People *will* write code to distinguish between a pre-module and post-module JDK by inspecting the filesystem.
Here's one implementation in ant:

    <local name="modules"/>
    <condition property="modules">
      <available file="${jdk@{compile-target}.home}/jmods" type="dir"/>
    </condition>

Then we can have conditional ant code like this:

      <compilerarg value="-Xbootclasspath/p:@{classes}" unless:set="modules"/>
      <compilerarg value="-Xoverride:${build.classes.dir}" if:set="modules"/>

It's not just a matter of "porting to jigsaw".  There seems to be no way of deploying jsr166 CVS as a directly deployable software artifact as we have been doing with -Xbootclasspath/p.  To use -Xoverride, there must be an exploded directory.  It would be convenient if -Xoverride was usable with an equivalent jar file (jsr166.jar).  But y'all are trying to make module overriding possible, not convenient?!

javadoc does not seem to have any support for -Xmodule, so I don't know how to fix the "docs" target.

The fundamental disconnect is that from a developer point of view, jsr166 CVS contains an independently developed "module" with binary deployable artifacts, but jigsaw disagrees about its module-ness, and that can probably not be fixed because of circular dependencies between java.util.concurrent and the rest of java.base?


On Fri, Sep 11, 2015 at 9:47 PM, Alan Bateman <[hidden email]> wrote:

On 12/09/2015 00:30, Martin Buchholz wrote:
I tried adding -Xoverride, but it didn't help.

You'll need to use javac -Xmodule:java.base to compile the classes, then use -Xoverride at run-time. As it happens, there is an example that compiles and uses an development version of CHM here:

  http://openjdk.java.net/projects/jigsaw/quick-start#xoverride

Hopefully it won't too much to get the build.xml to do this.

-Alan


_______________________________________________
Concurrency-interest mailing list
[hidden email]
http://cs.oswego.edu/mailman/listinfo/concurrency-interest