Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 4943d48

Browse files
author
zhourenjian
committed
Fixed bug on failing to compile SimpleRPCRunnable classes with #ajaxRun.
1 parent a27c76a commit 4943d48

File tree

2 files changed

+28
-13
lines changed

2 files changed

+28
-13
lines changed

src/net/sf/j2s/core/astvisitors/ASTScriptVisitor.java

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1098,19 +1098,16 @@ public boolean visit(Initializer node) {
10981098
}
10991099

11001100
public void endVisit(MethodDeclaration node) {
1101-
Javadoc javadoc = node.getJavadoc();
1102-
if (javadoc != null) {
1103-
List tags = javadoc.tags();
1104-
if (tags.size() != 0) {
1105-
for (Iterator iter = tags.iterator(); iter.hasNext();) {
1106-
TagElement tagEl = (TagElement) iter.next();
1107-
if ("@j2sIgnore".equals(tagEl.getTagName())) {
1108-
return ;
1109-
}
1110-
}
1111-
}
1101+
if (getJ2SDocTag(node, "@j2sIgnore") != null) {
1102+
return;
11121103
}
1104+
11131105
IMethodBinding mBinding = node.resolveBinding();
1106+
if (Bindings.isMethodInvoking(mBinding, "net.sf.j2s.ajax.SimpleRPCRunnable", "ajaxRun")) {
1107+
if (getJ2SDocTag(node, "@j2sKeep") == null) {
1108+
return;
1109+
}
1110+
}
11141111
if (mBinding != null) {
11151112
methodDeclareStack.pop();
11161113
}
@@ -1124,7 +1121,9 @@ public boolean visit(MethodDeclaration node) {
11241121

11251122
IMethodBinding mBinding = node.resolveBinding();
11261123
if (Bindings.isMethodInvoking(mBinding, "net.sf.j2s.ajax.SimpleRPCRunnable", "ajaxRun")) {
1127-
return false;
1124+
if (getJ2SDocTag(node, "@j2sKeep") == null) {
1125+
return false;
1126+
}
11281127
}
11291128
if (mBinding != null) {
11301129
methodDeclareStack.push(mBinding.getKey());

src/net/sf/j2s/core/astvisitors/DependencyASTVisitor.java

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -797,7 +797,23 @@ public void setToCompileVariableName(boolean toCompileVariableName) {
797797
public boolean visit(MethodDeclaration node) {
798798
IMethodBinding mBinding = node.resolveBinding();
799799
if (Bindings.isMethodInvoking(mBinding, "net.sf.j2s.ajax.SimpleRPCRunnable", "ajaxRun")) {
800-
return false;
800+
boolean toKeep = false;
801+
Javadoc javadoc = node.getJavadoc();
802+
if (javadoc != null) {
803+
List tags = javadoc.tags();
804+
if (tags.size() != 0) {
805+
for (Iterator iter = tags.iterator(); iter.hasNext();) {
806+
TagElement tagEl = (TagElement) iter.next();
807+
if ("@j2sKeep".equals(tagEl.getTagName())) {
808+
toKeep = true;
809+
break;
810+
}
811+
}
812+
}
813+
}
814+
if (!toKeep) {
815+
return false;
816+
}
801817
}
802818

803819
Javadoc javadoc = node.getJavadoc();

0 commit comments

Comments
 (0)