Hi Sven,

Your intuition is right, you need to modify associated templates e.g.:

  jdk/src/java.base/share/classes/java/nio/*-X-Buffer.java.template

The best thing to do is pick an existing method common to all buffers (such as 
the existing slice method), work out how it is implemented and then copy the 
pattern. Looking at the generated source will also help, especially from an 
IDE, where you can see what generated classes implement and overrides e.g see:

  
build/macosx-x86_64-normal-server-release/support/gensrc/java.base/java/nio/ByteBuffer.java

There is likely a similar pattern to follow for the tests.

Paul.


> On 26 Sep 2015, at 18:41, Sven Reimers <sven.reim...@gmail.com> wrote:
> 
> Hi all,
> 
> what would it take to get JDK-5071718 into 9?
> 
> I thought about something like this;
> 
> /**
> Creates a new byte buffer whose content is a shared subsequence of this
> buffer's content.
> 
> The content of the new buffer will start at the given position. The
> capacity and limit of the new buffer will be the given length. Changes to
> this buffer's content will be visible in the new buffer, and vice versa;
> the two buffers' position, limit, and mark values will be independent.
> 
> The new buffer's position will be zero, and its mark will be undefined. The
> new buffer will be direct if, and only if, this buffer is direct, and it
> will be read-only if, and only if, this buffer is read-only.
> Returns:The new byte buffer
> **/
> public abstract ByteBuffer slice(int start, int length)
> 
> 
> Probably should emit some exception in case start or start+length are
> greater than the underlying buffer length. Any further ideas for required
> checks?
> 
> Seems I need to modify the templates to get this distributed to all the
> variants existing - not only ByteBuffer.
> 
> Anyone able to guide me and help me get this through - I am willing to
> provide implementation and tests if I know where to look for obstacles and
> challenges?
> 
> Thanks
> 
> Sven
> --
> Sven Reimers
> 
> * Senior Expert Software Architect
> * Java Champion
> * NetBeans Dream Team Member: http://dreamteam.netbeans.org
> * Community Leader  NetBeans: http://community.java.net/netbeans
>                              Desktop Java:
> http://community.java.net/javadesktop
> * JUG Leader JUG Bodensee: http://www.jug-bodensee.de
> * Duke's Choice Award Winner 2009
> * Blog: https://www.java.net//blog/sven

Reply via email to