[scala] [new plugin] confusing error when extending an abstract java class

View: New views
9 Messages — Rating Filter:   Alert me  

[scala] [new plugin] confusing error when extending an abstract java class

by Sebastien Braun :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi all,

when I write the following code:

  import org.apache.wicket.protocol.http._
  class GF2Application extends WebApplication {
    override def getHomePage(): Class[_] = null
  }

the eclipse plugin tells me that

  class GF2Application needs to be abstract, since method newSessionStore in
  class Application of type ()org.apache.wicket.session.ISessionStore is not
  defined  

org.apache.wicket.protocol.http.WebApplication comes from the Wicket framework
(http://wicket.apache.org), extends org.apache.wicket.Application, and does
already override newSessionStore().

Likewise, when I implement newSessionStore() as

  override def newSessionStore(): ISessionStore = null

the plugin starts to complain about another abstract method which is also
defined in WebApplication.

Can anyone see a problem with that code? Or is this a plugin problem?
Thanks for your help.

-Sebastien


signature.asc (204 bytes) Download Attachment

Re: [scala] [new plugin] confusing error when extending an abstract java class

by Miles Sabin :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Thu, Jul 10, 2008 at 6:23 PM, Sebastien Braun <sebb@...> wrote:

> when I write the following code:
>
>  import org.apache.wicket.protocol.http._
>  class GF2Application extends WebApplication {
>    override def getHomePage(): Class[_] = null
>  }
>
> the eclipse plugin tells me that
>
>  class GF2Application needs to be abstract, since method newSessionStore in
>  class Application of type ()org.apache.wicket.session.ISessionStore is not
>  defined

Are you sure that that error report is wrong?

Cheers,


Miles

Re: [scala] [new plugin] confusing error when extending an abstract java class

by Sebastien Braun :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Thursday 10 July 2008 20:10:52 Miles Sabin wrote:
> On Thu, Jul 10, 2008 at 6:23 PM, Sebastien Braun <sebb@...>
wrote:

> > the eclipse plugin tells me that
> >
> >  class GF2Application needs to be abstract, since method newSessionStore
> > in class Application of type ()org.apache.wicket.session.ISessionStore is
> > not defined
>
> Are you sure that that error report is wrong?
>
> Cheers,
>
>
> Miles
Pretty much yes. It's true that newSessionStore is not defined in Application,
but it does have a default definition in WebApplication which extends
Application:

public abstract class WebApplication extends Application
{
  // <snip>
  /**
   * @see org.apache.wicket.Application#newSessionStore()
   */
  protected ISessionStore newSessionStore()
  {
    return new SecondLevelCacheSessionStore(this, new DiskPageStore());
  }
  // <snip>
}


Since I extend WebApplication and not Application, I should also get
WebApplication's definition of newSessionStore, which would make the error
message wrong, or at least misleading.

Or am I confused?

-Sébastien


signature.asc (204 bytes) Download Attachment

Re: [scala] [new plugin] confusing error when extending an abstract java class

by Miles Sabin :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Thu, Jul 10, 2008 at 7:20 PM, Sebastien Braun <sebb@...> wrote:
> Since I extend WebApplication and not Application, I should also get
> WebApplication's definition of newSessionStore, which would make the error
> message wrong, or at least misleading.
>
> Or am I confused?

Hard for me to say from here ...

Could you try compiling with the command line tools (ie. scalac). I
think it's unlikely that this is an Eclipse-specific problem but it
would be nice to knwo for sure.

Cheers,


Miles

Re: [scala] [new plugin] confusing error when extending an abstract java class

by Sebastien Braun :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Thursday 10 July 2008 20:22:55 Miles Sabin wrote:
> On Thu, Jul 10, 2008 at 7:20 PM, Sebastien Braun <sebb@...>
wrote:

> > Since I extend WebApplication and not Application, I should also get
> > WebApplication's definition of newSessionStore, which would make the
> > error message wrong, or at least misleading.
> >
> > Or am I confused?
>
> Hard for me to say from here ...
>
> Could you try compiling with the command line tools (ie. scalac). I
> think it's unlikely that this is an Eclipse-specific problem but it
> would be nice to knwo for sure.
>
> Cheers,
>
>
> Miles
Aha. I just compiled with scalac and noticed that I had neglected to add the
servlet API jar to the classpath.

It seems to work now, but see one eclipse-specific problem:

scalac complained that

  error: error while loading WebApplication, class file <snip> is broken
  (class javax.servlet.ServletContext not found.)

and that seems to have confused some component of the plugin, but the plugin
never complained, when it should have.

Anyway, I know now what I'll do next time.

Thanks for your help!

-Sébastien


signature.asc (204 bytes) Download Attachment

Re: [scala] [new plugin] confusing error when extending an abstract java class

by Josh Suereth :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I've noticed similar behavior myself.  The plugin could find the class file for a "child" class but not a parent class, and so i got really strange behavior. 

On Thu, Jul 10, 2008 at 2:52 PM, Sebastien Braun <sebb@...> wrote:
On Thursday 10 July 2008 20:22:55 Miles Sabin wrote:
> On Thu, Jul 10, 2008 at 7:20 PM, Sebastien Braun <sebb@...>
wrote:
> > Since I extend WebApplication and not Application, I should also get
> > WebApplication's definition of newSessionStore, which would make the
> > error message wrong, or at least misleading.
> >
> > Or am I confused?
>
> Hard for me to say from here ...
>
> Could you try compiling with the command line tools (ie. scalac). I
> think it's unlikely that this is an Eclipse-specific problem but it
> would be nice to knwo for sure.
>
> Cheers,
>
>
> Miles

Aha. I just compiled with scalac and noticed that I had neglected to add the
servlet API jar to the classpath.

It seems to work now, but see one eclipse-specific problem:

scalac complained that

 error: error while loading WebApplication, class file <snip> is broken
 (class javax.servlet.ServletContext not found.)

and that seems to have confused some component of the plugin, but the plugin
never complained, when it should have.

Anyway, I know now what I'll do next time.

Thanks for your help!

-Sébastien


Re: [scala] [new plugin] confusing error when extending an abstract java class

by Miles Sabin :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Thu, Jul 10, 2008 at 11:45 PM, Josh Suereth <joshua.suereth@...> wrote:
> I've noticed similar behavior myself.  The plugin could find the class file
> for a "child" class but not a parent class, and so i got really strange
> behavior.

Hmm ... interesting.

Do you think you two could work on putting together a small,
reproducible, test case  for this?

Cheers,


Miles

Re: [scala] [new plugin] confusing error when extending an abstract java class

by Sean McDirmid :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I've fixed these problems on the next check in. The problem is that broken class file errors don't have positions, so I can't put them into the problem view. They were going to the console, but now I'm throwing them into the error log. On second thought, I guess I'll have to add an API for reporting an error on a project without a position...

Sean

On Fri, Jul 11, 2008 at 2:52 AM, Sebastien Braun <sebb@...> wrote:
On Thursday 10 July 2008 20:22:55 Miles Sabin wrote:
> On Thu, Jul 10, 2008 at 7:20 PM, Sebastien Braun <sebb@...>
wrote:
> > Since I extend WebApplication and not Application, I should also get
> > WebApplication's definition of newSessionStore, which would make the
> > error message wrong, or at least misleading.
> >
> > Or am I confused?
>
> Hard for me to say from here ...
>
> Could you try compiling with the command line tools (ie. scalac). I
> think it's unlikely that this is an Eclipse-specific problem but it
> would be nice to knwo for sure.
>
> Cheers,
>
>
> Miles

Aha. I just compiled with scalac and noticed that I had neglected to add the
servlet API jar to the classpath.

It seems to work now, but see one eclipse-specific problem:

scalac complained that

 error: error while loading WebApplication, class file <snip> is broken
 (class javax.servlet.ServletContext not found.)

and that seems to have confused some component of the plugin, but the plugin
never complained, when it should have.

Anyway, I know now what I'll do next time.

Thanks for your help!

-Sébastien


Re: [scala] [new plugin] confusing error when extending an abstract java class

by Miles Sabin :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Fri, Jul 11, 2008 at 1:18 AM, Sean McDirmid <sean.mcdirmid@...> wrote:
> On second thought, I guess I'll have to add an API for reporting
> an error on a project without a position...

Yes, I think that would be the best approach ... I'd much rather these
showed up in the problems view than in the error log.

Cheers,


Miles
LightInTheBox - Buy quality products at wholesale price