Skip to content
This repository was archived by the owner on Apr 30, 2025. It is now read-only.

Commit f245c2f

Browse files
committed
Do not reference System.out or System.err if possible
1 parent 9d48cb4 commit f245c2f

File tree

16 files changed

+26
-327
lines changed

16 files changed

+26
-327
lines changed

jtransc-rt-core/src/com/jtransc/compression/jzlib/Adler32.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ public void reset(long init){
135135
adler.reset();
136136
}
137137
else{
138-
System.err.println("unsupported operation");
138+
JTranscConsole.error("unsupported operation");
139139
}
140140
}
141141
public long getValue(){

jtransc-rt/regexodus/src/regexodus/CharacterClass.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
package regexodus;
3131

3232
import com.jtransc.annotation.JTranscInvisible;
33+
import com.jtransc.io.JTranscConsole;
3334
import regexodus.ds.IntBitSet;
3435

3536
import java.util.ArrayList;
@@ -886,9 +887,9 @@ public static void main(String[] args) {
886887

887888

888889
private static void printRealm(ArrayList<String> realm, String name) {
889-
System.out.println(name + ":");
890+
JTranscConsole.log(name + ":");
890891
for (String s : realm) {
891-
System.out.println(" " + s);
892+
JTranscConsole.log(" " + s);
892893
}
893894
}
894895
}

jtransc-rt/src/java/io/JTranscFileSystem.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,8 +164,8 @@ public long getLastModifiedTime(File f) {
164164
}
165165

166166
public long getLength(File f) {
167-
//System.out.println(f.getPath());
168-
//System.out.println(f.getAbsolutePath());
167+
//JTranscConsole.log(f.getPath());
168+
//JTranscConsole.log(f.getAbsolutePath());
169169
return JTranscSyncIO.impl.getLength(normalize2(f));
170170
}
171171

jtransc-rt/src/java/io/RandomAccessFile.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public RandomAccessFile(File file, String mode) throws FileNotFoundException {
5353
fd = new FileDescriptor();
5454
//fd.attach(this);
5555
path = name;
56-
//System.out.println("RandomAccessFile");
56+
//JTranscConsole.log("RandomAccessFile");
5757
jfd = JTranscSyncIO.impl.open(name, imode);
5858
}
5959

jtransc-rt/src/java/lang/Class.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -371,11 +371,11 @@ public boolean desiredAssertionStatus() {
371371
public T[] getEnumConstants() {
372372
T[] values = getEnumConstantsShared();
373373
if (values == null) {
374-
System.out.println("Class " + this + " is not an enum (" + isEnum() + ")!");
374+
JTranscConsole.log("Class " + this + " is not an enum (" + isEnum() + ")!");
375375

376376
try {
377377
final Method valuesMethod = getMethod("values");
378-
System.out.println("values method:" + valuesMethod);
378+
JTranscConsole.log("values method:" + valuesMethod);
379379
} catch (NoSuchMethodException e) {
380380
throw new Error(e);
381381
}

jtransc-rt/src/java/lang/Integer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ public static int _parseInt(String input, int radix) {
111111
}
112112
result *= radix;
113113
result += JTranscCType.decodeDigit(c);
114-
//System.out.println(c + ": " + JTranscCType.decodeDigit(c));
114+
//JTranscConsole.log(c + ": " + JTranscCType.decodeDigit(c));
115115
}
116116
return sign * result;
117117
}

jtransc-rt/src/java/lang/Thread.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import com.jtransc.annotation.JTranscMethodBody;
2323
import com.jtransc.annotation.haxe.HaxeAddMembers;
2424
import com.jtransc.annotation.haxe.HaxeMethodBody;
25+
import com.jtransc.io.JTranscConsole;
2526

2627
import java.util.Collection;
2728
import java.util.HashMap;
@@ -208,7 +209,7 @@ public synchronized void start() {
208209
"});"
209210
)
210211
private void _start() {
211-
System.err.println("WARNING: Threads not supported! Executing thread code in the parent's thread!");
212+
JTranscConsole.error("WARNING: Threads not supported! Executing thread code in the parent's thread!");
212213
runInternal();
213214
}
214215

@@ -294,7 +295,7 @@ public void destroy() {
294295
}
295296

296297
public final boolean isAlive() {
297-
//System.out.println("isAlive: " + _isAlive);
298+
//JTranscConsole.log("isAlive: " + _isAlive);
298299
return _isAlive;
299300
}
300301

@@ -426,8 +427,8 @@ public interface UncaughtExceptionHandler {
426427
}
427428

428429
static public UncaughtExceptionHandler defaultUncaughtExceptionHandler = (t, e) -> {
429-
System.out.println(t);
430-
System.out.println(e);
430+
JTranscConsole.log(t);
431+
JTranscConsole.log(e);
431432
};
432433

433434
public static void setDefaultUncaughtExceptionHandler(UncaughtExceptionHandler eh) {

jtransc-rt/src/java/lang/ThreadGroup.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616

1717
package java.lang;
1818

19+
import com.jtransc.io.JTranscConsole;
20+
1921
import java.util.ArrayList;
2022
import java.util.Arrays;
2123
import java.util.LinkedHashSet;
@@ -175,7 +177,7 @@ synchronized public final void destroy() {
175177
}
176178

177179
public void list() {
178-
System.out.println("Unimplemented ThreadGroup.list()");
180+
JTranscConsole.log("Unimplemented ThreadGroup.list()");
179181
}
180182

181183
native public void uncaughtException(Thread t, Throwable e);

jtransc-rt/src/java/lang/reflect/_InternalUtils.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,6 @@ static Type parseType(String str, Type owner) {
4343

4444
static Type parseType(MStringReader sr, Type owner) {
4545
char c = sr.read();
46-
//System.out.println("parseType:sr=" + sr.str + ":owner=" + owner.getTypeName());
47-
//System.out.println("parseType:sr=" + sr.str);
4846
switch (c) {
4947
case '(':
5048
Type[] args = parseTypes(sr, owner);
@@ -76,10 +74,8 @@ static Type parseType(MStringReader sr, Type owner) {
7674
Type type = parseType(sr, owner);
7775
int end = sr.offset;
7876
if (type instanceof Class<?>) {
79-
//System.out.println("AAAAAAAAAAAA");
8077
return Class_forName0(sr.str.substring(start, end));
8178
} else {
82-
//System.out.println("BBBBBBBBBBBB");
8379
return new ArrayType(type);
8480
}
8581
case 'L':

jtransc-rt/src/java/net/URI.java

Lines changed: 0 additions & 104 deletions
Original file line numberDiff line numberDiff line change
@@ -22,110 +22,6 @@
2222
import java.net.internal.UrlUtils;
2323
import java.util.Locale;
2424

25-
/**
26-
* A Uniform Resource Identifier that identifies an abstract or physical
27-
* resource, as specified by <a href="http://www.ietf.org/rfc/rfc2396.txt">RFC
28-
* 2396</a>.
29-
*
30-
* <h3>Parts of a URI</h3>
31-
* A URI is composed of many parts. This class can both parse URI strings into
32-
* parts and compose URI strings from parts. For example, consider the parts of
33-
* this URI:
34-
* {@code http://username:password@host:8080/directory/file?query#fragment}
35-
* <table>
36-
* <tr><th>Component </th><th>Example value </th><th>Also known as</th></tr>
37-
* <tr><td>{@link #getScheme() Scheme} </td><td>{@code http} </td><td>protocol</td></tr>
38-
* <tr><td>{@link #getSchemeSpecificPart() Scheme-specific part}</td><td>{@code //username:password@host:8080/directory/file?query#fragment}</td><td></td></tr>
39-
* <tr><td>{@link #getAuthority() Authority} </td><td>{@code username:password@host:8080} </td><td></td></tr>
40-
* <tr><td>{@link #getUserInfo() User Info} </td><td>{@code username:password} </td><td></td></tr>
41-
* <tr><td>{@link #getHost() Host} </td><td>{@code host} </td><td></td></tr>
42-
* <tr><td>{@link #getPort() Port} </td><td>{@code 8080} </td><td></td></tr>
43-
* <tr><td>{@link #getPath() Path} </td><td>{@code /directory/file} </td><td></td></tr>
44-
* <tr><td>{@link #getQuery() Query} </td><td>{@code query} </td><td></td></tr>
45-
* <tr><td>{@link #getFragment() Fragment} </td><td>{@code fragment} </td><td>ref</td></tr>
46-
* </table>
47-
*
48-
* <h3>Absolute vs. Relative URIs</h3>
49-
* URIs are either {@link #isAbsolute() absolute or relative}.
50-
* <ul>
51-
* <li><strong>Absolute:</strong> {@code http://android.com/robots.txt}
52-
* <li><strong>Relative:</strong> {@code robots.txt}
53-
* </ul>
54-
*
55-
* <p>Absolute URIs always have a scheme. If its scheme is supported by {@link
56-
* URL}, you can use {@link #toURL} to convert an absolute URI to a URL.
57-
*
58-
* <p>Relative URIs do not have a scheme and cannot be converted to URLs. If you
59-
* have the absolute URI that a relative URI is relative to, you can use {@link
60-
* #resolve} to compute the referenced absolute URI. Symmetrically, you can use
61-
* {@link #relativize} to compute the relative URI from one URI to another.
62-
* <pre> {@code
63-
* URI absolute = new URI("http://android.com/");
64-
* URI relative = new URI("robots.txt");
65-
* URI resolved = new URI("http://android.com/robots.txt");
66-
*
67-
* // print "http://android.com/robots.txt"
68-
* System.out.println(absolute.resolve(relative));
69-
*
70-
* // print "robots.txt"
71-
* System.out.println(absolute.relativize(resolved));
72-
* }</pre>
73-
*
74-
* <h3>Opaque vs. Hierarchical URIs</h3>
75-
* Absolute URIs are either {@link #isOpaque() opaque or hierarchical}. Relative
76-
* URIs are always hierarchical.
77-
* <ul>
78-
* <li><strong>Hierarchical:</strong> {@code http://android.com/robots.txt}
79-
* <li><strong>Opaque:</strong> {@code mailto:robots@example.com}
80-
* </ul>
81-
*
82-
* <p>Opaque URIs have both a scheme and a scheme-specific part that does not
83-
* begin with the slash character: {@code /}. The contents of the
84-
* scheme-specific part of an opaque URI is not parsed so an opaque URI never
85-
* has an authority, user info, host, port, path or query. An opaque URIs may
86-
* have a fragment, however. A typical opaque URI is
87-
* {@code mailto:robots@example.com}.
88-
* <table>
89-
* <tr><th>Component </th><th>Example value </th></tr>
90-
* <tr><td>Scheme </td><td>{@code mailto} </td></tr>
91-
* <tr><td>Scheme-specific part</td><td>{@code robots@example.com}</td></tr>
92-
* <tr><td>Fragment </td><td> </td></tr>
93-
* </table>
94-
* <p>Hierarchical URIs may have values for any URL component. They always
95-
* have a non-null path, though that path may be the empty string.
96-
*
97-
* <h3>Encoding and Decoding URI Components</h3>
98-
* Each component of a URI permits a limited set of legal characters. Other
99-
* characters must first be <i>encoded</i> before they can be embedded in a URI.
100-
* To recover the original characters from a URI, they may be <i>decoded</i>.
101-
* <strong>Contrary to what you might expect,</strong> this class uses the
102-
* term <i>raw</i> to refer to encoded strings. The non-<i>raw</i> accessors
103-
* return decoded strings. For example, consider how this URI is decoded:
104-
* {@code http://user:pa55w%3Frd@host:80/doc%7Csearch?q=green%20robots#over%206%22}
105-
* <table>
106-
* <tr><th>Component </th><th>Legal Characters </th><th>Other Constraints </th><th>Raw Value </th><th>Value</th></tr>
107-
* <tr><td>Scheme </td><td>{@code 0-9}, {@code a-z}, {@code A-Z}, {@code +-.} </td><td>First character must be in {@code a-z}, {@code A-Z}</td><td> </td><td>{@code http}</td></tr>
108-
* <tr><td>Scheme-specific part</td><td>{@code 0-9}, {@code a-z}, {@code A-Z}, {@code _-!.~'()*,;:$&+=?/[]@}</td><td>Non-ASCII characters okay </td><td>{@code //user:pa55w%3Frd@host:80/doc%7Csearch?q=green%20robots}</td><td>{@code //user:pa55w?rd@host:80/doc|search?q=green robots}</td></tr>
109-
* <tr><td>Authority </td><td>{@code 0-9}, {@code a-z}, {@code A-Z}, {@code _-!.~'()*,;:$&+=@[]} </td><td>Non-ASCII characters okay </td><td>{@code user:pa55w%3Frd@host:80} </td><td>{@code user:pa55w?rd@host:80}</td></tr>
110-
* <tr><td>User Info </td><td>{@code 0-9}, {@code a-z}, {@code A-Z}, {@code _-!.~'()*,;:$&+=} </td><td>Non-ASCII characters okay </td><td>{@code user:pa55w%3Frd} </td><td>{@code user:pa55w?rd}</td></tr>
111-
* <tr><td>Host </td><td>{@code 0-9}, {@code a-z}, {@code A-Z}, {@code -.[]} </td><td>Domain name, IPv4 address or [IPv6 address] </td><td> </td><td>host</td></tr>
112-
* <tr><td>Port </td><td>{@code 0-9} </td><td> </td><td> </td><td>{@code 80}</td></tr>
113-
* <tr><td>Path </td><td>{@code 0-9}, {@code a-z}, {@code A-Z}, {@code _-!.~'()*,;:$&+=/@} </td><td>Non-ASCII characters okay </td><td>{@code /doc%7Csearch} </td><td>{@code /doc|search}</td></tr>
114-
* <tr><td>Query </td><td>{@code 0-9}, {@code a-z}, {@code A-Z}, {@code _-!.~'()*,;:$&+=?/[]@}</td><td>Non-ASCII characters okay </td><td>{@code q=green%20robots} </td><td>{@code q=green robots}</td></tr>
115-
* <tr><td>Fragment </td><td>{@code 0-9}, {@code a-z}, {@code A-Z}, {@code _-!.~'()*,;:$&+=?/[]@}</td><td>Non-ASCII characters okay </td><td>{@code over%206%22} </td><td>{@code over 6"}</td></tr>
116-
* </table>
117-
* A URI's host, port and scheme are not eligible for encoding and must not
118-
* contain illegal characters.
119-
*
120-
* <p>To encode a URI, invoke any of the multiple-parameter constructors of this
121-
* class. These constructors accept your original strings and encode them into
122-
* their raw form.
123-
*
124-
* <p>To decode a URI, invoke the single-string constructor, and then use the
125-
* appropriate accessor methods to get the decoded components.
126-
*
127-
* <p>The {@link URL} class can be used to retrieve resources by their URI.
128-
*/
12925
@SuppressWarnings("all")
13026
public final class URI implements Comparable<URI>, Serializable {
13127

0 commit comments

Comments
 (0)