You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@harmony.apache.org by Wayne Beaton <wa...@eclipse.org> on 2007/04/25 00:27:49 UTC

Eclipse doesn't find harmony sources

When you add a JRE to Eclipse, it scans the JRE's directory for JAR files.
For each JAR file it finds, it looks for corresponding source. It does so by
climbing up the containment hierarchy looking for a file named "src.jar" or
"src.zip" (if you're curious, see
org.eclipse.jdt.internal.launching.StandardVMType#getDefaultSystemLibrarySou
rce()).

Harmony JDK doesn't store is source this way (it seems to include the
sources alongside the JAR files), so Eclipse doesn't find it (which means
that if, for example, you browse the class java.lang.String, you get a
"can't find the source" message in your editor).

Is there a special reason why Harmony sources are represented the way they
are? Is there any way to bundle 'em all up into a src.zip file? 

In a related question, I'm not sure that putting them in the "jre" directory
is the right approach. I tend to think of the JRE directory as containing
*only* the JRE (i.e. I could yank it out and use it as a JRE) and the
sources--being part of the JDK--are outside of that directory.

I also can't find the source for kernel.jar. Where is Object.java,
Class.java, etc.?

I can understand why you'd want to have the sources in different files.
Eclipse handles J9 specially. It's probably time to generalize it's
implementation to handle arbitrary source configurations (perhaps via
extension point).

Wayne
--
Wayne Beaton
The Eclipse Foundation
wayne.beaton@eclipse.org
Skype, YIM: waynebeaton
http://www.eclipse.org
http://wbeaton.blogspot.com/
http://www.planeteclipse.org/planet/


Re: Eclipse doesn't find harmony sources

Posted by Tim Ellison <t....@gmail.com>.
Wayne Beaton wrote:
> When you add a JRE to Eclipse, it scans the JRE's directory for JAR files.
> For each JAR file it finds, it looks for corresponding source. It does so by
> climbing up the containment hierarchy looking for a file named "src.jar" or
> "src.zip" (if you're curious, see
> org.eclipse.jdt.internal.launching.StandardVMType#getDefaultSystemLibrarySou
> rce()).
> 
> Harmony JDK doesn't store is source this way (it seems to include the
> sources alongside the JAR files), so Eclipse doesn't find it (which means
> that if, for example, you browse the class java.lang.String, you get a
> "can't find the source" message in your editor).
> 
> Is there a special reason why Harmony sources are represented the way they
> are? Is there any way to bundle 'em all up into a src.zip file? 

While they /could/ be packaged any way we choose, Harmony's modular
architecture splits JSE into these chunks, and we use that to support
modular development.

I'm actually surprised that Eclipse finds all the class file JARs, since
we do not have the standard rt.jar layout either.  I wrote a plug-in for
Eclipse that defines the Harmony libraries, with associated source JARs
as a new JDT VM type.  You can see the source rooted here [1], and get
the plug-in here [2].  (Yes, we did discuss creating an update site for
Apache's plug-ins, but it never got off the ground for various reasons.)

[1] http://svn.apache.org/viewvc/harmony/enhanced/tools/trunk/eclipse/
[2]
http://svn.apache.org/viewvc/harmony/enhanced/tools/trunk/eclipse/org.apache.harmony.eclipse.site/plugins/org.apache.harmony.eclipse.jdt.launching_1.0.2.jar?revision=476395


> In a related question, I'm not sure that putting them in the "jre" directory
> is the right approach. I tend to think of the JRE directory as containing
> *only* the JRE (i.e. I could yank it out and use it as a JRE) and the
> sources--being part of the JDK--are outside of that directory.

Yeah, I can go either way on that -- some prefer the source to be
alongside the binaries, others the way you describe.

> I also can't find the source for kernel.jar. Where is Object.java,
> Class.java, etc.?

As Nathan said, they are provided by the VM implementer, so in some
cases you may not have the source for those types (i.e. where the vendor
chooses not to make source available).  For DRLVM, of course, the source
will be available and if it is not that is an oversight.

Just to confuse matters further, the binaries and source for those types
are kept in jre/bin/<vm_dir> since we have the ability to support
multiple VMs in a single install.  The JARs in jre/lib/boot are only
compile-time stubs, so you don't want to debug through them (that is not
the code that is running!)

The JDT VM-type plug-in for Harmony defines the set of libraries
properly so you get to see the correct set in the IDE.

