-
Bug
-
Resolution: Fixed
-
P4
-
1.0, unknown, 1.1.2, 1.1.4, 1.2.0, 1.3.0
-
hopper
-
generic, sparc
-
generic, solaris_2.5, solaris_2.5.1, solaris_2.6, solaris_7
-
Verified
The compiler detects recursive constructors but not mutually recursive
constructors.
// This class is faulted
class SomeClass
{
SomeClass(String s) {
this("recursive " + s);
}
}
// This class is not faulted
class SomeClass
{
SomeClass(String s) {
this(s.charAt(0));
}
SomeClass(char c) {
this(String.valueOf(c));
}
}
constructors.
// This class is faulted
class SomeClass
{
SomeClass(String s) {
this("recursive " + s);
}
}
// This class is not faulted
class SomeClass
{
SomeClass(String s) {
this(s.charAt(0));
}
SomeClass(char c) {
this(String.valueOf(c));
}
}
- duplicates
-
JDK-4094668 Constructors should not invoke themselves.
-
- Closed
-
-
JDK-4210722 javac doesn't detect cyclic constructor invocation
-
- Closed
-
-
JDK-4044529 Mutually recursive constructors could be flagged as warning or error
-
- Closed
-