Interface Bug?
Closed this issue · 3 comments
I get a error if I use a interface that has some overloaded optional parameter. Uint8Array methods for example.
Exception in thread "Thread-14" java.lang.RuntimeException: java.lang.RuntimeException: java.lang.StringIndexOutOfBoundsException: String index out of range: 3
at com.dragome.web.enhancers.jsdelegate.JsDelegateGenerator.generate(JsDelegateGenerator.java:285)
public interface Uint8Array extends ArrayBufferView {
final int BYTES_PER_ELEMENT = 1;
int length();
short get(int index);
void set(int index, int value);
// void set(Uint8Array array);
void set(Uint8Array array, int offset);
// void set(int[] array);
void set(int[] array, int offset);
// void set(short[] array);
void set(short[] array, int offset);
Uint8Array subarray(int begin);
Uint8Array subarray(int begin, int end);
}
I can only have methods that have a offset, where the optional parameter is used. If I remove comments from the methods above the error pops up at compile. Maybe its related to optional parameter ?
even with the code below I get the above error.
public interface Uint8Array extends ArrayBufferView {
void set(Uint8Array array);
}
Is this issue solved with last PRs?
I'd like to improve JsDelegatorGenerator by giving a custom mechanism to desire which class needs to be returned as a result of certain method invocations, for example in case of canvas getContext it should allows the inspection of resulting js object to determine if it's 2d or gl context, returning a delegator of type CanvasRenderingContext2D or GLContext. Using a criteria similar to: http://stackoverflow.com/questions/22075708/how-to-know-if-a-canvas-is-a-normal-canvas-or-a-webgl-canvas
How are you handling this today?
Have to check, didn't use methods with optional js parameter anymore because I removed them from the interfaces.