> I can understand why you'd want to have the sources in different files.
> Eclipse handles J9 specially. It's probably time to generalize it's
> implementation to handle arbitrary source configurations (perhaps via
> extension point).

There is already a piece of work underway at Eclipse to do that
  https://bugs.eclipse.org/bugs/show_bug.cgi?id=181026

Regards,
Tim


Re: Eclipse doesn't find harmony sources

Posted by Alexei Zakharov <al...@gmail.com>.
Thanks. FYI HARMONY-3764 was created to track this. The fix just was
committed, so now we should have src-jars for all jars generated by
the build. Actually only sources for kernel classes make sense.
However, I decided to leave other src-jars (for gc_cc, gc_gen and
hythr, with simple stub helpers) for consistency. Hope I didn't break
anything.

Regards,

2007/4/26, Nathan Beyer <nd...@apache.org>:
> On 4/25/07, Alexei Zakharov <al...@gmail.com> wrote:
> > > > I also can't find the source for kernel.jar. Where is Object.java,
> > > > Class.java, etc.?
> >
> > > Good question. There maybe a missing step here in our build scripts.
> > > All of the other source JARs are part of the "classlib" build, but
> > > kernel.jar is produced (implemented) by the VM, so this would be part
> > > of the "drlvm" build. I'll look into this one.
> >
> > I'm currently fixing various issues in DRLVM build. So I think I can
> > also handle this one too since I'm in context. However, if you want to
> > do it by yourself please go ahead.
>
> Sure, go ahead, you'll probably get to it much faster than I.
> -Nathan
>
> >
> > With Best Regards,
> >
> > 2007/4/25, Nathan Beyer <nd...@apache.org>:
> > > On 4/24/07, Wayne Beaton <wa...@eclipse.org> wrote:
> > > > When you add a JRE to Eclipse, it scans the JRE's directory for JAR files.
> > > > For each JAR file it finds, it looks for corresponding source. It does so by
> > > > climbing up the containment hierarchy looking for a file named "src.jar" or
> > > > "src.zip" (if you're curious, see
> > > > org.eclipse.jdt.internal.launching.StandardVMType#getDefaultSystemLibrarySou
> > > > rce()).
> > > >
> > > > Harmony JDK doesn't store is source this way (it seems to include the
> > > > sources alongside the JAR files), so Eclipse doesn't find it (which means
> > > > that if, for example, you browse the class java.lang.String, you get a
> > > > "can't find the source" message in your editor).
> > > >
> > > > Is there a special reason why Harmony sources are represented the way they
> > > > are? Is there any way to bundle 'em all up into a src.zip file?
> > >
> > > No special reason, that I know of. Personally, I would consider the
> > > JRE's source bundling to be the odd ball (Eclipse source distribution
> > > is also a little weird and a personal pain point, but that's another
> > > story). I would consider packaging sources the way Harmony does a
> > > defacto standard; every JAR has a companion source JAR. In fact build
> > > systems like Maven default to this practice.
> > >
> > > >
> > > > In a related question, I'm not sure that putting them in the "jre" directory
> > > > is the right approach. I tend to think of the JRE directory as containing
> > > > *only* the JRE (i.e. I could yank it out and use it as a JRE) and the
> > > > sources--being part of the JDK--are outside of that directory.
> > > >
> > > > I also can't find the source for kernel.jar. Where is Object.java,
> > > > Class.java, etc.?
> > > >
> > >
> > > Good question. There maybe a missing step here in our build scripts.
> > > All of the other source JARs are part of the "classlib" build, but
> > > kernel.jar is produced (implemented) by the VM, so this would be part
> > > of the "drlvm" build. I'll look into this one.
> > >
> > > > I can understand why you'd want to have the sources in different files.
> > > > Eclipse handles J9 specially. It's probably time to generalize it's
> > > > implementation to handle arbitrary source configurations (perhaps via
> > > > extension point).
> > >
> > > Yes please!
> > >
> > > >
> > > > Wayne
> > > > --
> > > > Wayne Beaton
> > > > The Eclipse Foundation
> > > > wayne.beaton@eclipse.org
> > > > Skype, YIM: waynebeaton
> > > > http://www.eclipse.org
> > > > http://wbeaton.blogspot.com/
> > > > http://www.planeteclipse.org/planet/


-- 
Alexei Zakharov,
Intel ESSD

