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

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

Issue 16337007: Version 0.5.13.1 . (Closed) Base URL: http://dart.googlecode.com/svn/trunk/dart/
Patch Set: Created 7 years, 7 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/processor/IOSemanticProcessor.java
===================================================================
--- editor/util/plugins/com.google.dart.java2dart/src/com/google/dart/java2dart/processor/IOSemanticProcessor.java (revision 23549)
+++ editor/util/plugins/com.google.dart.java2dart/src/com/google/dart/java2dart/processor/IOSemanticProcessor.java (working copy)
@@ -27,6 +27,7 @@
import com.google.dart.java2dart.util.JavaUtils;
import static com.google.dart.java2dart.util.ASTFactory.identifier;
+import static com.google.dart.java2dart.util.ASTFactory.methodInvocation;
import static com.google.dart.java2dart.util.ASTFactory.namedExpression;
import static com.google.dart.java2dart.util.ASTFactory.propertyAccess;
import static com.google.dart.java2dart.util.TokenFactory.token;
@@ -57,14 +58,17 @@
ITypeBinding declaringClass = methodBinding.getDeclaringClass();
List<Expression> args = node.getArgumentList().getArguments();
// new URI()
- if (JavaUtils.getQualifiedName(declaringClass).equals("java.net.URI") && args.size() == 4
- && args.get(0) instanceof NullLiteral && args.get(1) instanceof NullLiteral
- && args.get(3) instanceof NullLiteral) {
- node.getConstructorName().setName(identifier("fromComponents"));
- Expression pathExpression = args.get(2);
- args.clear();
- args.add(namedExpression("path", pathExpression));
- return null;
+ if (JavaUtils.getQualifiedName(declaringClass).equals("java.net.URI")) {
+ if (args.size() == 1) {
+ replaceNode(node, methodInvocation(identifier("parseUriWithException"), args));
+ }
+ if (args.size() == 4 && args.get(0) instanceof NullLiteral
+ && args.get(1) instanceof NullLiteral && args.get(3) instanceof NullLiteral) {
+ Expression pathExpression = args.get(2);
+ args.clear();
+ args.add(namedExpression("path", pathExpression));
+ return null;
+ }
}
// new File(parent, child)
if (isMethodInClass2(
@@ -86,8 +90,12 @@
@Override
public Void visitMethodInvocation(MethodInvocation node) {
super.visitMethodInvocation(node);
-// List<Expression> args = node.getArgumentList().getArguments();
+ List<Expression> args = node.getArgumentList().getArguments();
SimpleIdentifier nameNode = node.getMethodName();
+ if (isMethodInClass2(node, "create(java.lang.String)", "java.net.URI")) {
+ replaceNode(node, methodInvocation(identifier("parseUriWithException"), args));
+ return null;
+ }
if (isMethodInClass(node, "getScheme", "java.net.URI")) {
replaceNode(node, propertyAccess(node.getTarget(), identifier("scheme")));
return null;

Powered by Google App Engine
This is Rietveld 408576698