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

Unified Diff: editor/util/plugins/com.google.dart.java2dart/src/com/google/dart/java2dart/util/JavaUtils.java

Issue 12543009: Use JavaFile instead of Dart File. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 9 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/util/plugins/com.google.dart.java2dart/src/com/google/dart/java2dart/util/JavaUtils.java
diff --git a/editor/util/plugins/com.google.dart.java2dart/src/com/google/dart/java2dart/util/JavaUtils.java b/editor/util/plugins/com.google.dart.java2dart/src/com/google/dart/java2dart/util/JavaUtils.java
index 4ea69f82c2500d345f39e224d9b3b9c0d377273c..f3fd8aee72882f6eb0cbbc74275a75f815a61b5d 100644
--- a/editor/util/plugins/com.google.dart.java2dart/src/com/google/dart/java2dart/util/JavaUtils.java
+++ b/editor/util/plugins/com.google.dart.java2dart/src/com/google/dart/java2dart/util/JavaUtils.java
@@ -20,6 +20,8 @@ import org.eclipse.jdt.core.dom.IBinding;
import org.eclipse.jdt.core.dom.IMethodBinding;
import org.eclipse.jdt.core.dom.IPackageBinding;
import org.eclipse.jdt.core.dom.ITypeBinding;
+import org.eclipse.jdt.core.dom.IVariableBinding;
+import org.eclipse.jdt.core.dom.Modifier;
/**
* Helper for JDT integration.
@@ -295,6 +297,14 @@ public class JavaUtils {
return false;
}
+ public static boolean isStaticFieldBinding(Object binding) {
+ if (binding instanceof IVariableBinding) {
+ IVariableBinding fieldBinding = (IVariableBinding) binding;
+ return fieldBinding.isField() && isStatic(fieldBinding);
+ }
+ return false;
+ }
+
public static boolean isSubtype(ITypeBinding binding, ITypeBinding superBinding) {
if (binding != null) {
if (binding == superBinding) {
@@ -394,4 +404,8 @@ public class JavaUtils {
return null;
}
}
+
+ private static boolean isStatic(IBinding binding) {
+ return Modifier.isStatic(binding.getModifiers());
+ }
}

Powered by Google App Engine
This is Rietveld 408576698