Re: Eclipse doesn't find harmony sources

Posted by Nathan Beyer <nd...@apache.org>.
On 4/25/07, Alexei Zakharov <al...@gmail.com> wrote:
> > > I also can't find the source for kernel.jar. Where is Object.java,
> > > Class.java, etc.?
>
> > Good question. There maybe a missing step here in our build scripts.
> > All of the other source JARs are part of the "classlib" build, but
> > kernel.jar is produced (implemented) by the VM, so this would be part
> > of the "drlvm" build. I'll look into this one.
>
> I'm currently fixing various issues in DRLVM build. So I think I can
> also handle this one too since I'm in context. However, if you want to
> do it by yourself please go ahead.

Sure, go ahead, you'll probably get to it much faster than I.
-Nathan

>
> With Best Regards,
>
> 2007/4/25, Nathan Beyer <nd...@apache.org>:
> > On 4/24/07, Wayne Beaton <wa...@eclipse.org> wrote:
> > > When you add a JRE to Eclipse, it scans the JRE's directory for JAR files.
> > > For each JAR file it finds, it looks for corresponding source. It does so by
> > > climbing up the containment hierarchy looking for a file named "src.jar" or
> > > "src.zip" (if you're curious, see
> > > org.eclipse.jdt.internal.launching.StandardVMType#getDefaultSystemLibrarySou
> > > rce()).
> > >
> > > Harmony JDK doesn't store is source this way (it seems to include the
> > > sources alongside the JAR files), so Eclipse doesn't find it (which means
> > > that if, for example, you browse the class java.lang.String, you get a
> > > "can't find the source" message in your editor).
> > >
> > > Is there a special reason why Harmony sources are represented the way they
> > > are? Is there any way to bundle 'em all up into a src.zip file?
> >
> > No special reason, that I know of. Personally, I would consider the
> > JRE's source bundling to be the odd ball (Eclipse source distribution
> > is also a little weird and a personal pain point, but that's another
> > story). I would consider packaging sources the way Harmony does a
> > defacto standard; every JAR has a companion source JAR. In fact build
> > systems like Maven default to this practice.
> >
> > >
> > > In a related question, I'm not sure that putting them in the "jre" directory
> > > is the right approach. I tend to think of the JRE directory as containing
> > > *only* the JRE (i.e. I could yank it out and use it as a JRE) and the
> > > sources--being part of the JDK--are outside of that directory.
> > >
> > > I also can't find the source for kernel.jar. Where is Object.java,
> > > Class.java, etc.?
> > >
> >
> > Good question. There maybe a missing step here in our build scripts.
> > All of the other source JARs are part of the "classlib" build, but
> > kernel.jar is produced (implemented) by the VM, so this would be part
> > of the "drlvm" build. I'll look into this one.
> >
> > > I can understand why you'd want to have the sources in different files.
> > > Eclipse handles J9 specially. It's probably time to generalize it's
> > > implementation to handle arbitrary source configurations (perhaps via
> > > extension point).
> >
> > Yes please!
> >
> > >
> > > Wayne
> > > --
> > > Wayne Beaton
> > > The Eclipse Foundation
> > > wayne.beaton@eclipse.org
> > > Skype, YIM: waynebeaton
> > > http://www.eclipse.org
> > > http://wbeaton.blogspot.com/
> > > http://www.planeteclipse.org/planet/
>
> --
> Alexei Zakharov,
> Intel ESSD
>

Re: Eclipse doesn't find harmony sources

Posted by Alexei Zakharov <al...@gmail.com>.
> > I also can't find the source for kernel.jar. Where is Object.java,
> > Class.java, etc.?

> Good question. There maybe a missing step here in our build scripts.
> All of the other source JARs are part of the "classlib" build, but
> kernel.jar is produced (implemented) by the VM, so this would be part
> of the "drlvm" build. I'll look into this one.

I'm currently fixing various issues in DRLVM build. So I think I can
also handle this one too since I'm in context. However, if you want to
do it by yourself please go ahead.

With Best Regards,

