Skip to content

Commit d5731bd

Browse files
authored
Merge pull request #108 from BobHanson/hanson1
Hanson1
2 parents 1d03d16 + 7133732 commit d5731bd

File tree

24 files changed

+334
-884
lines changed

24 files changed

+334
-884
lines changed
116 KB
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
20190814182015
1+
20190817161814
116 KB
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
20190814182015
1+
20190817161814
116 KB
Binary file not shown.

sources/net.sf.j2s.java.core/src/java/awt/JSDialog.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -690,10 +690,9 @@ protected String constructComponentName() {
690690
public void addNotify() {
691691
synchronized (getTreeLock()) {
692692
getOrCreatePeer();
693-
if (parent != null) {
694-
parent.addNotify();
695-
}
696-
super.addNotify();
693+
if (parent != null && parent.getPeer() == null)
694+
parent.addNotify();
695+
super.addNotify();
697696
}
698697
}
699698

sources/net.sf.j2s.java.core/src/java/lang/Class.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ private static class JSClass {
115115
public String __CLASS_NAME__;
116116
}
117117
private JSClass $clazz$; // BH SwingJS
118-
private String[] $methodList$; // BH SwingJS for proxy interfaces
118+
public String[] $methodList$; // BH see j2sClazz.js Clazz.getClass, from interface parameters
119119

120120
// private static native void registerNatives();
121121
//
@@ -139,6 +139,7 @@ private Class() {
139139
*
140140
* @return a string representation of this class object.
141141
*/
142+
@Override
142143
public String toString() {
143144
return (isInterface() ? "interface " : (isPrimitive() ? "" : "class ")) + getName();
144145
}
@@ -769,7 +770,7 @@ ClassLoader getClassLoader0() {
769770
* Specification, 3rd edition
770771
* @since 1.5
771772
*/
772-
@SuppressWarnings("unchecked")
773+
@Override
773774
public TypeVariable<Class<T>>[] getTypeParameters() {
774775
// if (getGenericSignature() != null)
775776
// return (TypeVariable<Class<T>>[]) getGenericInfo().getTypeParameters();
@@ -1811,7 +1812,7 @@ private void addField(Field[] fields, String m, int modifiers) {
18111812
*
18121813
* @param name
18131814
* the name of the method
1814-
* @param parameterTypes
1815+
* @param paramTypes
18151816
* the list of parameters
18161817
* @return the {@code Method} object that matches the specified {@code name}
18171818
* and {@code parameterTypes}
@@ -1852,7 +1853,7 @@ public Method getMethod(String name, Class<?>... paramTypes) throws NoSuchMethod
18521853
Method m = new Method(this, name, paramTypes, null, null, 0);
18531854
if (!isInterface()) {
18541855
Object o = null;
1855-
String qname = name + argumentTypesToString(paramTypes);
1856+
String qname = m.getSignature();
18561857
/**
18571858
* @j2sNative
18581859
*
@@ -1925,15 +1926,11 @@ public Method getMethod(String name, Class<?>... paramTypes) throws NoSuchMethod
19251926
*
19261927
* @since JDK1.1
19271928
*/
1928-
@SuppressWarnings("unchecked")
19291929
public Constructor<T> getConstructor(Class<?>... parameterTypes) throws NoSuchMethodException, SecurityException {
19301930
// be very careful not to change the stack depth of this
19311931
// checkMemberAccess call for security reasons
19321932
// see java.lang.SecurityManager.checkMemberAccess
19331933
// checkMemberAccess(Member.PUBLIC, ClassLoader.getCallerClassLoader());
1934-
Class<?>[] x = parameterTypes;
1935-
if (parameterTypes == null)
1936-
parameterTypes = new Class<?>[0];
19371934
return new Constructor(this, parameterTypes, new Class<?>[0], Member.PUBLIC);
19381935
// return getConstructor0(parameterTypes, Member.PUBLIC);
19391936
}
@@ -3218,6 +3215,8 @@ public static String argumentTypesToString(Class<?>[] parameterTypes) {
32183215
// */
32193216
// private static final ObjectStreamField[] serialPersistentFields = new ObjectStreamField[0];
32203217

3218+
public static final Class<?>[] NO_PARAMETERS = new Class<?>[0];
3219+
32213220
// /**
32223221
// * Returns the assertion status that would be assigned to this class if it
32233222
// * were to be initialized at the time this method is invoked. If this class
@@ -3295,7 +3294,7 @@ public boolean isEnum() {
32953294
// private static ReflectionFactory reflectionFactory;
32963295
//
32973296
// To be able to query system properties as soon as they're available
3298-
private static boolean initted = false;
3297+
// private static boolean initted = false;
32993298

33003299
// private static void checkInitted() {
33013300
// if (initted)
@@ -3558,8 +3557,9 @@ public boolean equals(Object o) {
35583557
/**
35593558
* A SwingJS method for Constructor and Method
35603559
*
3561-
* @param parameterTypes
3560+
* @param types
35623561
* @param args
3562+
* @param isProxy
35633563
* @return
35643564
*/
35653565
public static Object[] getArgumentArray(Class<?>[] types, Object[] args, boolean isProxy) {

sources/net.sf.j2s.java.core/src/java/lang/reflect/Constructor.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,10 @@ public Constructor(Class<T> declaringClass, Class<?>[] parameterTypes, Class<?>[
4646
// NO!! wrong: all of the SwingJS primitive classes run without parameterization
4747
//if (";Integer;Long;Short;Byte;Float;Double;".indexOf(";" + declaringClass.getName() + ";") >= 0)
4848
//parameterTypes = null;
49-
this.parameterTypes = parameterTypes;
49+
// Special case - constructors with parameters have c$$, not just c$. For whatever reason!
50+
// This signals NOT to add "$" if there are no parameters.
51+
if (parameterTypes == null)
52+
parameterTypes = Class.NO_PARAMETERS;
5053
this.signature = "c$" + Class.argumentTypesToString(parameterTypes);
5154
constr = /** @j2sNative this.Class_.$clazz$[this.signature] || */ null;
5255
}

sources/net.sf.j2s.java.core/src/java/lang/reflect/Method.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,14 @@ public Method(Class<?> declaringClass, String name, Class<?>[] parameterTypes, C
4646
Class<?>[] checkedExceptions, int modifiers) {
4747
this.Class_ = declaringClass;
4848
this.name = name;
49-
this.parameterTypes = parameterTypes;
49+
this.parameterTypes = (parameterTypes == null ? Class.NO_PARAMETERS : parameterTypes);
5050
this.returnType = returnType;
5151
this.exceptionTypes = checkedExceptions;
5252
this.modifiers = modifiers;
53-
this.signature = name + Class.argumentTypesToString(parameterTypes);
53+
// modifier PUBLIC means this is from Class.java getMethods
54+
if (parameterTypes != null && parameterTypes.length == 0)
55+
parameterTypes = null;
56+
this.signature = (declaringClass.$methodList$ == null ? name + Class.argumentTypesToString(parameterTypes) : name);
5457
}
5558

5659
/**
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
/*
2+
* ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
3+
*
4+
*
5+
*
6+
*
7+
*
8+
*
9+
*
10+
*
11+
*
12+
*
13+
*
14+
*
15+
*
16+
*
17+
*
18+
*
19+
*
20+
*
21+
*
22+
*
23+
*/
24+
25+
/*
26+
* Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
27+
*/
28+
29+
package javax.xml.stream;
30+
31+
/**
32+
* Provides information on the location of an event.
33+
*
34+
* All the information provided by a Location is optional. For example
35+
* an application may only report line numbers.
36+
*
37+
* @version 1.0
38+
* @author Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
39+
* @since 1.6
40+
*/
41+
public interface Location {
42+
/**
43+
* Return the line number where the current event ends,
44+
* returns -1 if none is available.
45+
* @return the current line number
46+
*/
47+
int getLineNumber();
48+
49+
/**
50+
* Return the column number where the current event ends,
51+
* returns -1 if none is available.
52+
* @return the current column number
53+
*/
54+
int getColumnNumber();
55+
56+
/**
57+
* Return the byte or character offset into the input source this location
58+
* is pointing to. If the input source is a file or a byte stream then
59+
* this is the byte offset into that stream, but if the input source is
60+
* a character media then the offset is the character offset.
61+
* Returns -1 if there is no offset available.
62+
* @return the current offset
63+
*/
64+
int getCharacterOffset();
65+
66+
/**
67+
* Returns the public ID of the XML
68+
* @return the public ID, or null if not available
69+
*/
70+
public String getPublicId();
71+
72+
/**
73+
* Returns the system ID of the XML
74+
* @return the system ID, or null if not available
75+
*/
76+
public String getSystemId();
77+
}

0 commit comments

Comments
 (0)