Bug 36989 - Incorrect error for "super must be first statement in constructor"
Summary: Incorrect error for "super must be first statement in constructor"
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.1   Edit
Hardware: PC Windows NT
: P3 normal (vote)
Target Milestone: 3.0 M2   Edit
Assignee: David Audel CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-04-28 08:49 EDT by Channing Walton CLA
Modified: 2003-07-16 04:14 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Channing Walton CLA 2003-04-28 08:49:12 EDT
Try this code:

	class Base {
		public Base(String foo) {
		}
	}

	class SubClass extends Base {
		public SubClass() {
			System.out.println("a statement");
			super("bar");
		}
	}

The error reported is:
Syntax error on token "(", "." expected	SubClass.java

The javac error is (more helpful):
SubClass.java:5: call to super must be first statement in constructor super("bar");
Comment 1 Philipe Mulet CLA 2003-04-28 09:03:00 EDT
David - can the syntax recovery handle this one ? Alternatively, we could make 
our grammar less strict, and check this situation after the fact.
Comment 2 David Audel CLA 2003-07-03 07:55:38 EDT
Fixed.
Comment 3 David Audel CLA 2003-07-16 04:14:31 EDT
Verified.