Skip to content

Commit a72694a

Browse files
authored
Merge pull request #140 from BobHanson/hanson1
3.2.7 fixes; tweaks of j2sApplet.js and j2sClazz.js
2 parents c50960d + 15a7dc6 commit a72694a

File tree

16 files changed

+131
-37
lines changed

16 files changed

+131
-37
lines changed
132 Bytes
Binary file not shown.
11 Bytes
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
20200113205904
1+
20200116195702
132 Bytes
Binary file not shown.
11 Bytes
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
20200113205904
1+
20200116195702

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2527,7 +2527,7 @@ private void processAnnotationTypeMemberDeclaration(AnnotationTypeMemberDeclarat
25272527
String retName = (ret.isPrimitive() ? ret.getName() : j2sNonPrimitiveName(ret, true));
25282528
buffer.append("a.push(['" + name + "','" + retName + (isArray ? "[]" : "") + "',");
25292529
if (def == null) {
2530-
if (ret.isPrimitive()) {
2530+
if (!isArray && ret.isPrimitive()) {
25312531
switch (ret.getName()) {
25322532
case "char":
25332533
buffer.append("'\0'");
@@ -2546,7 +2546,7 @@ private void processAnnotationTypeMemberDeclaration(AnnotationTypeMemberDeclarat
25462546
// buffer.append("\"" + mbinding.getAnnotations() + "\"");
25472547
//}
25482548
}
2549-
} else if (ret.isAnnotation()){
2549+
} else if (!isArray && ret.isAnnotation()){
25502550
buffer.append("'@" + getFinalJ2SClassName(getUnreplacedJavaClassNameQualified(def.resolveTypeBinding()), FINAL_RAW) + "'");
25512551
} else {
25522552
def.accept(this);
132 Bytes
Binary file not shown.

sources/net.sf.j2s.java.core/src/sun/reflect/annotation/AnnotationParser.java

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,8 @@ private static Object boxValue(Object val, Class<?> type) {
381381
return val;
382382
}
383383

384-
static Map<Class<? extends Annotation>, Annotation> parseAnnotations(String name, Class<?> c, boolean isMethod) {
384+
static Map<Class<? extends Annotation>, Annotation> parseAnnotations(String name, Class<?> c,
385+
boolean isMethod) {
385386
Object[][] __ANN_REC__ = getAnnotations(name, c.$clazz$, isMethod);
386387
if (__ANN_REC__ == null)
387388
return Collections.EMPTY_MAP;
@@ -390,15 +391,17 @@ static Map<Class<? extends Annotation>, Annotation> parseAnnotations(String name
390391
Map<Class<? extends Annotation>, Annotation> result = new LinkedHashMap<Class<? extends Annotation>, Annotation>();
391392
// note that qnames will be one longer than atData after fixing
392393
String[] qnames = getQNames(__ANN_REC__);
393-
String[] atData = getAtCodes(__ANN_REC__);
394-
for (int i = atData.length; --i >= 0;) {
395-
Annotation a = createAnnotation(qnames[i], atData[i]);
396-
if (a != null) {
397-
Class<? extends Annotation> klass = a.getClass();
398-
if (
399-
// AnnotationType.getInstance(klass).retention() == RetentionPolicy.RUNTIME &&
400-
result.put(klass, a) != null) {
401-
throw new AnnotationFormatError("Duplicate annotation for class: " + klass + ": " + a);
394+
if (qnames != null) { // @Xml... may have no qname data
395+
String[] atData = getAtCodes(__ANN_REC__);
396+
for (int i = atData.length; --i >= 0;) {
397+
Annotation a = createAnnotation(qnames[i], atData[i]);
398+
if (a != null) {
399+
Class<? extends Annotation> klass = a.getClass();
400+
if (
401+
// AnnotationType.getInstance(klass).retention() == RetentionPolicy.RUNTIME &&
402+
result.put(klass, a) != null) {
403+
throw new AnnotationFormatError("Duplicate annotation for class: " + klass + ": " + a);
404+
}
402405
}
403406
}
404407
}

sources/net.sf.j2s.java.core/src/swingjs/xml/JSJAXBClass.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,6 @@ private void removeField(String javaName) {
214214
for (int i = fields.size(); --i >= 0;) {
215215
if (javaName.equals(fields.get(i).javaName)) {
216216
fields.remove(i);
217-
System.out.println("jsjaxbclass (ignored)");
218217
marshallerFieldMap.remove(javaName);
219218
break;
220219
}

0 commit comments

Comments
 (0)