Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion user/super/com/google/gwt/emul/java/io/PrintStream.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
* See <a href="http://java.sun.com/j2se/1.5.0/docs/api/java/io/PrintStream.html">the official Java
* API doc</a> for details.
*/
public class PrintStream extends FilterOutputStream {
public class PrintStream extends FilterOutputStream implements Appendable {

/** Indicates whether or not this PrintStream has incurred an error. */
private boolean ioError = false;
Expand Down Expand Up @@ -195,4 +195,22 @@ protected void clearError() {
private void newline() {
print('\n');
}

@Override
public Appendable append(CharSequence csq) {
print(csq);
return this;
}

@Override
public Appendable append(CharSequence csq, int start, int end) {
print(csq.subSequence(start, end));
return this;
}

@Override
public Appendable append(char c) {
print(c);
return this;
}
}
3 changes: 2 additions & 1 deletion user/super/com/google/gwt/emul/java/io/Reader.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
/**
* Reads a stream of characters.
*/
public abstract class Reader {
public abstract class Reader implements Closeable {
/**
* The maximum buffer size to incrementally read in {@link #skip}.
*/
Expand All @@ -27,6 +27,7 @@ public abstract class Reader {
/**
* Closes the reader, and releases any associated resources.
*/
@Override
public abstract void close() throws IOException;

/**
Expand Down
3 changes: 2 additions & 1 deletion user/super/com/google/gwt/emul/java/lang/Boolean.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,14 @@
import static javaemul.internal.InternalPreconditions.checkNotNull;

import java.io.Serializable;
import java.lang.constant.Constable;
import javaemul.internal.JsUtils;
import jsinterop.annotations.JsMethod;

/**
* Wraps native <code>boolean</code> as an object.
*/
public final class Boolean implements Comparable<Boolean>, Serializable {
public final class Boolean implements Comparable<Boolean>, Serializable, Constable {

public static final Boolean FALSE = false;
public static final Boolean TRUE = true;
Expand Down
4 changes: 3 additions & 1 deletion user/super/com/google/gwt/emul/java/lang/Byte.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,12 @@
*/
package java.lang;

import java.lang.constant.Constable;

/**
* Wraps native <code>byte</code> as an object.
*/
public final class Byte extends Number implements Comparable<Byte> {
public final class Byte extends Number implements Comparable<Byte>, Constable {

public static final byte MIN_VALUE = (byte) 0x80;
public static final byte MAX_VALUE = (byte) 0x7F;
Expand Down
3 changes: 2 additions & 1 deletion user/super/com/google/gwt/emul/java/lang/Class.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import com.google.gwt.core.client.JavaScriptObject;

import java.lang.constant.Constable;
import java.lang.reflect.Type;
import javaemul.internal.annotations.DoNotInline;

Expand All @@ -29,7 +30,7 @@
*
* @param <T> the type of the object
*/
public final class Class<T> implements Type {
public final class Class<T> implements Type, Constable {

private static final int PRIMITIVE = 0x00000001;
private static final int INTERFACE = 0x00000002;
Expand Down
3 changes: 2 additions & 1 deletion user/super/com/google/gwt/emul/java/lang/Enum.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import com.google.gwt.core.client.JavaScriptObject;

import java.io.Serializable;
import java.lang.constant.Constable;
import jsinterop.annotations.JsIgnore;
import jsinterop.annotations.JsNonNull;
import jsinterop.annotations.JsType;
Expand All @@ -31,7 +32,7 @@
* @param <E>
*/
@JsType
public abstract class Enum<E extends Enum<E>> implements Comparable<E>, Serializable {
public abstract class Enum<E extends Enum<E>> implements Comparable<E>, Serializable, Constable {

@JsIgnore
public static <T extends Enum<T>> T valueOf(Class<T> enumType, String name) {
Expand Down
4 changes: 3 additions & 1 deletion user/super/com/google/gwt/emul/java/lang/Float.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,14 @@
*/
package java.lang;

import java.lang.constant.Constable;
import java.lang.constant.ConstantDesc;
import javaemul.internal.JsUtils;

/**
* Wraps a primitive <code>float</code> as an object.
*/
public final class Float extends Number implements Comparable<Float> {
public final class Float extends Number implements Comparable<Float>, Constable, ConstantDesc {
public static final float MAX_VALUE = 3.4028235e+38f;
public static final float MIN_VALUE = 1.4e-45f;
public static final int MAX_EXPONENT = 127;
Expand Down
4 changes: 3 additions & 1 deletion user/super/com/google/gwt/emul/java/lang/Integer.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,15 @@
*/
package java.lang;

import java.lang.constant.Constable;
import java.lang.constant.ConstantDesc;
import javaemul.internal.JsUtils;
import javaemul.internal.annotations.HasNoSideEffects;

/**
* Wraps a primitive <code>int</code> as an object.
*/
public final class Integer extends Number implements Comparable<Integer> {
public final class Integer extends Number implements Comparable<Integer>, Constable, ConstantDesc {

public static final int MAX_VALUE = 0x7fffffff;
public static final int MIN_VALUE = 0x80000000;
Expand Down
4 changes: 3 additions & 1 deletion user/super/com/google/gwt/emul/java/lang/Long.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,13 @@
*/
package java.lang;

import java.lang.constant.Constable;
import java.lang.constant.ConstantDesc;
import javaemul.internal.LongUtils;
import javaemul.internal.annotations.HasNoSideEffects;

/** Wraps a primitive <code>long</code> as an object. */
public final class Long extends Number implements Comparable<Long> {
public final class Long extends Number implements Comparable<Long>, Constable, ConstantDesc {

/** Use nested class to avoid clinit on outer. */
static class BoxedValues {
Expand Down
4 changes: 3 additions & 1 deletion user/super/com/google/gwt/emul/java/lang/String.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@

import java.io.Serializable;
import java.io.UnsupportedEncodingException;
import java.lang.constant.Constable;
import java.lang.constant.ConstantDesc;
import java.nio.charset.Charset;
import java.nio.charset.UnsupportedCharsetException;
import java.util.Comparator;
Expand Down Expand Up @@ -55,7 +57,7 @@
// Needed to have constructors not fail compilation internally at Google
@SuppressWarnings({ "ReturnValueIgnored", "unusable-by-js" })
public final class String implements Comparable<String>, CharSequence,
Serializable {
Serializable, Constable, ConstantDesc {
/* TODO(jat): consider whether we want to support the following methods;
*
* <ul>
Expand Down
8 changes: 7 additions & 1 deletion user/super/com/google/gwt/emul/java/lang/StringBuffer.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
* This class is an exact clone of {@link StringBuilder} except for the name.
* Any change made to one should be mirrored in the other.
*/
public final class StringBuffer extends AbstractStringBuilder {
public final class StringBuffer extends AbstractStringBuilder
implements Comparable<StringBuffer> {

public StringBuffer() {
super("");
Expand Down Expand Up @@ -187,4 +188,9 @@ public StringBuffer reverse() {
reverse0();
return this;
}

@Override
public int compareTo(StringBuffer other) {
return toString().compareTo(other.toString());
}
}
8 changes: 7 additions & 1 deletion user/super/com/google/gwt/emul/java/lang/StringBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
* This class is an exact clone of {@link StringBuffer} except for the name.
* Any change made to one should be mirrored in the other.
*/
public final class StringBuilder extends AbstractStringBuilder {
public final class StringBuilder extends AbstractStringBuilder
implements Comparable<StringBuilder> {

public StringBuilder() {
super("");
Expand Down Expand Up @@ -187,4 +188,9 @@ public StringBuilder reverse() {
reverse0();
return this;
}

@Override
public int compareTo(StringBuilder other) {
return toString().compareTo(other.toString());
}
}
19 changes: 19 additions & 0 deletions user/super/com/google/gwt/emul/java/lang/constant/Constable.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*
* Copyright 2025 GWT Project Authors
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package java.lang.constant;

public interface Constable {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*
* Copyright 2026 GWT Project Authors
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package java.lang.constant;

public interface ConstantDesc {
}
2 changes: 1 addition & 1 deletion user/super/com/google/gwt/emul/java/util/BitSet.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
* public static BitSet valueOf(ByteBuffer)
* public static BitSet valueOf(LongBuffer)
*/
public class BitSet {
public class BitSet implements Cloneable {
private static final int WORD_MASK = 0x7fffffff;
private static final int BITS_PER_WORD = 31;

Expand Down
2 changes: 1 addition & 1 deletion user/super/com/google/gwt/emul/java/util/EnumMap.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
* @param <K> key type
* @param <V> value type
*/
public class EnumMap<K extends Enum<K>, V> extends AbstractMap<K, V> {
public class EnumMap<K extends Enum<K>, V> extends AbstractMap<K, V> implements Cloneable {

private final class EntrySet extends AbstractSet<Entry<K, V>> {

Expand Down
2 changes: 1 addition & 1 deletion user/super/com/google/gwt/emul/java/util/EnumSet.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
*
* @param <E> enumeration type
*/
public abstract class EnumSet<E extends Enum<E>> extends AbstractSet<E> {
public abstract class EnumSet<E extends Enum<E>> extends AbstractSet<E> implements Cloneable {

/**
* Implemented via sparse array since the set size is finite. Iteration takes
Expand Down
Loading
Loading