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

Side by Side Diff: dart/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/resolver/ProxyConditionalAnalysisError.java

Issue 59073003: Version 0.8.10.4 (Closed) Base URL: http://dart.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2013, the Dart project authors. 2 * Copyright (c) 2013, the Dart project authors.
3 * 3 *
4 * Licensed under the Eclipse Public License v1.0 (the "License"); you may not u se this file except 4 * Licensed under the Eclipse Public License v1.0 (the "License"); you may not u se this file except
5 * in compliance with the License. You may obtain a copy of the License at 5 * in compliance with the License. You may obtain a copy of the License at
6 * 6 *
7 * http://www.eclipse.org/legal/epl-v10.html 7 * http://www.eclipse.org/legal/epl-v10.html
8 * 8 *
9 * Unless required by applicable law or agreed to in writing, software distribut ed under the License 9 * Unless required by applicable law or agreed to in writing, software distribut ed under the License
10 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY K IND, either express 10 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY K IND, either express
(...skipping 13 matching lines...) Expand all
24 * to find out if the error should actually be reported. In this case, these err ors are conditional 24 * to find out if the error should actually be reported. In this case, these err ors are conditional
25 * on the non-existence of an {@code @proxy} annotation. 25 * on the non-existence of an {@code @proxy} annotation.
26 * <p> 26 * <p>
27 * If we have other conditional error codes in the future, we should have this c lass implement some 27 * If we have other conditional error codes in the future, we should have this c lass implement some
28 * ConditionalErrorCode so that after resolution, a list of ConditionalErrorCode can be visited 28 * ConditionalErrorCode so that after resolution, a list of ConditionalErrorCode can be visited
29 * instead of multiple lists of *ConditionalErrorCodes. 29 * instead of multiple lists of *ConditionalErrorCodes.
30 */ 30 */
31 public class ProxyConditionalAnalysisError { 31 public class ProxyConditionalAnalysisError {
32 32
33 /** 33 /**
34 * The name of the proxy annotation, from the meta pub package. 34 * The name of the proxy annotation, from dart:core.
35 */ 35 */
36 private static final String PROXY_ANNOTATION_NAME = "proxy"; 36 private static final String PROXY_ANNOTATION_NAME = "proxy";
37 37
38 /** 38 /**
39 * The name of the meta library name, from the meta pub package.
40 */
41 private static final String META_LIBRARY_NAME = "meta";
42
43 /**
44 * Return {@code true} if the given element represents a class that has the pr oxy annotation. 39 * Return {@code true} if the given element represents a class that has the pr oxy annotation.
45 * 40 *
46 * @param element the class being tested 41 * @param element the class being tested
47 * @return {@code true} if the given element represents a class that has the p roxy annotation 42 * @return {@code true} if the given element represents a class that has the p roxy annotation
48 */ 43 */
49 private static boolean classHasProxyAnnotation(Element element) { 44 private static boolean classHasProxyAnnotation(Element element) {
50 if (element instanceof ClassElement) { 45 if (element instanceof ClassElement) {
51 ClassElement classElement = (ClassElement) element; 46 ClassElement classElement = (ClassElement) element;
52 ElementAnnotation[] annotations = classElement.getMetadata(); 47 ElementAnnotation[] annotations = classElement.getMetadata();
53 for (ElementAnnotation annotation : annotations) { 48 for (ElementAnnotation annotation : annotations) {
54 Element elementAnnotation = annotation.getElement(); 49 Element elementAnnotation = annotation.getElement();
55 if (elementAnnotation != null) { 50 if (elementAnnotation != null) {
56 LibraryElement lib = elementAnnotation.getLibrary(); 51 LibraryElement lib = elementAnnotation.getLibrary();
57 if (elementAnnotation.getName().equals(PROXY_ANNOTATION_NAME) && lib ! = null 52 if (lib != null && lib.isDartCore()
58 && lib.getName().equals(META_LIBRARY_NAME)) { 53 && elementAnnotation.getName().equals(PROXY_ANNOTATION_NAME)) {
59 return true; 54 return true;
60 } 55 }
61 } 56 }
62 } 57 }
63 } 58 }
64 return false; 59 return false;
65 } 60 }
66 61
67 /** 62 /**
68 * The enclosing {@link ClassElement}, this is what will determine if the erro r code should, or 63 * The enclosing {@link ClassElement}, this is what will determine if the erro r code should, or
(...skipping 30 matching lines...) Expand all
99 /** 94 /**
100 * Return {@code true} iff the enclosing class has the proxy annotation. 95 * Return {@code true} iff the enclosing class has the proxy annotation.
101 * 96 *
102 * @return {@code true} iff the enclosing class has the proxy annotation 97 * @return {@code true} iff the enclosing class has the proxy annotation
103 */ 98 */
104 public boolean shouldIncludeErrorCode() { 99 public boolean shouldIncludeErrorCode() {
105 return !classHasProxyAnnotation(enclosingElement); 100 return !classHasProxyAnnotation(enclosingElement);
106 } 101 }
107 102
108 } 103 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698