Summary: | [DCR][1.5][options] Optional warning/error to avoid accidental overrides with JDK 5.0 | ||
---|---|---|---|
Product: | [Eclipse Project] JDT | Reporter: | Jon Skeet <skeet> |
Component: | Core | Assignee: | Philipe Mulet <philippe_mulet> |
Status: | VERIFIED FIXED | QA Contact: | |
Severity: | enhancement | ||
Priority: | P3 | CC: | markus.kell.r, tobias_widmer |
Version: | 3.1 | ||
Target Milestone: | 3.1 M6 | ||
Hardware: | PC | ||
OS: | Windows XP | ||
Whiteboard: | |||
Bug Depends on: | |||
Bug Blocks: | 86234 |
Description
Jon Skeet
2005-02-07 08:02:35 EST
+1. IMO, the @Override annotation doesn't make much sense if it is only optional. +1. With the advent of covariance and generics, overriding rules have become more complex, and checking @Override annotations certainly helps against unwanted overriding of methods. Good suggestion Option added. Enabled it through our some of our test suites, and adapted test results accordingly. Fixed Added optional compiler diagnosis to flag method overriding a superclass method, but missing proper @Override annotation. Corresponding problem ID is: IProblem.MissingOverrideAnnotation * COMPILER / Reporting Missing @Override Annotation * When enabled, the compiler will issue an error or a warning whenever encountering a method * declaration which overrides a superclass method but has no @Override annotation. * - option id: "org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation" * - possible values: { "error", "warning", "ignore" } * - default: "warning" Any opinion whether this warning should be on by default ? IMO, only few people use annotations at all. Even most 5.0 JDK rarely use @Override. I suggest to set this to ignore as default, even if the option can be very useful. Agreed. Unless the team already has the convention of using @Override, it would create a lot of warnings almost all of which are spurious. I'm in the happy situation of starting a new project with no existing code, but most other people aren't! sold Verified in I20050330-0500 |