Java Constructor Super parameters
class, constructor, inheritance, java
Solution
Seems like a documentation mistake.
ByteBuffer source on GrepCode has it right.
ByteBuffer(int mark, int pos, int lim, int cap, // package-private
274 byte[] hb, int offset)
275 {
276 super(mark, pos, lim, cap);
277 this.hb = hb;
278 this.offset = offset;
279 }
280
Problem
Looking at the code for the abstract class `ByteBuffer` it's apparent it inherits from the base class `Buffer`. `ByteBuffer` has a single constructor: ``` ByteBuffer(int capacity) { super(capacity); } ``` And `Buffer` has a single constructor: ``` Buffer(int mark, int pos, int lim, int cap) { ... } ``` So my question is - When `ByteBuffer` calls it's parent constructor, how does this work, because the parameters don't match? UPDATE: This is a non-question, but worth knowing that some online Java source repositories (docjar in this case) hold a mish-mash of Java source. Best to download the JDK **