Details
-
Type:
Improvement
-
Status:
Open
-
Priority:
Minor
-
Resolution: Unresolved
-
Affects Version/s: X10 SVN HEAD
-
Fix Version/s: X10 2.3.2
-
Component/s: X10 Compiler: Front-end
-
Labels:None
-
Number of attachments :
Description
Syntax error in the following code is reported with strange error message.
public class OverrideTest { static abstract class Sup { public abstract toString():String; // missing def } static class Sub extends Sup { public def toString():String = "hi"; } }
OverrideTest.x10:6: toString(): x10.lang.String in OverrideTest.Sub cannot override toString(): x10.lang.String in OverrideTest.Sup; attempting to assign weaker access privileges
1 error.
Issue Links
- is related to
-
XTENLANG-2846
Better error message for omitted def keyword on a private method
-
This is not a syntax error, but perfectly valid X10 code that declares a property method OverrideTest.Sup.toString(). Thus, the subclass method is weaker (does not have the property modifier).
Would it help if the message mentioned that the overridden method has the property modifier?