Skip to content

Commit

Permalink
Merge openj9-openjdk-jdk/openj9 into openj9
Browse files Browse the repository at this point in the history
Signed-off-by: J9 Build <[email protected]>
  • Loading branch information
j9build committed May 6, 2024
2 parents 4f0c962 + dd51ad8 commit 75dfc72
Show file tree
Hide file tree
Showing 43 changed files with 1,041 additions and 773 deletions.
2 changes: 1 addition & 1 deletion make/autoconf/flags-cflags.m4
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@ AC_DEFUN([FLAGS_SETUP_CFLAGS_HELPER],
CFLAGS_OS_DEF_JVM="-D_ALLBSD_SOURCE -D_DARWIN_C_SOURCE -D_XOPEN_SOURCE"
CFLAGS_OS_DEF_JDK="-D_ALLBSD_SOURCE -D_DARWIN_UNLIMITED_SELECT"
elif test "x$OPENJDK_TARGET_OS" = xaix; then
CFLAGS_OS_DEF_JVM="-DAIX -Dalloca'(size)'=__builtin_alloca'(size)' -D_LARGE_FILES"
CFLAGS_OS_DEF_JVM="-DAIX -D_LARGE_FILES"
CFLAGS_OS_DEF_JDK="-D_LARGE_FILES"
elif test "x$OPENJDK_TARGET_OS" = xbsd; then
CFLAGS_OS_DEF_JDK="-D_ALLBSD_SOURCE"
Expand Down
3 changes: 2 additions & 1 deletion src/java.base/share/classes/java/io/Console.java
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,8 @@ private static Console instantiateConsole(boolean istty) {
/*
* The JdkConsole provider used for Console instantiation can be specified
* with the system property "jdk.console", whose value designates the module
* name of the implementation, and which defaults to "java.base". If no
* name of the implementation, and which defaults to the value of
* {@code JdkConsoleProvider.DEFAULT_PROVIDER_MODULE_NAME}. If no
* providers are available, or instantiation failed, java.base built-in
* Console implementation is used.
*/
Expand Down
95 changes: 57 additions & 38 deletions src/java.base/share/classes/java/lang/classfile/Signature.java
Original file line number Diff line number Diff line change
Expand Up @@ -185,88 +185,107 @@ public static ClassTypeSig of(ClassTypeSig outerType, String className, TypeArg.
/**
* Models the type argument.
*
* @sealedGraph
* @since 22
*/
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
public sealed interface TypeArg
permits SignaturesImpl.TypeArgImpl {
public sealed interface TypeArg {

/**
* Indicator for whether a wildcard has default bound, no bound,
* an upper bound, or a lower bound
*
* @since 22
* Models an unbounded type argument {@code *}.
* @since 23
*/
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
public enum WildcardIndicator {

/**
* default bound wildcard (empty)
*/
DEFAULT,

/**
* unbounded indicator {@code *}
*/
UNBOUNDED,
public sealed interface Unbounded extends TypeArg permits SignaturesImpl.UnboundedTypeArgImpl {
}

/**
* upper-bounded indicator {@code +}
*/
EXTENDS,
/**
* Models a type argument with an explicit bound type.
* @since 23
*/
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
public sealed interface Bounded extends TypeArg permits SignaturesImpl.TypeArgImpl {

/**
* lower-bounded indicator {@code -}
* Models a type argument's wildcard indicator.
* @since 23
*/
SUPER;
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
public enum WildcardIndicator {

/**
* No wildcard (empty), an exact type. Also known as
* {@index invariant}.
*/
NONE,

/**
* Upper-bound indicator {@code +}. Also known as
* {@index covariant}.
*/
EXTENDS,

/**
* Lower-bound indicator {@code -}. Also known as
* {@index contravariant}.
*/
SUPER;
}

/** {@return the kind of wildcard} */
WildcardIndicator wildcardIndicator();

/** {@return the signature of the type bound} */
RefTypeSig boundType();
}

/** {@return the wildcard indicator} */
WildcardIndicator wildcardIndicator();

/** {@return the signature of the type bound, if any} */
Optional<RefTypeSig> boundType();

/**
* {@return a bounded type arg}
* @param boundType the bound
* @since 23
*/
public static TypeArg of(RefTypeSig boundType) {
public static TypeArg.Bounded of(RefTypeSig boundType) {
requireNonNull(boundType);
return of(WildcardIndicator.DEFAULT, Optional.of(boundType));
return bounded(Bounded.WildcardIndicator.NONE, boundType);
}

/**
* {@return an unbounded type arg}
* @since 23
*/
public static TypeArg unbounded() {
return of(WildcardIndicator.UNBOUNDED, Optional.empty());
public static TypeArg.Unbounded unbounded() {
return SignaturesImpl.UnboundedTypeArgImpl.INSTANCE;
}

/**
* {@return an upper-bounded type arg}
* @param boundType the upper bound
* @since 23
*/
public static TypeArg extendsOf(RefTypeSig boundType) {
public static TypeArg.Bounded extendsOf(RefTypeSig boundType) {
requireNonNull(boundType);
return of(WildcardIndicator.EXTENDS, Optional.of(boundType));
return bounded(Bounded.WildcardIndicator.EXTENDS, boundType);
}

/**
* {@return a lower-bounded type arg}
* @param boundType the lower bound
* @since 23
*/
public static TypeArg superOf(RefTypeSig boundType) {
public static TypeArg.Bounded superOf(RefTypeSig boundType) {
requireNonNull(boundType);
return of(WildcardIndicator.SUPER, Optional.of(boundType));
return bounded(Bounded.WildcardIndicator.SUPER, boundType);
}

/**
* {@return a bounded type arg}
* @param wildcard the wild card
* @param boundType optional bound type
* @since 23
*/
public static TypeArg of(WildcardIndicator wildcard, Optional<RefTypeSig> boundType) {
public static TypeArg.Bounded bounded(Bounded.WildcardIndicator wildcard, RefTypeSig boundType) {
requireNonNull(wildcard);
requireNonNull(boundType);
return new SignaturesImpl.TypeArgImpl(wildcard, boundType);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -391,21 +391,10 @@ private PoolEntry entryByIndex(int index, int lowerBoundTag, int upperBoundTag)

@Override
public AbstractPoolEntry.Utf8EntryImpl utf8EntryByIndex(int index) {
if (index <= 0 || index >= constantPoolCount) {
throw new ConstantPoolException("Bad CP UTF8 index: " + index);
}
PoolEntry info = cp[index];
if (info == null) {
int offset = cpOffset[index];
int tag = readU1(offset);
final int q = offset + 1;
if (tag != TAG_UTF8) throw new ConstantPoolException("Not a UTF8 - index: " + index);
AbstractPoolEntry.Utf8EntryImpl uinfo
= new AbstractPoolEntry.Utf8EntryImpl(this, index, buffer, q + 2, readU2(q));
cp[index] = uinfo;
return uinfo;
if (entryByIndex(index, TAG_UTF8, TAG_UTF8) instanceof AbstractPoolEntry.Utf8EntryImpl utf8) {
return utf8;
}
return (AbstractPoolEntry.Utf8EntryImpl) info;
throw new ConstantPoolException("Not a UTF8 - index: " + index);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -369,11 +369,11 @@ <S extends Signature> S mapSignature(S signature) {
Signature.ClassTypeSig.of(
cts.outerType().map(this::mapSignature).orElse(null),
map(cts.classDesc()),
cts.typeArgs().stream()
.map(ta -> Signature.TypeArg.of(
ta.wildcardIndicator(),
ta.boundType().map(this::mapSignature)))
.toArray(Signature.TypeArg[]::new));
cts.typeArgs().stream().map(ta -> switch (ta) {
case Signature.TypeArg.Unbounded u -> u;
case Signature.TypeArg.Bounded bta -> Signature.TypeArg.bounded(
bta.wildcardIndicator(), mapSignature(bta.boundType()));
}).toArray(Signature.TypeArg[]::new));
default -> signature;
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -280,24 +280,29 @@ public String signatureString() {
if (!typeArgs.isEmpty()) {
var sb = new StringBuilder();
sb.append('<');
for (var ta : typeArgs)
sb.append(((TypeArgImpl)ta).signatureString());
for (var ta : typeArgs) {
switch (ta) {
case TypeArg.Bounded b -> {
switch (b.wildcardIndicator()) {
case SUPER -> sb.append('-');
case EXTENDS -> sb.append('+');
}
sb.append(b.boundType().signatureString());
}
case TypeArg.Unbounded _ -> sb.append('*');
}
}
suffix = sb.append(">;").toString();
}
return prefix + className + suffix;
}
}

public static record TypeArgImpl(WildcardIndicator wildcardIndicator, Optional<RefTypeSig> boundType) implements Signature.TypeArg {
public static enum UnboundedTypeArgImpl implements TypeArg.Unbounded {
INSTANCE;
}

public String signatureString() {
return switch (wildcardIndicator) {
case DEFAULT -> boundType.get().signatureString();
case EXTENDS -> "+" + boundType.get().signatureString();
case SUPER -> "-" + boundType.get().signatureString();
case UNBOUNDED -> "*";
};
}
public static record TypeArgImpl(WildcardIndicator wildcardIndicator, RefTypeSig boundType) implements Signature.TypeArg.Bounded {
}

public static record TypeParamImpl(String identifier, Optional<RefTypeSig> classBound, List<RefTypeSig> interfaceBounds)
Expand Down
18 changes: 16 additions & 2 deletions src/java.base/share/man/java.1
Original file line number Diff line number Diff line change
Expand Up @@ -1103,15 +1103,29 @@ following:
.RS
.TP
\f[V]all\f[R]
Shows all categories of settings.
This is the default value.
Shows all categories of settings in \f[B]verbose\f[R] detail.
.TP
\f[V]locale\f[R]
Shows settings related to locale.
.TP
\f[V]properties\f[R]
Shows settings related to system properties.
.TP
\f[V]security\f[R]
Shows all settings related to security.
.RS
.PP
sub-category arguments for \f[V]security\f[R] include the following:
.IP \[bu] 2
\f[V]security:all\f[R] : shows all security settings
.IP \[bu] 2
\f[V]security:properties\f[R] : shows security properties
.IP \[bu] 2
\f[V]security:providers\f[R] : shows static security provider settings
.IP \[bu] 2
\f[V]security:tls\f[R] : shows TLS related security settings
.RE
.TP
\f[V]vm\f[R]
Shows the settings of the JVM.
.TP
Expand Down
55 changes: 0 additions & 55 deletions src/java.desktop/share/classes/sun/font/CodePointIterator.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,6 @@ public static CodePointIterator create(char[] text, int start, int limit) {
return new CharArrayCodePointIterator(text, start, limit);
}

public static CodePointIterator create(CharSequence text) {
return new CharSequenceCodePointIterator(text);
}

public static CodePointIterator create(CharacterIterator iter) {
return new CharacterIteratorCodePointIterator(iter);
}
Expand Down Expand Up @@ -129,57 +125,6 @@ public int charIndex() {
}
}

final class CharSequenceCodePointIterator extends CodePointIterator {
private CharSequence text;
private int index;

public CharSequenceCodePointIterator(CharSequence text) {
this.text = text;
}

public void setToStart() {
index = 0;
}

public void setToLimit() {
index = text.length();
}

public int next() {
if (index < text.length()) {
char cp1 = text.charAt(index++);
if (Character.isHighSurrogate(cp1) && index < text.length()) {
char cp2 = text.charAt(index+1);
if (Character.isLowSurrogate(cp2)) {
++index;
return Character.toCodePoint(cp1, cp2);
}
}
return cp1;
}
return DONE;
}

public int prev() {
if (index > 0) {
char cp2 = text.charAt(--index);
if (Character.isLowSurrogate(cp2) && index > 0) {
char cp1 = text.charAt(index - 1);
if (Character.isHighSurrogate(cp1)) {
--index;
return Character.toCodePoint(cp1, cp2);
}
}
return cp2;
}
return DONE;
}

public int charIndex() {
return index;
}
}

// note this has different iteration semantics than CharacterIterator
final class CharacterIteratorCodePointIterator extends CodePointIterator {
private CharacterIterator iter;
Expand Down
24 changes: 14 additions & 10 deletions src/jdk.jdeps/share/classes/com/sun/tools/javap/ClassWriter.java
Original file line number Diff line number Diff line change
Expand Up @@ -368,16 +368,20 @@ private void print(StringBuilder sb, Signature sig) {
}

private void print(StringBuilder sb, Signature.TypeArg ta) {
switch (ta.wildcardIndicator()) {
case DEFAULT -> print(sb, ta.boundType().get());
case UNBOUNDED -> sb.append('?');
case EXTENDS -> {
sb.append("? extends ");
print(sb, ta.boundType().get());
}
case SUPER -> {
sb.append("? super ");
print(sb, ta.boundType().get());
switch (ta) {
case Signature.TypeArg.Unbounded _ -> sb.append('?');
case Signature.TypeArg.Bounded bta -> {
switch (bta.wildcardIndicator()) {
case NONE -> print(sb, bta.boundType());
case EXTENDS -> {
sb.append("? extends ");
print(sb, bta.boundType());
}
case SUPER -> {
sb.append("? super ");
print(sb, bta.boundType());
}
}
}
}
}
Expand Down
Loading

0 comments on commit 75dfc72

Please sign in to comment.