|
167 | 167 | // HashSet as the basis for the {a:a,b:this.$finals$.b} mapping listFinalVariables. |
168 | 168 | // This fixed all of the stream issues. See Test_Local, Test_java8, Test_Class. |
169 | 169 |
|
170 | | -// BH 2019.12.07 3.2.5-v2 fix for lambda expression with $$ must not be cached |
| 170 | +// BH 2019.12.15 3.2.5-v4 fix for <? extends Byte> not getting name for boxing |
| 171 | +// BH 2019.12.15 3.2.5-v4 fix for local class within anonymous class not getting name |
| 172 | +// BH 2019.12.12 3.2.5-v3 fix for enums == null in annotations |
| 173 | +// BH 2019.12.07 3.2.5-v3 fix for lambda expression with $$ must not be cached |
| 174 | +// BH 2019.12.06 3.2.5-v2 fix for try(resources) not closing those |
171 | 175 | // BH 2019.11.18 3.2.5-v0 fix for anonymous subclass of a local class not handling finals |
172 | 176 | // BH 2019.11.18 3.2.5-v0 fix for main method that throws exception not generating html test |
173 | 177 | // BH 2019.11.18 3.2.5-v0 fix for lambda expressions in classes with annotations |
@@ -4437,12 +4441,18 @@ private boolean appendBoxingNode(ASTNode element, boolean toCharCode) { |
4437 | 4441 | // expression is the site of an unboxing conversion |
4438 | 4442 | ITypeBinding typeBinding = exp.resolveTypeBinding(); |
4439 | 4443 | if (!typeBinding.isPrimitive()) { |
4440 | | - String name = getJavaClassNameQualified(typeBinding); |
4441 | | - name = (name.indexOf("Integer") >= 0 ? "int" |
4442 | | - : name.indexOf("Character") >= 0 ? "char" : name.replace("java.lang.", "").toLowerCase()); |
4443 | 4444 | buffer.append("("); |
4444 | 4445 | element.accept(this); |
4445 | | - buffer.append(toCharCode && name == "char" ? ")" + CHARCODEAT0 : ")." + name + "Value$()"); |
| 4446 | + if (toCharCode) { |
| 4447 | + String name = getJavaClassNameQualified(typeBinding); |
| 4448 | + if (toCharCode && name.length() == 0) |
| 4449 | + name = typeBinding.getKey(); |
| 4450 | + if (name.indexOf("Character") >= 0) { |
| 4451 | + buffer.append(").intValue$()"); |
| 4452 | + return true; |
| 4453 | + } |
| 4454 | + } |
| 4455 | + buffer.append(").valueOf()"); |
4446 | 4456 | return true; |
4447 | 4457 | } |
4448 | 4458 | } |
@@ -4495,11 +4505,22 @@ static String getJavaClassNameQualified(ITypeBinding binding) { |
4495 | 4505 |
|
4496 | 4506 | if (binding == null) |
4497 | 4507 | return null; |
4498 | | - String binaryName = null, bindingKey; |
4499 | | - if ((binding.isAnonymous() || binding.isLocal()) && (binaryName = binding.getBinaryName()) == null |
| 4508 | + String name = null, bindingKey; |
| 4509 | + if ((binding.isAnonymous() || binding.isLocal()) && (name = binding.getBinaryName()) == null |
4500 | 4510 | && (bindingKey = binding.getKey()) != null) |
4501 | | - binaryName = bindingKey.substring(1, bindingKey.length() - 1).replace('/', '.'); |
4502 | | - return (binaryName == null ? binding.getQualifiedName() : binaryName); |
| 4511 | + name = bindingKey.substring(1, bindingKey.length() - 1).replace('/', '.'); |
| 4512 | + if (name == null) { |
| 4513 | + name = binding.getQualifiedName(); |
| 4514 | + if (name.length() == 0) { |
| 4515 | + name = binding.getBinaryName(); |
| 4516 | + if (name == null) { |
| 4517 | + System.out.println(">>name null?? bn=" + binding.getBinaryName() + " qn=" + binding.getQualifiedName() + " n=" + binding.getName() + " k=" +binding.getKey() |
| 4518 | + + " isAnon" + binding.isAnonymous() + " " + binding.isLocal()); |
| 4519 | + name = ""; // <? extends Byte> |
| 4520 | + } |
| 4521 | + } |
| 4522 | + } |
| 4523 | + return name; |
4503 | 4524 | } |
4504 | 4525 |
|
4505 | 4526 | private static String getJavaClassNameSuperNoBrackets(ITypeBinding typeBinding) { |
@@ -4721,25 +4742,22 @@ String getFinalJ2SClassNameQualifier(Name methodQualifier, ITypeBinding declarin |
4721 | 4742 | * $I$[] dynamic class loading and interfaces, (but interfaces are handled |
4722 | 4743 | * differently). |
4723 | 4744 | * |
4724 | | - * This is a temporary will fix and will fail if the program does not adhere to |
4725 | | - * class/package-capitalization standards. |
4726 | | - * |
4727 | 4745 | * @param packageName Java package name or "_" |
4728 | 4746 | * @param javaClassName |
4729 | 4747 | * @return array listing classes that need to be loaded in order |
4730 | 4748 | */ |
4731 | 4749 | private String getFinalInnerClassList(ITypeBinding javaClass, String javaClassName) { |
4732 | | - if (javaClassName == null) |
| 4750 | + String packageName = getPackageName(javaClass); |
| 4751 | + if (javaClassName == null) { |
4733 | 4752 | javaClassName = getJavaClassNameQualified(javaClass); |
4734 | | - // called by addClassOrInterface and getFinalClazzLoadI |
| 4753 | + System.out.println(">>jcn was null! " + javaClassName); |
| 4754 | +// } else if (javaClassName.length() == 0) { |
| 4755 | +// // local inner class within an anonymous class |
| 4756 | +// javaClassName = javaClass.getBinaryName(); |
| 4757 | + } |
4735 | 4758 | if (javaClassName.indexOf("$lambda") >= 0) |
4736 | 4759 | return "'" + getFinalJ2SClassName(javaClassName, FINAL_RAW) + "'"; |
4737 | | - String name = removeBracketsAndFixNullPackageName(javaClassName); |
4738 | | - String packageName = getPackageName(javaClass); |
4739 | | -// if (name.indexOf(packageName) != 0) { |
4740 | | -// dumpStack("???? packageName " + packageName + " " + name); |
4741 | | -// } |
4742 | | - name = name.substring(packageName.length() + 1); |
| 4760 | + String name = removeBracketsAndFixNullPackageName(javaClassName).substring(packageName.length() + 1); |
4743 | 4761 | String[] parts = name.split("\\."); |
4744 | 4762 | String s = packageName + "." + parts[0]; |
4745 | 4763 | int len = parts.length; |
@@ -5780,10 +5798,12 @@ private void addDummyClassForPackageOnlyFile() { |
5780 | 5798 | } |
5781 | 5799 |
|
5782 | 5800 | public boolean visit(AnnotationTypeDeclaration node) { |
| 5801 | + System.out.println(">>AnnotationTypeDecl " + node); |
5783 | 5802 | return false; |
5784 | 5803 | } |
5785 | 5804 |
|
5786 | 5805 | public boolean visit(AnnotationTypeMemberDeclaration node) { |
| 5806 | + System.out.println(">>AnnotationTypeMembDecl " + node); |
5787 | 5807 | return false; |
5788 | 5808 | } |
5789 | 5809 |
|
|
0 commit comments