You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

BadExtension.java 932B

1234567891011121314151617181920212223242526272829303132333435363738
  1. public class BadExtension { }
  2. abstract class Super {
  3. public final void finalPublic() {}
  4. public void justPublic() {}
  5. public int intPublic() {}
  6. public abstract void abstractWithBody() {} //ERROR shouldn't have a body
  7. public abstract void abstractPublic();
  8. public static final void staticFinalPublic() {}
  9. }
  10. class Sub extends Super { //ERROR must implement abstractPublic
  11. public void finalPublic() {} //ERROR can't override final
  12. void justPublic() {} //ERROR can't override with weaker access
  13. public void intPublic() {} //ERROR can't change the return type
  14. public static void staticFinalPublic() {} //ERROR can't even override static finals
  15. }
  16. interface I1 {
  17. void m();
  18. }
  19. interface I2 {
  20. int m();
  21. }
  22. class C12 implements I1, I2 {
  23. public void m() {} //ERROR incompatible return types with I2.m()
  24. }
  25. interface I12 extends I1, I2 {} //ERROR I1.m() and I2.m() are not compatible