Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(10)

Unified Diff: editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/error/StaticWarningCode.java

Issue 23216006: Rules for finals were loosened, contradiction in spec was fixed. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/error/StaticWarningCode.java
diff --git a/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/error/StaticWarningCode.java b/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/error/StaticWarningCode.java
index 32a5ad5c80a02934cdaeceadb49e481740f838cd..ff6aca0d7a37e6962bf68ae8ae65a17f1e4c1e56 100644
--- a/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/error/StaticWarningCode.java
+++ b/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/error/StaticWarningCode.java
@@ -212,6 +212,23 @@ public enum StaticWarningCode implements ErrorCode {
EXTRA_POSITIONAL_ARGUMENTS("%d positional arguments expected, but %d found"),
/**
+ * 5. Variables: It is a static warning if a final instance variable that has been initialized at
+ * its point of declaration is also initialized in a constructor.
+ */
+ FIELD_INITIALIZED_IN_INITIALIZER_AND_DECLARATION(
+ "Values cannot be set in the constructor if they are final, and have already been set"),
+
+ /**
+ * 5. Variables: It is a static warning if a final instance variable that has been initialized at
+ * its point of declaration is also initialized in a constructor.
+ *
+ * @param name the name of the field in question
+ */
+ // TODO (jwren) only a subset of these are being caught
+ FINAL_INITIALIZED_IN_DECLARATION_AND_CONSTRUCTOR(
+ "'%s' is final and was given a value when it was declared, so it cannot be set to a new value"),
+
+ /**
* 7.6.1 Generative Constructors: Execution of an initializer of the form <b>this</b>.<i>v</i> =
* <i>e</i> proceeds as follows: First, the expression <i>e</i> is evaluated to an object
* <i>o</i>. Then, the instance variable <i>v</i> of the object denoted by this is bound to

Powered by Google App Engine
This is Rietveld 408576698