Program: 4484
Project: 4484
Buggy source:
@Test public void testLayerWithGenericObservable(){
  Parameters p=NetworkTestHarness.getParameters().copy();
  p.setParameterByKey(KEY.RANDOM,new MersenneTwister(42));
  int[][] inputs=new int[7][8];
  inputs[0]=new int[]{1,1,0,0,0,0,0,1};
  inputs[1]=new int[]{1,1,1,0,0,0,0,0};
  inputs[2]=new int[]{0,1,1,1,0,0,0,0};
  inputs[3]=new int[]{0,0,1,1,1,0,0,0};
  inputs[4]=new int[]{0,0,0,1,1,1,0,0};
  inputs[5]=new int[]{0,0,0,0,1,1,1,0};
  inputs[6]=new int[]{0,0,0,0,0,1,1,1};
  final int[] expected0=new int[]{0,1,0,0,0,1,0,1,0,0,0,1,1,0,0,0,1,0,0,0};
  final int[] expected1=new int[]{0,1,0,0,0,1,0,0,0,0,0,1,1,1,0,0,0,0,0,0};
  Func1<ManualInput,ManualInput> addedFunc=l -> {
    return l.customObject("String_Node_Str" + Arrays.toString(l.getSDR()));
  }
;
  Network n=Network.create("String_Node_Str",p).add(Network.createRegion("String_Node_Str").add(Network.createPALayer("String_Node_Str",p).add(addedFunc).add(new PASpatialPooler())));
  @SuppressWarnings("String_Node_Str") Layer<int[]> l=(PALayer<int[]>)n.lookup("String_Node_Str").lookup("String_Node_Str");
  l.subscribe(new Observer<Inference>(){
    int test=0;
    @Override public void onCompleted(){
    }
    @Override public void onError(    Throwable e){
      e.printStackTrace();
    }
    @Override public void onNext(    Inference i){
      if (test == 0) {
        assertTrue(Arrays.equals(expected0,i.getSDR()));
        assertEquals("String_Node_Str",i.getCustomObject());
      }
      if (test == 1) {
        assertTrue(Arrays.equals(expected1,i.getSDR()));
        assertEquals("String_Node_Str",i.getCustomObject());
      }
      ++test;
    }
  }
);
  l.compute(inputs[0]);
  l.compute(inputs[1]);
}

Fixed version (ground truth):
@Test public void testLayerWithGenericObservable(){
  Parameters p=NetworkTestHarness.getParameters().copy();
  p.setParameterByKey(KEY.RANDOM,new MersenneTwister(42));
  int[][] inputs=new int[7][8];
  inputs[0]=new int[]{1,1,0,0,0,0,0,1};
  inputs[1]=new int[]{1,1,1,0,0,0,0,0};
  inputs[2]=new int[]{0,1,1,1,0,0,0,0};
  inputs[3]=new int[]{0,0,1,1,1,0,0,0};
  inputs[4]=new int[]{0,0,0,1,1,1,0,0};
  inputs[5]=new int[]{0,0,0,0,1,1,1,0};
  inputs[6]=new int[]{0,0,0,0,0,1,1,1};
  final int[] expected0=new int[]{0,1,0,0,0,1,0,1,0,0,0,1,1,0,0,0,1,0,0,0};
  final int[] expected1=new int[]{0,1,0,0,0,1,0,0,0,0,0,1,1,1,0,0,1,0,0,0};
  Func1<ManualInput,ManualInput> addedFunc=l -> {
    return l.customObject("String_Node_Str" + Arrays.toString(l.getSDR()));
  }
;
  Network n=Network.create("String_Node_Str",p).add(Network.createRegion("String_Node_Str").add(Network.createPALayer("String_Node_Str",p).add(addedFunc).add(new PASpatialPooler())));
  @SuppressWarnings("String_Node_Str") Layer<int[]> l=(PALayer<int[]>)n.lookup("String_Node_Str").lookup("String_Node_Str");
  l.subscribe(new Observer<Inference>(){
    int test=0;
    @Override public void onCompleted(){
    }
    @Override public void onError(    Throwable e){
      e.printStackTrace();
    }
    @Override public void onNext(    Inference i){
      System.out.println("String_Node_Str" + Arrays.toString(i.getSDR()));
      if (test == 0) {
        assertTrue(Arrays.equals(expected0,i.getSDR()));
        assertEquals("String_Node_Str",i.getCustomObject());
      }
      if (test == 1) {
        assertTrue(Arrays.equals(expected1,i.getSDR()));
        assertEquals("String_Node_Str",i.getCustomObject());
      }
      ++test;
    }
  }
);
  l.compute(inputs[0]);
  l.compute(inputs[1]);
}