Rename Method.isNative and MethodBody.isNative to .isJsniMethod and .isJsniMethodBody.
The purpose of this rename is to avoid confusion with isJsNative.
Change-Id: I62e7ad3af1487d27414aeef354a9cac00a247938
diff --git a/dev/core/src/com/google/gwt/dev/jjs/ast/CanBeNative.java b/dev/core/src/com/google/gwt/dev/jjs/ast/CanBeNative.java
deleted file mode 100644
index 752df43..0000000
--- a/dev/core/src/com/google/gwt/dev/jjs/ast/CanBeNative.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Copyright 2007 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-package com.google.gwt.dev.jjs.ast;
-
-/**
- * Interface implemented by entities that can have the Java native modifier.
- */
-public interface CanBeNative {
- boolean isNative();
-}
diff --git a/dev/core/src/com/google/gwt/dev/jjs/ast/JAbstractMethodBody.java b/dev/core/src/com/google/gwt/dev/jjs/ast/JAbstractMethodBody.java
index 3dbe47c..cf21888 100644
--- a/dev/core/src/com/google/gwt/dev/jjs/ast/JAbstractMethodBody.java
+++ b/dev/core/src/com/google/gwt/dev/jjs/ast/JAbstractMethodBody.java
@@ -31,7 +31,7 @@
return method;
}
- public abstract boolean isNative();
+ public abstract boolean isJsniMethodBody();
public void setMethod(JMethod method) {
this.method = method;
diff --git a/dev/core/src/com/google/gwt/dev/jjs/ast/JMethod.java b/dev/core/src/com/google/gwt/dev/jjs/ast/JMethod.java
index d19def5..73d3673 100644
--- a/dev/core/src/com/google/gwt/dev/jjs/ast/JMethod.java
+++ b/dev/core/src/com/google/gwt/dev/jjs/ast/JMethod.java
@@ -38,7 +38,7 @@
/**
* A Java method implementation.
*/
-public class JMethod extends JNode implements JMember, CanBeAbstract, CanBeNative {
+public class JMethod extends JNode implements JMember, CanBeAbstract {
/**
* Indicates whether a method is a JsProperty accessor.
@@ -610,12 +610,11 @@
return isForwarding;
}
- @Override
- public boolean isNative() {
+ public boolean isJsniMethod() {
if (body == null) {
return false;
} else {
- return body.isNative();
+ return body.isJsniMethodBody();
}
}
@@ -651,7 +650,7 @@
*/
public void removeParam(int index) {
params = Lists.remove(params, index);
- if (isNative()) {
+ if (isJsniMethod()) {
((JsniMethodBody) getBody()).getFunc().getParameters().remove(index);
}
}
diff --git a/dev/core/src/com/google/gwt/dev/jjs/ast/JMethodBody.java b/dev/core/src/com/google/gwt/dev/jjs/ast/JMethodBody.java
index d65727e..fbb3b7d 100644
--- a/dev/core/src/com/google/gwt/dev/jjs/ast/JMethodBody.java
+++ b/dev/core/src/com/google/gwt/dev/jjs/ast/JMethodBody.java
@@ -58,7 +58,7 @@
}
@Override
- public boolean isNative() {
+ public boolean isJsniMethodBody() {
return false;
}
diff --git a/dev/core/src/com/google/gwt/dev/jjs/ast/js/JsniMethodBody.java b/dev/core/src/com/google/gwt/dev/jjs/ast/js/JsniMethodBody.java
index 7708407..84221ae 100644
--- a/dev/core/src/com/google/gwt/dev/jjs/ast/js/JsniMethodBody.java
+++ b/dev/core/src/com/google/gwt/dev/jjs/ast/js/JsniMethodBody.java
@@ -110,7 +110,7 @@
}
@Override
- public boolean isNative() {
+ public boolean isJsniMethodBody() {
return true;
}
diff --git a/dev/core/src/com/google/gwt/dev/jjs/impl/ControlFlowAnalyzer.java b/dev/core/src/com/google/gwt/dev/jjs/impl/ControlFlowAnalyzer.java
index 8be8bb2..4e1e5e9 100644
--- a/dev/core/src/com/google/gwt/dev/jjs/impl/ControlFlowAnalyzer.java
+++ b/dev/core/src/com/google/gwt/dev/jjs/impl/ControlFlowAnalyzer.java
@@ -346,7 +346,7 @@
rescue(enclosingType, false);
}
- if (x.isNative()) {
+ if (x.isJsniMethod()) {
// Manually rescue native parameter references
final JsniMethodBody body = (JsniMethodBody) x.getBody();
final JsFunction func = body.getFunc();
@@ -614,7 +614,7 @@
if (dependencyRecorder != null) {
curMethodStack.remove(curMethodStack.size() - 1);
}
- if (method.isNative()) {
+ if (method.isJsniMethod()) {
// Returning from this method passes a value from JavaScript into Java.
maybeRescueJavaScriptObjectPassingIntoJava(method.getType());
}
diff --git a/dev/core/src/com/google/gwt/dev/jjs/impl/EnumOrdinalizer.java b/dev/core/src/com/google/gwt/dev/jjs/impl/EnumOrdinalizer.java
index 075e745..7ab9e54 100644
--- a/dev/core/src/com/google/gwt/dev/jjs/impl/EnumOrdinalizer.java
+++ b/dev/core/src/com/google/gwt/dev/jjs/impl/EnumOrdinalizer.java
@@ -377,7 +377,7 @@
maybeBlackListDueToStaticCall(x.getSourceInfo(), target);
}
- if (x.getTarget().isNative()) {
+ if (x.getTarget().isJsniMethod()) {
// Black list enum types declared in parameters of native functions.
for (JParameter parameter :x.getTarget().getParams()) {
blackListIfEnum(parameter.getType(), x.getSourceInfo());
diff --git a/dev/core/src/com/google/gwt/dev/jjs/impl/GenerateJavaScriptAST.java b/dev/core/src/com/google/gwt/dev/jjs/impl/GenerateJavaScriptAST.java
index 4d5d5ff..9f79edb 100644
--- a/dev/core/src/com/google/gwt/dev/jjs/impl/GenerateJavaScriptAST.java
+++ b/dev/core/src/com/google/gwt/dev/jjs/impl/GenerateJavaScriptAST.java
@@ -395,14 +395,14 @@
* Only allocate a name for a function if it is native, not polymorphic,
* is a JNameOf target or stack-stripping is disabled.
*/
- if (!stripStack || !polymorphicNames.containsKey(x) || x.isNative()
+ if (!stripStack || !polymorphicNames.containsKey(x) || x.isJsniMethod()
|| nameOfTargets.contains(x)) {
globalName = topScope.declareName(mangleName, name);
names.put(x, globalName);
recordSymbol(x, globalName);
}
JsFunction function;
- if (x.isNative()) {
+ if (x.isJsniMethod()) {
// set the global name of the JSNI peer
JsniMethodBody body = (JsniMethodBody) x.getBody();
function = body.getFunc();
@@ -796,7 +796,7 @@
JsFunction function = transform(method.getBody());
function.setInliningMode(method.getInliningMode());
- if (!method.isNative()) {
+ if (!method.isJsniMethod()) {
// Setup params on the generated function. A native method already got
// its jsParams set when parsed from JSNI.
transformInto(method.getParams(), function.getParameters());
@@ -2615,7 +2615,7 @@
@Override
public void endVisit(JMethod x, Context ctx) {
- if (x.isNative()) {
+ if (x.isJsniMethod()) {
// These are methods whose bodies where not traversed by the Java method inliner.
JsFunction function = jsFunctionsByJavaMethodBody.get(x.getBody());
if (function != null && function.getBody() != null) {
@@ -2637,7 +2637,7 @@
@Override
public void endVisit(JMethodCall x, Context ctx) {
JMethod target = x.getTarget();
- if (target.isInliningAllowed() && (target.isNative()
+ if (target.isInliningAllowed() && (target.isJsniMethod()
|| program.getIndexedTypes().contains(target.getEnclosingType())
|| target.getInliningMode() == InliningMode.FORCE_INLINE)) {
// These are either: 1) callsites to JSNI functions, in which case MethodInliner did not
diff --git a/dev/core/src/com/google/gwt/dev/jjs/impl/GwtAstBuilder.java b/dev/core/src/com/google/gwt/dev/jjs/impl/GwtAstBuilder.java
index 8743d52..f0b2f0c 100644
--- a/dev/core/src/com/google/gwt/dev/jjs/impl/GwtAstBuilder.java
+++ b/dev/core/src/com/google/gwt/dev/jjs/impl/GwtAstBuilder.java
@@ -2452,7 +2452,7 @@
JMethod method = typeMap.get(x.binding);
assert !method.isExternal();
JMethodBody body = null;
- if (!method.isNative()) {
+ if (!method.isJsniMethod()) {
body = new JMethodBody(method.getSourceInfo());
method.setBody(body);
}
diff --git a/dev/core/src/com/google/gwt/dev/jjs/impl/ImplicitUpcastAnalyzer.java b/dev/core/src/com/google/gwt/dev/jjs/impl/ImplicitUpcastAnalyzer.java
index 2ccf5e1..c193e39 100644
--- a/dev/core/src/com/google/gwt/dev/jjs/impl/ImplicitUpcastAnalyzer.java
+++ b/dev/core/src/com/google/gwt/dev/jjs/impl/ImplicitUpcastAnalyzer.java
@@ -108,7 +108,7 @@
processIfTypesNotEqual(x.getType(), overridden.getType(), x.getSourceInfo());
}
- if (x.getBody() != null && x.getBody().isNative()) {
+ if (x.getBody() != null && x.getBody().isJsniMethodBody()) {
/*
* Check if this method has a native (jsni) method body, in which case all
* arguments passed in are implicitly cast to JavaScriptObject
diff --git a/dev/core/src/com/google/gwt/dev/jjs/impl/JModVisitorWithTemporaryVariableCreation.java b/dev/core/src/com/google/gwt/dev/jjs/impl/JModVisitorWithTemporaryVariableCreation.java
index c9487aa..6f2ec01 100644
--- a/dev/core/src/com/google/gwt/dev/jjs/impl/JModVisitorWithTemporaryVariableCreation.java
+++ b/dev/core/src/com/google/gwt/dev/jjs/impl/JModVisitorWithTemporaryVariableCreation.java
@@ -62,7 +62,7 @@
}
protected JLocal createTempLocal(SourceInfo info, JType type) {
- assert !getCurrentMethod().isNative();
+ assert !getCurrentMethod().isJsniMethod();
JMethodBody currentMethodBody = (JMethodBody) getCurrentMethod().getBody();
String temporaryLocalName = newTemporaryLocalName(info, type, currentMethodBody);
JLocal local = JProgram.createLocal(info, temporaryLocalName, type, false, currentMethodBody);
diff --git a/dev/core/src/com/google/gwt/dev/jjs/impl/MakeCallsStatic.java b/dev/core/src/com/google/gwt/dev/jjs/impl/MakeCallsStatic.java
index b824250..3377fb9 100644
--- a/dev/core/src/com/google/gwt/dev/jjs/impl/MakeCallsStatic.java
+++ b/dev/core/src/com/google/gwt/dev/jjs/impl/MakeCallsStatic.java
@@ -210,7 +210,7 @@
* Rewrite the method body. Update all thisRefs to paramRefs. Update
* paramRefs and localRefs to target the params/locals in the new method.
*/
- if (newMethod.isNative()) {
+ if (newMethod.isJsniMethod()) {
// For natives, we also need to create the JsParameter for this$static,
// because the jsFunc already has parameters.
// TODO: Do we really need to do that in BuildTypeMap?
diff --git a/dev/core/src/com/google/gwt/dev/jjs/impl/MethodInliner.java b/dev/core/src/com/google/gwt/dev/jjs/impl/MethodInliner.java
index b232bb6..89c66c4 100644
--- a/dev/core/src/com/google/gwt/dev/jjs/impl/MethodInliner.java
+++ b/dev/core/src/com/google/gwt/dev/jjs/impl/MethodInliner.java
@@ -124,7 +124,7 @@
private InlineResult tryInlineMethodCall(JMethodCall x, Context ctx) {
JMethod method = x.getTarget();
- if (!method.isStatic() || method.isNative() || method.canBeImplementedExternally()) {
+ if (!method.isStatic() || method.isJsniMethod() || method.canBeImplementedExternally()) {
// Only inline static methods that are not native.
return InlineResult.BLACKLIST;
}
@@ -210,7 +210,7 @@
JMethod clinit = targetType.getClinitMethod();
// If the clinit is a non-native, empty body we can optimize it out here
- if (!clinit.isNative() && (((JMethodBody) clinit.getBody())).getStatements().size() == 0) {
+ if (!clinit.isJsniMethod() && (((JMethodBody) clinit.getBody())).getStatements().size() == 0) {
return null;
}
diff --git a/dev/core/src/com/google/gwt/dev/jjs/impl/ToStringGenerationVisitor.java b/dev/core/src/com/google/gwt/dev/jjs/impl/ToStringGenerationVisitor.java
index 1a46a3e..94fcddb 100644
--- a/dev/core/src/com/google/gwt/dev/jjs/impl/ToStringGenerationVisitor.java
+++ b/dev/core/src/com/google/gwt/dev/jjs/impl/ToStringGenerationVisitor.java
@@ -17,7 +17,6 @@
import com.google.gwt.dev.jjs.ast.CanBeAbstract;
import com.google.gwt.dev.jjs.ast.CanBeFinal;
-import com.google.gwt.dev.jjs.ast.CanBeNative;
import com.google.gwt.dev.jjs.ast.CanBeStatic;
import com.google.gwt.dev.jjs.ast.Context;
import com.google.gwt.dev.jjs.ast.HasName;
@@ -1082,8 +1081,8 @@
print(x.getName());
}
- protected void printNativeFlag(CanBeNative x) {
- if (x.isNative()) {
+ protected void printNativeFlag(JMethod x) {
+ if (x.isJsniMethod()) {
print(CHARS_NATIVE);
}
}
diff --git a/dev/core/src/com/google/gwt/dev/jjs/impl/TypeTightener.java b/dev/core/src/com/google/gwt/dev/jjs/impl/TypeTightener.java
index b29c1cf..76751e1 100644
--- a/dev/core/src/com/google/gwt/dev/jjs/impl/TypeTightener.java
+++ b/dev/core/src/com/google/gwt/dev/jjs/impl/TypeTightener.java
@@ -523,7 +523,7 @@
* The only information that we can infer about native methods is if they
* are declared to return a leaf type.
*/
- if (x.isNative() || x.canBeImplementedExternally()) {
+ if (x.isJsniMethod() || x.canBeImplementedExternally()) {
return;
}
@@ -616,7 +616,7 @@
* Explicitly NOT visiting native methods since we can't infer further
* type information.
*/
- return !x.isNative();
+ return !x.isJsniMethod();
}
/**