Summary: | Qualified super reference cannot be surrounded with parentheses. | ||
---|---|---|---|
Product: | [Eclipse Project] JDT | Reporter: | Olivier Thomann <Olivier_Thomann> |
Component: | Core | Assignee: | Olivier Thomann <Olivier_Thomann> |
Status: | VERIFIED FIXED | QA Contact: | |
Severity: | normal | ||
Priority: | P3 | CC: | philippe_mulet |
Version: | 2.1 | ||
Target Milestone: | 2.1 M5 | ||
Hardware: | PC | ||
OS: | Windows 2000 | ||
Whiteboard: |
Description
Olivier Thomann
2002-12-18 10:25:36 EST
Ok by me. In a similar fashion we should reject (++i)++; We already reject such a code with: ---------- 1. ERROR in D:\temp\A.java (at line 5) (++i)++; ^^^^^ Invalid argument to operation ++/-- ---------- 1 problem (1 error) I'd like to add: 1) In IProblem: int CannotBeSurroundedByParentheses = Syntax + Internal + 225; 2) QualifiedSuperReference::resolveType method: if ((this.bits & ParenthesizedMASK) != 0) { scope.problemReporter().qualifiedSuperReferenceCannotBeSurroundedByParentheses(this); return null; } 3) In problem/messages.properties: 225 = A qualified super reference cannot be surrounded by parentheses 4) In ProblemReporter: public void qualifiedSuperReferenceCannotBeSurroundedByParentheses(AstNode reference) { this.handle( IProblem.CannotBeSurroundedByParentheses, NoArgument, NoArgument, reference.sourceStart, reference.sourceEnd); } Then I get the following error for this bug's test case: ---------- 1. ERROR in D:\temp\A.java (at line 4) return (A.super).toString(); ^^^^^^^^^ A qualified super reference cannot be surrounded by parentheses ---------- 1 problem (1 error) Let me know if the naming is good enough. I don't want to release this without checking first since IProblem is an API interface. I would make it sound a little more generic: IProblem.InvalidParenthesizedExpression ProblemReporter.illegalParenthesizedExpression(...) Now we have: ---------- 1. ERROR in D:\temp\A.java (at line 4) return (A.super).toString(); ^^^^^^^^^ Invalid parenthesized expression ---------- 1 problem (1 error) Fixed and released in 2.1 stream. Regression test added. Verified. |