timowest / scalagen

Java to Scala transformation
Apache License 2.0
216 stars 32 forks source link

override keyword missing #58

Closed tyrcho closed 10 years ago

tyrcho commented 11 years ago

When I convert this very simple code :

import java.awt.Label;

public class FirstApplet extends java.applet.Applet {
   public void init (){
      add(new Label("Hello World"));
   }
}

It generates

import java.awt.Label

class FirstApplet extends java.applet.Applet {

  def init() {
    add(new Label("Hello World"))
  }
}

Which does not compile since init overrides a method in Applet.

Note that I am using this https://github.com/dnadolny/java-to-scala-plugin plugin to paste the java code.

timowest commented 11 years ago

Scalagen operates on the source code level, so you will need to use the Override annotation to get the results you want.

tyrcho commented 11 years ago

I understand, it is really not a big issue.

Maybe you could document such restrictions of the tool in the README ? This file is a good start https://github.com/dnadolny/java-to-scala-plugin/blob/master/README.md (section Problems ...)

For instance this @Override behaviour changed a bit between java 5 and 6 I think, maybe also explain which version of Java sources you target.