cincheo / jsweet

A Java to JavaScript transpiler.
http://www.jsweet.org
Other
1.46k stars 160 forks source link

issue with abstract class and abstract methods #112

Closed ssatguru closed 8 years ago

ssatguru commented 8 years ago

I have a standard java abstract class with few abstract methods. This class also implements an interface This compiled fine till yesterday

Now i get the following error during transpilation

ERROR: overload signatures must all be abstract or not abstract at C:\projects-babylonjs\github\Vishva\src\main\java\org\ssatguru\babylonjs\Vishva.java(2432) ERROR: all declarations of an abstract method must be consecutive at C:\projects-babylonjs\github\Vishva\src\main\java\org\ssatguru\babylonjs\Vishva.java(2432)

What does this error mean?

renaudpawlak commented 8 years ago

I have recently added some support for abstract classes in JSweet. This is a tricky part and I unfortunately, it seems to cause some regression :( I am sorry about this. Could you please send me a code snippet that reflects the error you get? That would help covering all the usecases... Thanks.

renaudpawlak commented 8 years ago

Could you check out this test on abstract classes (all these are valid in JSweet): https://github.com/cincheo/jsweet/blob/master/src/test/java/source/structural/AbstractClass.java

As you can see, it already covers various use cases... Maybe I forgot one... If you compare your code with what is valid in the above test, hopefully it will help you to find what triggers you problem.

ssatguru commented 8 years ago

I will check those test cases. In the mean time here is the link, if you want to check my class which throws these errors https://github.com/ssatguru/Vishva/blob/master/src/main/java/org/ssatguru/babylonjs/Vishva.java#L2356 If your run "mvn generate-sources" on this project you will see exactly where the errors are happening

https://github.com/ssatguru/Vishva

renaudpawlak commented 8 years ago

i'll do it right away

renaudpawlak commented 8 years ago

I have the org.ssatguru.babylonjs:EditControl:jar:1.0.0-SNAPSHOT missing when trying to build. Do I need to clone/install it first or do you have a repo that you want to add to your pom.xml?

renaudpawlak commented 8 years ago

I have installed EditControl and it is building now (you should mention it in your README). I see the problem... I will investigate and keep you updated.

ssatguru commented 8 years ago

Nice. Sorry about the EditControl. Have updated the README.

renaudpawlak commented 8 years ago

Ok. I have found the problem. I forgot a case for abstract classes...

In your SensorAbstract, you declare getName, cleanup, and processUpdateSpecific as abstract methods (but they are already declared in Sensor). This is not required anymore in JSweet (like in Java, it is not mandatory to declare them because they are already defined in the Sensor interface).

It is my fault though, because although redundant, it should be possible to redeclare abstract methods even when already defined in the class/interface hierarchy.

I will fix it ASAP. In the meantime, if you have to compile your project, I guess that you just need to remove your redundant abstract methods.

ssatguru commented 8 years ago

works after removing redundant abstract methods. Thanks