Hi Marcus, You are welcome. Thanks for following up with the solution. It might help other users facing similar issues.
Best regards, Jerome > -----Message d'origine----- > De : news [mailto:[EMAIL PROTECTED] De la part de Marcus > Envoyé : jeudi 6 mars 2008 05:19 > À : discuss@restlet.tigris.org > Objet : Re: Problem with Override annotation in tutorial examples > > Okay, I worked it out. > Apologies if i have 'polluted' the newsgroup, but i will > explain my mistake > for any other newbies that may encounter the same problem. > > Instead of importing the org.restlet.data.Request, I had imported the > simple.http.Request. > > When overriding the 'handle(org.restlet.data.Request, > org.restlet.data.Response)' method, this meant the method i > was overriding > with had the signature 'handle(simple.http.Request, > org.restlet.data.Response)' and of course the @Override > annotation barfed on > this. > > I hope I haven't wasted anybody's time. > > > "Marcus" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > >I think/hope that this should be a fairly simple issue to > resolve... :) > > > > I am trying to get into Restlet, and its slow work. I have > been going > > through > > the tutorials and trying out the example code and I've hit > a piece of code > > that > > I can't compile. > > > > It is in Section 3: > > > >> // Creating a minimal Restlet returning "Hello World" > >> Restlet restlet = new Restlet() { > >> @Override > >> public void handle(Request request, Response response) { > >> response.setEntity("Hello World!", > MediaType.TEXT_PLAIN); > >> } > >> }; > > > > I am new to Java and can only assume this 'new' > instantiation syntax > > creates an inline subclass with the 'handle(..)' method > overridden. I've > > have knocked up some simple test code and found that you > cannot define new > > methods, but you can override existing ones in this manner. > > > > It also seems that the Override annotation is unnecessary, > it simply > > generates a compiler error if the method doesn't infact > override a method > > in the super class. > > > > THE PROBLEM: > > In the above example, I get the following error with the Override > > notation: > > > > com\firstStepsServlet\SimpleRestlet.java:22: > > method does not override or implement a method from a supertype > > @Override > > ^ > > > > The error message does not seem correct though, as I can > create a new > > class that extends the Restlet class that overrides this > method and uses > > the Override notation, and does not generate this error. It > also executes > > correctly. > > > > Any help with this would be appreciated as it seems that > the tutorials > > continue to use this form of syntax. > > > > Thanks in advance > > > > > >