| Index: editor/util/plugins/com.google.dart.java2dart/resources/java_core.dart
|
| diff --git a/editor/util/plugins/com.google.dart.java2dart/resources/java_core.dart b/editor/util/plugins/com.google.dart.java2dart/resources/java_core.dart
|
| index ea75f59645ef3d070e982659176754a45a3ccd27..378b5dbb0e89b72939b0515b3bff63320c377377 100644
|
| --- a/editor/util/plugins/com.google.dart.java2dart/resources/java_core.dart
|
| +++ b/editor/util/plugins/com.google.dart.java2dart/resources/java_core.dart
|
| @@ -14,70 +14,77 @@ class JavaSystem {
|
| }
|
| }
|
|
|
| +Stopwatch instanceOfTimer = new Stopwatch();
|
| +
|
| /**
|
| * Limited implementation of "o is instanceOfType", see
|
| * http://code.google.com/p/dart/issues/detail?id=8184
|
| */
|
| bool isInstanceOf(o, Type t) {
|
| - if (o == null) {
|
| - return false;
|
| - }
|
| - if (o.runtimeType == t) {
|
| - return true;
|
| - }
|
| - String oTypeName = o.runtimeType.toString();
|
| - String tTypeName = t.toString();
|
| - if (oTypeName == tTypeName) {
|
| - return true;
|
| - }
|
| - if (oTypeName.startsWith("List") && tTypeName == "List") {
|
| - return true;
|
| - }
|
| - if (tTypeName == "Map" && o is Map) {
|
| - return true;
|
| - }
|
| - // Dart Analysis Engine specific
|
| - if (oTypeName == "${tTypeName}Impl") {
|
| - return true;
|
| - }
|
| - if (tTypeName == "FormalParameter") {
|
| - return
|
| - oTypeName == "DefaultFormalParameter" ||
|
| - oTypeName == "FieldNormalParameter" ||
|
| - oTypeName == "FunctionTypedFormalParameter" ||
|
| - oTypeName == "SimpleFormalParameter";
|
| - }
|
| - if (tTypeName == "MethodElement") {
|
| - if (oTypeName == "MethodMember") {
|
| + instanceOfTimer.start();
|
| + try {
|
| + if (o == null) {
|
| + return false;
|
| + }
|
| + if (o.runtimeType == t) {
|
| return true;
|
| }
|
| - }
|
| - if (tTypeName == "ExecutableElement") {
|
| - if (oTypeName == "MethodElementImpl" ||
|
| - oTypeName == "FunctionElementImpl" ||
|
| - oTypeName == "PropertyAccessorElementImpl") {
|
| + String oTypeName = o.runtimeType.toString();
|
| + String tTypeName = t.toString();
|
| + if (oTypeName == tTypeName) {
|
| return true;
|
| }
|
| - }
|
| - if (tTypeName == "ParameterElement") {
|
| - if (oTypeName == "FieldFormalParameterElementImpl" ||
|
| - oTypeName == "DefaultFieldFormalParameterElementImpl" ||
|
| - oTypeName == "DefaultParameterElementImpl") {
|
| + if (oTypeName.startsWith("List") && tTypeName == "List") {
|
| return true;
|
| }
|
| - }
|
| - if (tTypeName == "VariableElement") {
|
| - if (oTypeName == "LocalVariableElementImpl" ||
|
| - oTypeName == "ConstLocalVariableElementImpl" ||
|
| - oTypeName == "FieldElementImpl" ||
|
| - oTypeName == "ConstFieldElementImpl" ||
|
| - oTypeName == "TopLevelVariableElementImpl" ||
|
| - oTypeName == "ConstTopLevelVariableElementImpl") {
|
| + if (tTypeName == "Map" && o is Map) {
|
| + return true;
|
| + }
|
| + // Dart Analysis Engine specific
|
| + if (oTypeName == "${tTypeName}Impl") {
|
| return true;
|
| }
|
| + if (tTypeName == "FormalParameter") {
|
| + return
|
| + oTypeName == "DefaultFormalParameter" ||
|
| + oTypeName == "FieldNormalParameter" ||
|
| + oTypeName == "FunctionTypedFormalParameter" ||
|
| + oTypeName == "SimpleFormalParameter";
|
| + }
|
| + if (tTypeName == "MethodElement") {
|
| + if (oTypeName == "MethodMember") {
|
| + return true;
|
| + }
|
| + }
|
| + if (tTypeName == "ExecutableElement") {
|
| + if (oTypeName == "MethodElementImpl" ||
|
| + oTypeName == "FunctionElementImpl" ||
|
| + oTypeName == "PropertyAccessorElementImpl") {
|
| + return true;
|
| + }
|
| + }
|
| + if (tTypeName == "ParameterElement") {
|
| + if (oTypeName == "FieldFormalParameterElementImpl" ||
|
| + oTypeName == "DefaultFieldFormalParameterElementImpl" ||
|
| + oTypeName == "DefaultParameterElementImpl") {
|
| + return true;
|
| + }
|
| + }
|
| + if (tTypeName == "VariableElement") {
|
| + if (oTypeName == "LocalVariableElementImpl" ||
|
| + oTypeName == "ConstLocalVariableElementImpl" ||
|
| + oTypeName == "FieldElementImpl" ||
|
| + oTypeName == "ConstFieldElementImpl" ||
|
| + oTypeName == "TopLevelVariableElementImpl" ||
|
| + oTypeName == "ConstTopLevelVariableElementImpl") {
|
| + return true;
|
| + }
|
| + }
|
| + // no
|
| + return false;
|
| + } finally {
|
| + instanceOfTimer.stop();
|
| }
|
| - // no
|
| - return false;
|
| }
|
|
|
| class JavaArrays {
|
|
|