Skip to content

Commit 06186a3

Browse files
committed
3.2.7_v4 automatically switches extends
java.awt.Component -> java.awt.Label javax.swing.JComponent -> javax.swing.JLabel
1 parent 15a7dc6 commit 06186a3

File tree

5 files changed

+19
-6
lines changed

5 files changed

+19
-6
lines changed
145 Bytes
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
20200116195702
1+
20200116221246
145 Bytes
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
20200116195702
1+
20200116221246

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

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@
135135

136136
// TODO: superclass inheritance for JAXB XmlAccessorType
137137

138+
//BH 2020.01.16 -- 3.2.7-v4 replaces extends java.awt.Component and javax.swing.JComponent
138139
//BH 2020.01.12 -- 3.2.7-v3 fixes JAXB annotation marshalling for 3.2.7
139140
//BH 2020.01.11 -- 3.2.7-v3 corrects and rewrites synthetic bridge creation with much cleaner heap usage
140141
//BH 2020.01.09 -- 3.2.7-v2 introduces @j2sAlias as a way of adding a custom method name, as in exports.
@@ -2004,7 +2005,8 @@ private boolean addClassOrInterface(ASTNode node, ITypeBinding binding, List<?>
20042005
this$0Name0 = this$0Name;
20052006
this$0Name = null;
20062007
finalShortClassName = getFinalJ2SClassName(
2007-
(isLambda ? getMyJavaClassNameLambda(true) : getUnreplacedJavaClassNameQualified(binding)), FINAL_P);
2008+
(isLambda ? getMyJavaClassNameLambda(true) : getUnreplacedJavaClassNameQualified(binding)),
2009+
FINAL_P);
20082010
if (finalShortClassName.startsWith("P$.")) {
20092011
// java.lang.x will return x, not P$.x
20102012
finalShortClassName = finalShortClassName.substring(3);
@@ -2143,14 +2145,24 @@ private boolean addClassOrInterface(ASTNode node, ITypeBinding binding, List<?>
21432145
} else {
21442146
hasDependents = true;
21452147
String superclassName = getUnreplacedJavaClassNameQualified(superclass);
2146-
if (superclassName == null || superclassName.length() == 0 || "java.lang.Object".equals(superclassName)) {
2148+
switch (superclassName == null ? "" : superclassName) {
2149+
case "":
2150+
case "java.lang.Object":
21472151
buffer.append("null");
2148-
} else {
2152+
break;
2153+
case "java.awt.Component":
2154+
buffer.append("'java.awt.Label'");
2155+
break;
2156+
case "javax.swing.JComponent":
2157+
buffer.append("'javax.swing.JLabel'");
2158+
break;
2159+
default:
21492160
if (isAnonymous) {
21502161
buffer.append(getFinalJ2SClassNameQualifier(null, superclass, superclassName, FINAL_ESCAPE));
21512162
} else {
21522163
buffer.append(getFinalInnerClassList(superclass, superclassName));
21532164
}
2165+
break;
21542166
}
21552167
}
21562168

@@ -2183,7 +2195,8 @@ private boolean addClassOrInterface(ASTNode node, ITypeBinding binding, List<?>
21832195
int pt = buffer.length();
21842196
while (!b.isTopLevel()) {
21852197
b = b.getDeclaringClass();
2186-
buffer.insert(pt, "'" + getFinalJ2SClassName(getUnreplacedJavaClassNameQualified(b), FINAL_RAW) + "',");
2198+
buffer.insert(pt,
2199+
"'" + getFinalJ2SClassName(getUnreplacedJavaClassNameQualified(b), FINAL_RAW) + "',");
21872200
}
21882201
}
21892202
buffer.append("'");

0 commit comments

Comments
 (0)