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

Skip to content

Commit 22c47a5

Browse files
author
zhourenjian
committed
1. Fixed bug that "private E[] newElementArray(int capcity)" may be ignored by Java2Script compiler.
2. Add "pack.j2slib.war" target in Java2Script Servlet project so developer can pack j2slib as war to deploy it. 3. Combine Java2Script Application and Java2Script JUnit codes.
1 parent 1cbb682 commit 22c47a5

File tree

3 files changed

+51
-33
lines changed

3 files changed

+51
-33
lines changed

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

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -715,34 +715,34 @@ public boolean visit(ClassInstanceCreation node) {
715715
return super.visit(node);
716716
}
717717

718-
/* (non-Javadoc)
719-
* @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.ArrayCreation)
720-
*/
721-
public boolean visit(ArrayCreation node) {
722-
ArrayType type = node.getType();
723-
Type elementType = type.getElementType();
724-
if (!elementType.isPrimitiveType()) {
725-
ITypeBinding resolveTypeBinding = elementType.resolveBinding();
726-
ITypeBinding declaringClass = resolveTypeBinding.getDeclaringClass();
727-
QNTypeBinding qn = new QNTypeBinding();
728-
String qualifiedName = null;
729-
if (declaringClass != null) {
730-
qualifiedName = declaringClass.getQualifiedName();
731-
qn.binding = declaringClass;
732-
} else {
733-
qualifiedName = resolveTypeBinding.getQualifiedName();
734-
qn.binding = resolveTypeBinding;
735-
}
736-
qualifiedName = discardGenericType(qualifiedName);
737-
qn.qualifiedName = qualifiedName;
738-
if (isQualifiedNameOK(qualifiedName, node)
739-
&& !musts.contains(qn)
740-
&& !requires.contains(qn)) {
741-
optionals.add(qn);
742-
}
743-
}
744-
return super.visit(node);
745-
}
718+
// /* (non-Javadoc)
719+
// * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.ArrayCreation)
720+
// */
721+
// public boolean visit(ArrayCreation node) {
722+
// ArrayType type = node.getType();
723+
// Type elementType = type.getElementType();
724+
// if (!elementType.isPrimitiveType()) {
725+
// ITypeBinding resolveTypeBinding = elementType.resolveBinding();
726+
// ITypeBinding declaringClass = resolveTypeBinding.getDeclaringClass();
727+
// QNTypeBinding qn = new QNTypeBinding();
728+
// String qualifiedName = null;
729+
// if (declaringClass != null) {
730+
// qualifiedName = declaringClass.getQualifiedName();
731+
// qn.binding = declaringClass;
732+
// } else {
733+
// qualifiedName = resolveTypeBinding.getQualifiedName();
734+
// qn.binding = resolveTypeBinding;
735+
// }
736+
// qualifiedName = discardGenericType(qualifiedName);
737+
// qn.qualifiedName = qualifiedName;
738+
// if (isQualifiedNameOK(qualifiedName, node)
739+
// && !musts.contains(qn)
740+
// && !requires.contains(qn)) {
741+
// optionals.add(qn);
742+
// }
743+
// }
744+
// return super.visit(node);
745+
// }
746746

747747
/* (non-Javadoc)
748748
* @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.MethodInvocation)

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

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ public class MethodReferenceASTVisitor extends ASTVisitor {
3434
private MethodReferenceASTVisitor(String methodSignature) {
3535
super();
3636
this.methodSignature = methodSignature;
37+
System.out.println("visitor:" + methodSignature);
3738
}
3839

3940
public static boolean checkReference(ASTNode node, String methodSignature) {
@@ -51,7 +52,11 @@ public static boolean checkReference(ASTNode node, String methodSignature) {
5152
*/
5253
public boolean visit(ClassInstanceCreation node) {
5354
IMethodBinding constructorBinding = node.resolveConstructorBinding();
54-
if (methodSignature.equals(constructorBinding.getKey())) {
55+
String key = constructorBinding.getKey();
56+
if (key != null) {
57+
key = key.replaceAll("<[^>]+>", "");
58+
}
59+
if (methodSignature.equals(key)) {
5560
isReferenced = true;
5661
return false;
5762
}
@@ -63,7 +68,11 @@ public boolean visit(ClassInstanceCreation node) {
6368
*/
6469
public boolean visit(ConstructorInvocation node) {
6570
IMethodBinding constructorBinding = node.resolveConstructorBinding();
66-
if (methodSignature.equals(constructorBinding.getKey())) {
71+
String key = constructorBinding.getKey();
72+
if (key != null) {
73+
key = key.replaceAll("<[^>]+>", "");
74+
}
75+
if (methodSignature.equals(key)) {
6776
isReferenced = true;
6877
return false;
6978
}
@@ -75,7 +84,11 @@ public boolean visit(ConstructorInvocation node) {
7584
*/
7685
public boolean visit(MethodInvocation node) {
7786
IMethodBinding methodBinding = node.resolveMethodBinding();
78-
if (methodSignature.equals(methodBinding.getKey())) {
87+
String key = methodBinding.getKey();
88+
if (key != null) {
89+
key = key.replaceAll("<[^>]+>", "");
90+
}
91+
if (methodSignature.equals(key)) {
7992
isReferenced = true;
8093
return false;
8194
}
@@ -87,7 +100,11 @@ public boolean visit(MethodInvocation node) {
87100
*/
88101
public boolean visit(SuperMethodInvocation node) {
89102
IMethodBinding methodBinding = node.resolveMethodBinding();
90-
if (methodSignature.equals(methodBinding.getKey())) {
103+
String key = methodBinding.getKey();
104+
if (key != null) {
105+
key = key.replaceAll("<[^>]+>", "");
106+
}
107+
if (methodSignature.equals(key)) {
91108
isReferenced = true;
92109
return false;
93110
}

src/net/sf/j2s/core/hotspot/InnerHotspotServer.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,9 @@ private void serverLoop() throws Exception {
147147
try {
148148
s = ss.accept();
149149
} catch (IOException e) {
150-
e.printStackTrace();
150+
//e.printStackTrace();
151151
}
152+
if (s == null) continue;
152153
HotspotWorker w = null;
153154
synchronized (threads) {
154155
if (threads.isEmpty()) {

0 commit comments

Comments
 (0)