Skip to content

Commit c6c0d10

Browse files
committed
$fields$ and missing java.lang for java.lang.reflect/ and annotation/
//BH 2020.01.31 -- 3.2.7-v5 'L' used instead of 'J' in $fields$ //BH 2020.01.31 -- 3.2.7-v5 java.lang.reflect.* should not be truncated to reflect.*
1 parent 1314834 commit c6c0d10

File tree

3 files changed

+4327
-7
lines changed

3 files changed

+4327
-7
lines changed

sources/net.sf.j2s.core/src/net/sf/j2s/core/CorePlugin.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,10 @@ public class CorePlugin extends Plugin {
2525
* "net.sf.j2s.core.jar" not "net.sf.j2s.core.3.2.5"
2626
*
2727
*/
28-
public static String VERSION = "3.2.7-v3";
28+
public static String VERSION = "3.2.7-v5";
29+
// BH 2020.01.31 -- 3.2.7-v5 'L' used instead of 'J' in $fields$
30+
// BH 2020.01.31 -- 3.2.7-v5 java.lang.reflect.* should not be truncated to reflect.* in parameters
31+
// BH 2020.01.16 -- 3.2.7-v4 replaces extends java.awt.Component and javax.swing.JComponent
2932
// BH 2020.01.12 -- 3.2.7-v3 fixes JAXB annotation marshalling for 3.2.7
3033
// BH 2020.01.11 -- 3.2.7-v3 corrects and rewrites synthetic bridge creation with much cleaner heap usage
3134
// BH 2020.01.09 -- 3.2.7-v2 introduces @j2sAlias as a way of adding a custom method name, as in exports.

sources/net.sf.j2s.core/src/net/sf/j2s/core/Java2ScriptVisitor.java

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,8 @@
135135

136136
// TODO: superclass inheritance for JAXB XmlAccessorType
137137

138+
//BH 2020.01.31 -- 3.2.7-v5 'L' used instead of 'J' in $fields$
139+
//BH 2020.01.31 -- 3.2.7-v5 java.lang.reflect.* should not be truncated to reflect.*
138140
//BH 2020.01.16 -- 3.2.7-v4 replaces extends java.awt.Component and javax.swing.JComponent
139141
//BH 2020.01.12 -- 3.2.7-v3 fixes JAXB annotation marshalling for 3.2.7
140142
//BH 2020.01.11 -- 3.2.7-v3 corrects and rewrites synthetic bridge creation with much cleaner heap usage
@@ -535,7 +537,7 @@ private char getLastCharInBuffer() {
535537

536538
// order above can be changed, but typeCode order must then be adapted
537539

538-
private final static String typeCodes = "ZBCDFILHSO";
540+
private final static String typeCodes = "ZBCDFIJHSO";
539541

540542
private class FieldInfo {
541543
@SuppressWarnings("unchecked")
@@ -2656,7 +2658,6 @@ private void addEnumConstants(EnumDeclaration e, List<EnumConstantDeclaration> e
26562658
*
26572659
*
26582660
* @param field the field being declared
2659-
* @param fields
26602661
* @param isStatic
26612662
* @return true if anything was written to the buffer
26622663
*/
@@ -4831,9 +4832,12 @@ private String getMyJavaClassNameLambda(boolean andIncrement) {
48314832

48324833
static String stripJavaLang(String name) {
48334834
// shorten java.lang.XXX.YYY but not java.lang.xxx.YYY
4834-
String s = (!name.startsWith("java.lang.") || name.equals("java.lang.Object")
4835-
|| name.length() > 10 && !Character.isUpperCase(name.charAt(10)) ? name : name.substring(10));
4836-
return s;
4835+
return (
4836+
!name.startsWith("java.lang.")
4837+
|| name.equals("java.lang.Object")
4838+
|| name.length() > 10 && !Character.isUpperCase(name.charAt(10)) ?
4839+
name :
4840+
name.substring(10));
48374841
}
48384842

48394843
/**
@@ -5563,7 +5567,7 @@ private String j2sGetParamCode(ITypeBinding binding) {
55635567
name = "S";
55645568
break;
55655569
default:
5566-
name = NameMapper.checkClassReplacement(name).replace("java.lang.", "").replace('.', '_');
5570+
name = stripJavaLang(NameMapper.checkClassReplacement(name)).replace('.', '_');
55675571
break;
55685572
}
55695573
if (arrays != null) {

0 commit comments

Comments
 (0)