-
Bug
-
Resolution: Duplicate
-
P3
-
repo-valhalla
-
None
-
generic
-
generic
Compiling and running the following program results in a stack overflow error:
public value class Point {
int x;
int y;
Point(int x, int y) {
this.x = x;
this.y = y;
}
public static void main(String [] args) {
Point p1 = new Point(10, 20);
Point p2 = new Point(10, 20);
if (p1 != p2) {
System.out.println("Broken");
}
System.out.println("p1 = " + p1);
System.out.println("p2 = " + p2);
}
}
While running:
Exception in thread "main" java.lang.StackOverflowError
at java.base/java.lang.invoke.MethodType.<init>(MethodType.java:159)
at java.base/java.lang.invoke.MethodType.makeImpl(MethodType.java:341)
at java.base/java.lang.invoke.MethodType.methodType(MethodType.java:282)
at java.base/java.lang.runtime.PrimitiveObjectMethods$MethodHandleBuilder.referenceTypeEquals(PrimitiveObjectMethods.java:110)
at java.base/java.lang.runtime.PrimitiveObjectMethods.substitutableInvoker(PrimitiveObjectMethods.java:419)
at java.base/java.lang.runtime.PrimitiveObjectMethods.isSubstitutable(PrimitiveObjectMethods.java:373)
at java.base/java.lang.runtime.PrimitiveObjectMethods$MethodHandleBuilder.eq(PrimitiveObjectMethods.java:180)
at java.base/java.lang.runtime.PrimitiveObjectMethods.isSubstitutable(PrimitiveObjectMethods.java:373)
at java.base/java.lang.runtime.PrimitiveObjectMethods$MethodHandleBuilder.eq(PrimitiveObjectMethods.java:180)
at java.base/java.lang.runtime.PrimitiveObjectMethods.isSubstitutable(PrimitiveObjectMethods.java:373)
at java.base/java.lang.runtime.PrimitiveObjectMethods$MethodHandleBuilder.eq(PrimitiveObjectMethods.java:180)
at java.base/java.lang.runtime.PrimitiveObjectMethods.isSubstitutable(PrimitiveObjectMethods.java:373)
at java.base/java.lang.runtime.PrimitiveObjectMethods$MethodHandleBuilder.eq(PrimitiveObjectMethods.java:180)
at java.base/java.lang.runtime.PrimitiveObjectMethods.isSubstitutable(PrimitiveObjectMethods.java:373)
at java.base/java.lang.runtime.PrimitiveObjectMethods$MethodHandleBuilder.eq(PrimitiveObjectMethods.java:180)
at java.base/java.lang.runtime.PrimitiveObjectMethods.isSubstitutable(PrimitiveObjectMethods.java:373)
...
public value class Point {
int x;
int y;
Point(int x, int y) {
this.x = x;
this.y = y;
}
public static void main(String [] args) {
Point p1 = new Point(10, 20);
Point p2 = new Point(10, 20);
if (p1 != p2) {
System.out.println("Broken");
}
System.out.println("p1 = " + p1);
System.out.println("p2 = " + p2);
}
}
While running:
Exception in thread "main" java.lang.StackOverflowError
at java.base/java.lang.invoke.MethodType.<init>(MethodType.java:159)
at java.base/java.lang.invoke.MethodType.makeImpl(MethodType.java:341)
at java.base/java.lang.invoke.MethodType.methodType(MethodType.java:282)
at java.base/java.lang.runtime.PrimitiveObjectMethods$MethodHandleBuilder.referenceTypeEquals(PrimitiveObjectMethods.java:110)
at java.base/java.lang.runtime.PrimitiveObjectMethods.substitutableInvoker(PrimitiveObjectMethods.java:419)
at java.base/java.lang.runtime.PrimitiveObjectMethods.isSubstitutable(PrimitiveObjectMethods.java:373)
at java.base/java.lang.runtime.PrimitiveObjectMethods$MethodHandleBuilder.eq(PrimitiveObjectMethods.java:180)
at java.base/java.lang.runtime.PrimitiveObjectMethods.isSubstitutable(PrimitiveObjectMethods.java:373)
at java.base/java.lang.runtime.PrimitiveObjectMethods$MethodHandleBuilder.eq(PrimitiveObjectMethods.java:180)
at java.base/java.lang.runtime.PrimitiveObjectMethods.isSubstitutable(PrimitiveObjectMethods.java:373)
at java.base/java.lang.runtime.PrimitiveObjectMethods$MethodHandleBuilder.eq(PrimitiveObjectMethods.java:180)
at java.base/java.lang.runtime.PrimitiveObjectMethods.isSubstitutable(PrimitiveObjectMethods.java:373)
at java.base/java.lang.runtime.PrimitiveObjectMethods$MethodHandleBuilder.eq(PrimitiveObjectMethods.java:180)
at java.base/java.lang.runtime.PrimitiveObjectMethods.isSubstitutable(PrimitiveObjectMethods.java:373)
at java.base/java.lang.runtime.PrimitiveObjectMethods$MethodHandleBuilder.eq(PrimitiveObjectMethods.java:180)
at java.base/java.lang.runtime.PrimitiveObjectMethods.isSubstitutable(PrimitiveObjectMethods.java:373)
...
- duplicates
-
JDK-8280746 [lworld] Initial core libraries support for value classes
-
- Resolved
-