2007/4/25, Nathan Beyer <nd...@apache.org>:
> On 4/24/07, Wayne Beaton <wa...@eclipse.org> wrote:
> > When you add a JRE to Eclipse, it scans the JRE's directory for JAR files.
> > For each JAR file it finds, it looks for corresponding source. It does so by
> > climbing up the containment hierarchy looking for a file named "src.jar" or
> > "src.zip" (if you're curious, see
> > org.eclipse.jdt.internal.launching.StandardVMType#getDefaultSystemLibrarySou
> > rce()).
> >
> > Harmony JDK doesn't store is source this way (it seems to include the
> > sources alongside the JAR files), so Eclipse doesn't find it (which means
> > that if, for example, you browse the class java.lang.String, you get a
> > "can't find the source" message in your editor).
> >
> > Is there a special reason why Harmony sources are represented the way they
> > are? Is there any way to bundle 'em all up into a src.zip file?
>
> No special reason, that I know of. Personally, I would consider the
> JRE's source bundling to be the odd ball (Eclipse source distribution
> is also a little weird and a personal pain point, but that's another
> story). I would consider packaging sources the way Harmony does a
> defacto standard; every JAR has a companion source JAR. In fact build
> systems like Maven default to this practice.
>
> >
> > In a related question, I'm not sure that putting them in the "jre" directory
> > is the right approach. I tend to think of the JRE directory as containing
> > *only* the JRE (i.e. I could yank it out and use it as a JRE) and the
> > sources--being part of the JDK--are outside of that directory.
> >
> > I also can't find the source for kernel.jar. Where is Object.java,
> > Class.java, etc.?
> >
>
> Good question. There maybe a missing step here in our build scripts.
> All of the other source JARs are part of the "classlib" build, but
> kernel.jar is produced (implemented) by the VM, so this would be part
> of the "drlvm" build. I'll look into this one.
>
> > I can understand why you'd want to have the sources in different files.
> > Eclipse handles J9 specially. It's probably time to generalize it's
> > implementation to handle arbitrary source configurations (perhaps via
> > extension point).
>
> Yes please!
>
> >
> > Wayne
> > --
> > Wayne Beaton
> > The Eclipse Foundation
> > wayne.beaton@eclipse.org
> > Skype, YIM: waynebeaton
> > http://www.eclipse.org
> > http://wbeaton.blogspot.com/
> > http://www.planeteclipse.org/planet/

-- 
Alexei Zakharov,
Intel ESSD

Re: Eclipse doesn't find harmony sources

Posted by Nathan Beyer <nd...@apache.org>.
On 4/24/07, Wayne Beaton <wa...@eclipse.org> wrote:
> When you add a JRE to Eclipse, it scans the JRE's directory for JAR files.
> For each JAR file it finds, it looks for corresponding source. It does so by
> climbing up the containment hierarchy looking for a file named "src.jar" or
> "src.zip" (if you're curious, see
> org.eclipse.jdt.internal.launching.StandardVMType#getDefaultSystemLibrarySou
> rce()).
>
> Harmony JDK doesn't store is source this way (it seems to include the
> sources alongside the JAR files), so Eclipse doesn't find it (which means
> that if, for example, you browse the class java.lang.String, you get a
> "can't find the source" message in your editor).
>
> Is there a special reason why Harmony sources are represented the way they
> are? Is there any way to bundle 'em all up into a src.zip file?

No special reason, that I know of. Personally, I would consider the
JRE's source bundling to be the odd ball (Eclipse source distribution
is also a little weird and a personal pain point, but that's another
story). I would consider packaging sources the way Harmony does a
defacto standard; every JAR has a companion source JAR. In fact build
systems like Maven default to this practice.

>
> In a related question, I'm not sure that putting them in the "jre" directory
> is the right approach. I tend to think of the JRE directory as containing
> *only* the JRE (i.e. I could yank it out and use it as a JRE) and the
> sources--being part of the JDK--are outside of that directory.
>
> I also can't find the source for kernel.jar. Where is Object.java,
> Class.java, etc.?
>

Good question. There maybe a missing step here in our build scripts.
All of the other source JARs are part of the "classlib" build, but
kernel.jar is produced (implemented) by the VM, so this would be part
of the "drlvm" build. I'll look into this one.

> I can understand why you'd want to have the sources in different files.
> Eclipse handles J9 specially. It's probably time to generalize it's
> implementation to handle arbitrary source configurations (perhaps via
> extension point).

Yes please!

>
> Wayne
> --
> Wayne Beaton
> The Eclipse Foundation
> wayne.beaton@eclipse.org
> Skype, YIM: waynebeaton
> http://www.eclipse.org
> http://wbeaton.blogspot.com/
> http://www.planeteclipse.org/planet/
>
>