Error A Superinterface Must Be An Interface
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or extends vs implements posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss
Java Interface Example
Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes
Java Abstract Class
a minute: Sign up “The type B cannot be a superinterface of C; a superinterface must be an interface” error up vote 5 down vote favorite 2 Let's assume I got this interface A: interface A { void doThis(); String doThat(); } So, I want some abstracts classes to implement the method doThis() but not the doThat() one: abstract class B implements A { public void doThis() { System.out.println("do this and then "+ doThat()); } } abstract class B2 implements A { public void doThis() { System.out.println(doThat() + "and then do this"); } } There error comes when you finally decide to implement de doThat method in a regular class: public class C implements B { public String doThat() { return "do that"; } } This class leads me to the error aforementioned: "The type B cannot be a superinterface of C; a superinterface must be an interface" Anyone could now if this hierarchy of classes is valid or should I do other way round? java share|improve this question edited Apr 28 at 10:06 Muhammad Rehan Saeed 5,04334396 asked May 3 '12 at 16:01 Painy James 3601620 For more details I recommend looking at the Answers here: stackoverflow.com/questions/10839131/… –Angelo Fuchs Apr 30 '14 at 6:33 add a comment| 3 Answers 3 active oldest votes up vote 16 down vote accepted You must use extends public class C extends B Its important to understand the difference between the implements and extends Keywords. So, I recommend you start reading at this question: Implement vs. Extends. When to use. Whats the Difference? and the answers there. share|improve this answer edited Sep 10 '14 at 8:04 answered May 3 '12 at 16:03 Angelo Fuchs 7,1101854 Thanks! I also forgot to add the public abstract String doThat() to each abstract classes :S –Painy James May 3 '12 at 16:13 1 @PainyJames you don't need to add the public abstract String doThat() to each of the abstract classes. –emory May 3 '12 at 17:24 add a comment| up vote 4 down vote Since B is a class, the correct syntax is to use extends: public class C extends B { share|improve this answer answered
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up “The type B cannot be a superinterface of C; a superinterface must be an interface” http://stackoverflow.com/questions/10435103/the-type-b-cannot-be-a-superinterface-of-c-a-superinterface-must-be-an-interfa error up vote 5 down vote favorite 2 Let's assume I got this interface A: interface A { void doThis(); String doThat(); } So, I want some abstracts classes to implement the method doThis() but not the doThat() one: abstract class B implements A { public void doThis() { System.out.println("do this and then "+ doThat()); } } abstract class B2 implements A { public void doThis() { System.out.println(doThat() + "and http://stackoverflow.com/questions/10435103/the-type-b-cannot-be-a-superinterface-of-c-a-superinterface-must-be-an-interfa/10435131 then do this"); } } There error comes when you finally decide to implement de doThat method in a regular class: public class C implements B { public String doThat() { return "do that"; } } This class leads me to the error aforementioned: "The type B cannot be a superinterface of C; a superinterface must be an interface" Anyone could now if this hierarchy of classes is valid or should I do other way round? java share|improve this question edited Apr 28 at 10:06 Muhammad Rehan Saeed 5,04334396 asked May 3 '12 at 16:01 Painy James 3601620 For more details I recommend looking at the Answers here: stackoverflow.com/questions/10839131/… –Angelo Fuchs Apr 30 '14 at 6:33 add a comment| 3 Answers 3 active oldest votes up vote 16 down vote accepted You must use extends public class C extends B Its important to understand the difference between the implements and extends Keywords. So, I recommend you start reading at this question: Implement vs. Extends. When to use. Whats the Difference? and the answers there. share|improve this answer edited Sep 10 '14 at 8:04 answered May 3 '12 at 16:03 Angelo Fuchs 7,1101854 Thanks! I also forgot to add the public abstract String doThat() to each
and to http://spring.io/questions for a curated list of stackoverflow tags that Pivotal engineers, and the community, http://forum.spring.io/forum/spring-projects/roo/116999-what-is-causing-the-type-xxx-cannot-be-a-superinterface-error monitor. Announcement Announcement Module Collapse No announcement yet. What is causing "The type xxx cannot be a superinterface" error? Page Title Module Move Remove Collapse X Conversation Detail Module Collapse Posts Latest Activity Search Forums Page of 1 Filter Time All Time Today Last Week Last Month Show All Discussions only Photos error a only Videos only Links only Polls only Filtered by: Clear All new posts greg.soulsby Member Join Date: May 2012 Posts: 41 #1 What is causing "The type xxx cannot be a superinterface" error? May 10th, 2012, 04:14 AM I am scaffolding my fist Roo app and am getting this error, which I error a superinterface cant understand. The type InnovCatalogueRelationships cannot be a superinterface of InnovCatalogueRelationshipsImpl; a superinterface must be an interface My sequence in Roo, within STS is 1) create new Roo project 2) addon list (I find I have to do this, otherwise the next step fails) 3) addon install bundle --bundleSymbolicName org.springframework.roo.wrapping.mysql-connector-java 4) jpa setup --database MYSQL --provider HIBERNATE --databaseName upcaseco_innove --userName xx --password xx 5) database reverse engineer --schema no-schema-required --package ~.domain --includeTables "innov_catalogues innov_catalogue_relationships" --testAutomatically --includeNonPortableAttributes --activeRecord false 6) service --interface ~.domain.InnovCatalogues 7) service --interface ~.domain.InnovCatalogueRelationships 8) web mvc setup 9) web mvc all --package ~.web At this point there are 2 occurrences of the above error on the domain implementations - InnovCataloguesImpl and InnovCatalogueRelationshipsImpl While it makes sense "a superinterface must be an interface", why has Roo got me into this situation? Thanks in advance. Greg Tags: None Team Services Tools © Pivotal Software, Inc. All Rights Reserved. Terms of Use and Pri