mirror of
https://github.com/github/codeql.git
synced 2026-04-25 16:55:19 +02:00
Java: note that classes with entirely private constructors can't be subclassed
This commit is contained in:
@@ -30,4 +30,18 @@ public class Test {
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public static class AllPrivateConstructors {
|
||||
Thread myThread;
|
||||
|
||||
private AllPrivateConstructors() {
|
||||
myThread = new Thread("myThread");
|
||||
// OK - class cannot be extended outside this file, and is not in fact extended
|
||||
myThread.start();
|
||||
}
|
||||
|
||||
public static AllPrivateConstructors create() {
|
||||
return new AllPrivateConstructors();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user