Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion Scala object-nested classes in Eclipse Java
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Som Snytt  
View profile  
 More options Apr 19 2012, 3:03 pm
From: Som Snytt <som.sn...@gmail.com>
Date: Thu, 19 Apr 2012 12:03:52 -0700
Local: Thurs, Apr 19 2012 3:03 pm
Subject: Re: [scala-user] Re: Scala object-nested classes in Eclipse Java

On Thu, Apr 19, 2012 at 5:14 AM, Andrius Velykis <andr...@velykis.lt> wrote:

> This is not explicitly ScalaIDE question - I could use scalac to compile
> and then jar into the library. The question is about Scala-Java interop
> when using Eclipse IDE, and I was wondering what is the right way of
> referencing such class, and how to do that in Eclipse.

I can confirm the issue, which is that Eclipse balks on
OuterObject$MiddleObject$Inner because OuterObject and MiddleObject don't
have an InnerClass relationship.  (I'm guessing a bit about why Eclipse
balks.)

Here's a workaround of sorts:

You can create a class called Outer$Middle$Inner in your Eclipse project,
which will only warn on the name.  Give it a stub interface so there are no
compilation errors.

Then in your run configuration, you can "add external jar" to "User
entries" (to add your scala jar) and then move it "up" ahead of the
"default classpath" that includes the stub.

(Alternatively, you can edit .classpath manually, put your scala binary
before java src. The editor will still complain about the classname, but
that error won't stop you from running.)

Is that worth the trouble?  On a real project, the stub class would go in a
special stub-src dir so it doesn't get packaged in product by some horrible
accident.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.