Skip to content

Commit d98d948

Browse files
author
zhourenjian
committed
Code refactor
1 parent 27c1c44 commit d98d948

File tree

3 files changed

+7
-8
lines changed

3 files changed

+7
-8
lines changed

sources/net.sf.j2s.core/src/net/sf/j2s/core/astvisitors/ASTKeywordVisitor.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -162,10 +162,7 @@ public boolean visit(ArrayCreation node) {
162162
initializer.accept(this);
163163
} else {
164164
List dim = node.dimensions();
165-
node.getType().resolveBinding();
166-
node.getType().getComponentType().resolveBinding();
167165
ITypeBinding elementType = node.getType().getElementType().resolveBinding();
168-
elementType = node.getType().getElementType().resolveBinding();
169166
if(elementType != null){
170167
if (elementType.isPrimitive()) {
171168
String typeCode = elementType.getName();
@@ -411,7 +408,8 @@ public boolean visit(Assignment node) {
411408
buffer.append(' ');
412409
buffer.append(op);
413410
buffer.append(' ');
414-
if (right.resolveTypeBinding() != null && "char".equals(right.resolveTypeBinding().getName())) {
411+
ITypeBinding binding = right.resolveTypeBinding();
412+
if (binding != null && "char".equals(binding.getName())) {
415413
buffer.append('(');
416414
right.accept(this);
417415
buffer.append(").charCodeAt (0)");

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1225,9 +1225,9 @@ public boolean visit(MethodDeclaration node) {
12251225
}
12261226
}
12271227
if ((node.getModifiers() & Modifier.PRIVATE) != 0) {
1228-
if(node.resolveBinding() != null){
1228+
if(mBinding != null){
12291229
boolean isReferenced = MethodReferenceASTVisitor.checkReference(node.getRoot(),
1230-
node.resolveBinding().getKey());
1230+
mBinding.getKey());
12311231
if (!isReferenced && getJ2SDocTag(node, "@j2sKeep") == null) {
12321232
return false;
12331233
}

sources/net.sf.j2s.core/src/net/sf/j2s/core/astvisitors/ASTTypeVisitor.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -230,8 +230,9 @@ public String getTypeStringName(Type type) {
230230
return getTypeStringName(qualType.getQualifier()) + "." + qualType.getName().getIdentifier();//.getFullyQualifiedName();
231231
} else if (type instanceof SimpleType) {
232232
SimpleType simpType = (SimpleType) type;
233-
if(simpType.resolveBinding() != null){
234-
return simpType.resolveBinding().getQualifiedName();
233+
ITypeBinding binding = simpType.resolveBinding();
234+
if(binding != null){
235+
return binding.getQualifiedName();
235236
}
236237
}
237238
return null;

0 commit comments

Comments
 (0)