|
130 | 130 |
|
131 | 131 | import net.sf.j2s.core.CorePlugin; |
132 | 132 |
|
| 133 | +// BH 7/22/2018 -- fixes improper use of charCodeAt() to replace charCode().$c() when not java.lang.String.charAt |
133 | 134 | // BH 7/20/2018 -- removes qualifications for single-abstract method overrides |
134 | 135 | // BH 7/19/2018 -- fixes Enum.Enum |
135 | 136 | // BH 7/18/2018 -- addw Java 8 try without catch or finally |
@@ -1661,14 +1662,12 @@ private boolean addClassOrInterface(ASTNode node, ITypeBinding binding, List<?> |
1661 | 1662 | // methods are not to be qualified |
1662 | 1663 |
|
1663 | 1664 | for (int i = unqualifiedMethods.size(); --i >= 0;) { |
1664 | | - //buffer.append(">>" + method.getKey() + " " + unqualifiedMethods.get(i).getKey() + "<<\r\n"); |
1665 | 1665 | if (method.overrides(unqualifiedMethods.get(i))) { |
1666 | 1666 | dontQualifyMethod = true; |
1667 | 1667 | break; |
1668 | 1668 | } |
1669 | 1669 | } |
1670 | 1670 | } |
1671 | | - //buffer.append("<<" + dontQualifyMethod + "<<"); |
1672 | 1671 | element.accept(this); |
1673 | 1672 | dontQualifyMethod = dontQualifyCurrent; |
1674 | 1673 | } |
@@ -2346,7 +2345,7 @@ public boolean visit(Assignment node) { |
2346 | 2345 | left.accept(this); |
2347 | 2346 | int ptArray2 = (isArray ? buffer.length() : -1); |
2348 | 2347 | if (!"char".equals(leftName)) { |
2349 | | - if (isIntegerType(leftName) || "booelean".equals(leftName)) { |
| 2348 | + if (isIntegerType(leftName) || "boolean".equals(leftName)) { |
2350 | 2349 | // can't just use a |= b because that ends up as 1 or 0, not true or false. |
2351 | 2350 | // byte|short|int|long += ... |
2352 | 2351 | if (!addPrimitiveTypedExpression(left, toBinding, leftName, opType, right, rightName, null, true)) |
@@ -2997,7 +2996,6 @@ private String getQualifiedSimpleName(SimpleName node) { |
2997 | 2996 | return simpleNameInMethodBinding(node, isQualified, (IMethodBinding) binding); |
2998 | 2997 |
|
2999 | 2998 | ITypeBinding typeBinding = node.resolveTypeBinding(); |
3000 | | - // >>Math<<.max |
3001 | 2999 | return NameMapper.get$QualifiedJ2SFieldName(typeBinding == null ? node.getFullyQualifiedName() |
3002 | 3000 | : assureQualifiedNameAllowP$(typeBinding.getQualifiedName()), true); |
3003 | 3001 | } |
@@ -3476,9 +3474,9 @@ private void addCharCodeAt(Expression right, int pt) { |
3476 | 3474 | if (right instanceof MethodInvocation) { |
3477 | 3475 | // if possible, just replace "charAt" with "charCodeAt" |
3478 | 3476 | MethodInvocation m = (MethodInvocation) right; |
3479 | | - if ("charAt".equals(m.getName().toString())) { |
| 3477 | + if (m.resolveMethodBinding().getKey().equals("Ljava/lang/String;.charAt(I)C")) { |
3480 | 3478 | if ((pt = buffer.indexOf(".charAt", pt)) >= 0) { |
3481 | | - charCodeAt0 = "Code" + buffer.substring(pt + 5); // At.... |
| 3479 | + charCodeAt0 = "Code" + buffer.substring(pt + 5); |
3482 | 3480 | buffer.setLength(pt + 5); |
3483 | 3481 | } |
3484 | 3482 | } |
|
0 commit comments