Skip to content

Commit e3c90f8

Browse files
hansonrhansonr
authored andcommitted
Integer.TYPE does not include isArray$() or isPrimitive$()
1 parent ffdc322 commit e3c90f8

File tree

6 files changed

+73
-62
lines changed

6 files changed

+73
-62
lines changed

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

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -109,21 +109,21 @@ public Card(String cardName, Component cardComponent) {
109109
*/
110110
int vgap;
111111

112-
/**
113-
* @serialField tab Hashtable
114-
* deprectated, for forward compatibility only
115-
* @serialField hgap int
116-
* @serialField vgap int
117-
* @serialField vector Vector
118-
* @serialField currentCard int
119-
*/
120-
private static final ObjectStreamField[] serialPersistentFields = {
121-
new ObjectStreamField("tab", Hashtable.class),
122-
new ObjectStreamField("hgap", Integer.TYPE),
123-
new ObjectStreamField("vgap", Integer.TYPE),
124-
new ObjectStreamField("vector", Vector.class),
125-
new ObjectStreamField("currentCard", Integer.TYPE)
126-
};
112+
// /**
113+
// * @serialField tab Hashtable
114+
// * deprectated, for forward compatibility only
115+
// * @serialField hgap int
116+
// * @serialField vgap int
117+
// * @serialField vector Vector
118+
// * @serialField currentCard int
119+
// */
120+
// private static final ObjectStreamField[] serialPersistentFields = {
121+
// new ObjectStreamField("tab", Hashtable.class),
122+
// new ObjectStreamField("hgap", Integer.TYPE),
123+
// new ObjectStreamField("vgap", Integer.TYPE),
124+
// new ObjectStreamField("vector", Vector.class),
125+
// new ObjectStreamField("currentCard", Integer.TYPE)
126+
// };
127127

128128
/**
129129
* Creates a new card layout with gaps of size zero.

sources/net.sf.j2s.java.core/src/java/io/InputStreamReader.java

Lines changed: 31 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030

3131
import java.io.IOException;
3232
import java.io.UnsupportedEncodingException;
33+
import java.nio.charset.Charset;
34+
import java.nio.charset.CharsetDecoder;
3335

3436
/**
3537
* An InputStreamReader is a bridge from byte streams to character streams: It
@@ -103,37 +105,38 @@ public InputStreamReader(InputStream in, String charsetName)
103105
//sd = StreamDecoder.forInputStreamReader(in, this, charsetName);
104106
}
105107

106-
// /**
107-
// * Creates an InputStreamReader that uses the given charset. </p>
108-
// *
109-
// * @param in An InputStream
110-
// * @param cs A charset
111-
// *
112-
// * @since 1.4
113-
// * @spec JSR-51
114-
// */
115-
// public InputStreamReader(InputStream in, Charset cs) {
116-
// super(in);
117-
// if (cs == null)
118-
// throw new NullPointerException("charset");
108+
/**
109+
* Creates an InputStreamReader that uses the given charset. </p>
110+
*
111+
* @param in An InputStream
112+
* @param cs A charset
113+
*
114+
* @since 1.4
115+
* @spec JSR-51
116+
*/
117+
public InputStreamReader(InputStream in, Charset cs) {
118+
super(in);
119+
if (cs == null)
120+
throw new NullPointerException("charset");
119121
// sd = StreamDecoder.forInputStreamReader(in, this, cs);
120-
// }
122+
}
121123

122-
// /**
123-
// * Creates an InputStreamReader that uses the given charset decoder. </p>
124-
// *
125-
// * @param in An InputStream
126-
// * @param dec A charset decoder
127-
// *
128-
// * @since 1.4
129-
// * @spec JSR-51
130-
// */
131-
// public InputStreamReader(InputStream in, CharsetDecoder dec) {
132-
// super(in);
133-
// if (dec == null)
134-
// throw new NullPointerException("charset decoder");
124+
/**
125+
* Creates an InputStreamReader that uses the given charset decoder. </p>
126+
*
127+
* @param in An InputStream
128+
* @param dec A charset decoder
129+
*
130+
* @since 1.4
131+
* @spec JSR-51
132+
*/
133+
public InputStreamReader(InputStream in, CharsetDecoder dec) {
134+
super(in);
135+
System.err.println("SwingJS java.io.InputStreamReader(InputStream, CharsetDecoder) is not implemented");
136+
if (dec == null)
137+
throw new NullPointerException("charset decoder");
135138
// sd = StreamDecoder.forInputStreamReader(in, this, dec);
136-
// }
139+
}
137140

138141
/**
139142
* Returns the name of the character encoding being used by this stream.

sources/net.sf.j2s.java.core/src/java/io/OutputStreamWriter.java

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
import java.io.IOException;
3333
import java.io.StringWriter;
3434
import java.io.UnsupportedEncodingException;
35+
import java.nio.charset.Charset;
3536
//import java.nio.charset.Charset;
3637
//import java.nio.charset.CharsetEncoder;
3738
//import sun.nio.cs.StreamEncoder;
@@ -138,24 +139,24 @@ public OutputStreamWriter(OutputStream out) {
138139
}
139140
}
140141

141-
// /**
142-
// * Creates an OutputStreamWriter that uses the given charset. </p>
143-
// *
144-
// * @param out
145-
// * An OutputStream
146-
// *
147-
// * @param cs
148-
// * A charset
149-
// *
150-
// * @since 1.4
151-
// * @spec JSR-51
152-
// */
153-
// public OutputStreamWriter(OutputStream out, Charset cs) {
154-
// super(out);
155-
// if (cs == null)
156-
// throw new NullPointerException("charset");
142+
/**
143+
* Creates an OutputStreamWriter that uses the given charset. </p>
144+
*
145+
* @param out
146+
* An OutputStream
147+
*
148+
* @param cs
149+
* A charset
150+
*
151+
* @since 1.4
152+
* @spec JSR-51
153+
*/
154+
public OutputStreamWriter(OutputStream out, Charset cs) {
155+
super(out);
156+
if (cs == null)
157+
throw new NullPointerException("charset");
157158
// se = StreamEncoder.forOutputStreamWriter(out, this, cs);
158-
// }
159+
}
159160

160161
/**
161162
* Creates an OutputStreamWriter that uses the given charset encoder. </p>

sources/net.sf.j2s.java.core/src/test/Test_Class.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,10 @@ Class C() {
191191

192192
public static void main(String[] args) {
193193

194+
System.out.println(Integer.TYPE.isPrimitive());
195+
System.out.println(Integer.TYPE.isArray());
196+
197+
194198
class LocalClass {
195199

196200
String hello() {

sources/net.sf.j2s.java.core/src/test/Test_Java8.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,8 @@ public boolean test(String t) {
155155

156156
public static void main(String[] args) {
157157

158+
// TODO: Nodes.flatten issue?
159+
158160
Function<String, Test_Java8> iaCreator2 = Test_Java8::new;
159161
iaCreator2.apply("testNew");
160162

sources/net.sf.j2s.java.core/srcjs/js/j2sClazz.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
// TODO: still a lot of references to window[...]
1111

12+
// BH 2019.09.24 missing isArray$() in Integer.class
1213
// BH 2019.09.26 superfast byte[] -> String using TextDecoder
1314
// BH 2019.08.16 adds cache for instanceof
1415
// BH 2019.07.27 fixes array(intArray).clone
@@ -3428,7 +3429,8 @@ var setJ2STypeclass = function(cl, type, paramCode) {
34283429
// TODO -- should be a proper Java.lang.Class
34293430
primTypes[paramCode] = cl;
34303431
cl.TYPE = {
3431-
isPrimitive: function() { return true },
3432+
isArray$: function() { return false },
3433+
isPrimitive$: function() { return true },
34323434
type:type,
34333435
__PARAMCODE:paramCode,
34343436
__PRIMITIVE:1 // referenced in java.lang.Class
@@ -5703,4 +5705,3 @@ if (!Clazz._loadcore || J2S._coreFiles.length == 0) {
57035705

57045706
})(Clazz, J2S);
57055707
}; // called by external application
5706-

0 commit comments

Comments
 (0)