Uploaded image for project: 'Errai'
  1. Errai
  2. ERRAI-923

creating singleton bean from JsType(native=true) would generate Proxy

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Done
    • Affects Version/s: 4.0.0.Beta1
    • Fix Version/s: 4.0.0.Beta2
    • Component/s: ErraiIOC
    • Labels:
      None
    • Steps to Reproduce:
      Hide

      create JsType class for native js, f.ex:

      @JsType(name = "BehaviorSubject", namespace = "Rx", isNative = true)
      public interface BehaviorSubject<T> extends Subject<T> {
          public abstract T getValue();
      }
      

      create bean with this class using @Singleton

      @Produces
          @Singleton
          public BehaviorSubject<List<ProjectDTO>> projectsSubject() {
              return Rx.BehaviorSubject(new ArrayList<>());
          }
      

      ERRAI would generate Proxy class like this

      public class Producer_factory__i_g_m_c_e_r_BehaviorSubject__quals__j_e_i_Any_j_e_i_Default extends Factory<BehaviorSubject<List<ProjectDTO>>> {
        private FactoryHandleImpl handle = new FactoryHandleImpl(BehaviorSubject.class, "Producer_factory__i_g_m_c_e_r_BehaviorSubject__quals__j_e_i_Any_j_e_i_Default", Singleton.class, false, null);
        private class Producer_factory__i_g_m_c_e_r_BehaviorSubject__quals__j_e_i_Any_j_e_i_DefaultProxyImpl extends BehaviorSubject<List<ProjectDTO>> implements Proxy<BehaviorSubject<List<ProjectDTO>>> {
          private final ProxyHelper<BehaviorSubject<List<ProjectDTO>>> proxyHelper = new ProxyHelperImpl<BehaviorSubject<List<ProjectDTO>>>("Producer_factory__i_g_m_c_e_r_BehaviorSubject__quals__j_e_i_Any_j_e_i_Default");
          public void initProxyProperties(final BehaviorSubject<List<ProjectDTO>> instance) {
       
          }
       
          public BehaviorSubject asBeanType() {
            return this;
          }
       
          public void setInstance(final BehaviorSubject<List<ProjectDTO>> instance) {
            proxyHelper.setInstance(instance);
          }
       
          public void clearInstance() {
            proxyHelper.clearInstance();
          }
       
          public void setContext(final Context context) {
            proxyHelper.setContext(context);
          }
       
          public Object unwrap() {
            return proxyHelper.getInstance(this);
          }
       
          public boolean equals(Object obj) {
            obj = Factory.maybeUnwrapProxy(obj);
            return proxyHelper.getInstance(this).equals(obj);
          }
       
          @Override public List getValue() {
            if (proxyHelper != null) {
              final BehaviorSubject<List<ProjectDTO>> proxiedInstance = proxyHelper.getInstance(this);
              final List retVal = proxiedInstance.getValue();
              return retVal;
            } else {
              throw new RuntimeException("Cannot invoke public method on proxied interface before constructor completes.");
            }
          }
       
          @Override public Observer notifyOn(Object scheduler) {
            if (proxyHelper != null) {
              final BehaviorSubject<List<ProjectDTO>> proxiedInstance = proxyHelper.getInstance(this);
              final Observer retVal = proxiedInstance.notifyOn(scheduler);
              return retVal;
            } else {
              throw new RuntimeException("Cannot invoke public method on proxied interface before constructor completes.");
            }
          }
       
          @Override public void onCompleted() {
            if (proxyHelper != null) {
              final BehaviorSubject<List<ProjectDTO>> proxiedInstance = proxyHelper.getInstance(this);
              proxiedInstance.onCompleted();
            } else {
              throw new RuntimeException("Cannot invoke public method on proxied interface before constructor completes.");
            }
          }
       
          @Override public void onError(Object error) {
            if (proxyHelper != null) {
              final BehaviorSubject<List<ProjectDTO>> proxiedInstance = proxyHelper.getInstance(this);
              proxiedInstance.onError(error);
            } else {
              throw new RuntimeException("Cannot invoke public method on proxied interface before constructor completes.");
            }
          }
       
          @Override public void onNext(List val) {
            if (proxyHelper != null) {
              final BehaviorSubject<List<ProjectDTO>> proxiedInstance = proxyHelper.getInstance(this);
              proxiedInstance.onNext(val);
            } else {
              throw new RuntimeException("Cannot invoke public method on proxied interface before constructor completes.");
            }
          }
       
          @Override public int hashCode() {
            if (proxyHelper != null) {
              final BehaviorSubject<List<ProjectDTO>> proxiedInstance = proxyHelper.getInstance(this);
              final int retVal = proxiedInstance.hashCode();
              return retVal;
            } else {
              return super.hashCode();
            }
          }
       
          @Override public Observable returnFunc() {
            if (proxyHelper != null) {
              final BehaviorSubject<List<ProjectDTO>> proxiedInstance = proxyHelper.getInstance(this);
              final Observable retVal = proxiedInstance.returnFunc();
              return retVal;
            } else {
              throw new RuntimeException("Cannot invoke public method on proxied interface before constructor completes.");
            }
          }
       
          @Override public Disposable subscribe() {
            if (proxyHelper != null) {
              final BehaviorSubject<List<ProjectDTO>> proxiedInstance = proxyHelper.getInstance(this);
              final Disposable retVal = proxiedInstance.subscribe();
              return retVal;
            } else {
              throw new RuntimeException("Cannot invoke public method on proxied interface before constructor completes.");
            }
          }
       
          @Override public Disposable subscribe(Observer observer) {
            if (proxyHelper != null) {
              final BehaviorSubject<List<ProjectDTO>> proxiedInstance = proxyHelper.getInstance(this);
              final Disposable retVal = proxiedInstance.subscribe(observer);
              return retVal;
            } else {
              throw new RuntimeException("Cannot invoke public method on proxied interface before constructor completes.");
            }
          }
       
          @Override public Disposable subscribe(Consumer onNext) {
            if (proxyHelper != null) {
              final BehaviorSubject<List<ProjectDTO>> proxiedInstance = proxyHelper.getInstance(this);
              final Disposable retVal = proxiedInstance.subscribe(onNext);
              return retVal;
            } else {
              throw new RuntimeException("Cannot invoke public method on proxied interface before constructor completes.");
            }
          }
       
          @Override public Disposable subscribe(Consumer onNext, Consumer onError) {
            if (proxyHelper != null) {
              final BehaviorSubject<List<ProjectDTO>> proxiedInstance = proxyHelper.getInstance(this);
              final Disposable retVal = proxiedInstance.subscribe(onNext, onError);
              return retVal;
            } else {
              throw new RuntimeException("Cannot invoke public method on proxied interface before constructor completes.");
            }
          }
       
          @Override public Disposable subscribe(Consumer onNext, Consumer onError, Consumer onCompleted) {
            if (proxyHelper != null) {
              final BehaviorSubject<List<ProjectDTO>> proxiedInstance = proxyHelper.getInstance(this);
              final Disposable retVal = proxiedInstance.subscribe(onNext, onError, onCompleted);
              return retVal;
            } else {
              throw new RuntimeException("Cannot invoke public method on proxied interface before constructor completes.");
            }
          }
       
          @Override public Observable timeInterval() {
            if (proxyHelper != null) {
              final BehaviorSubject<List<ProjectDTO>> proxiedInstance = proxyHelper.getInstance(this);
              final Observable retVal = proxiedInstance.timeInterval();
              return retVal;
            } else {
              throw new RuntimeException("Cannot invoke public method on proxied interface before constructor completes.");
            }
          }
       
          @Override public Observable take(int count) {
            if (proxyHelper != null) {
              final BehaviorSubject<List<ProjectDTO>> proxiedInstance = proxyHelper.getInstance(this);
              final Observable retVal = proxiedInstance.take(count);
              return retVal;
            } else {
              throw new RuntimeException("Cannot invoke public method on proxied interface before constructor completes.");
            }
          }
       
          @Override public Observable filter(Predicate func) {
            if (proxyHelper != null) {
              final BehaviorSubject<List<ProjectDTO>> proxiedInstance = proxyHelper.getInstance(this);
              final Observable retVal = proxiedInstance.filter(func);
              return retVal;
            } else {
              throw new RuntimeException("Cannot invoke public method on proxied interface before constructor completes.");
            }
          }
       
          @Override public Observable join(Observable ys, Supplier func1, Supplier func2, BiFunction func3) {
            if (proxyHelper != null) {
              final BehaviorSubject<List<ProjectDTO>> proxiedInstance = proxyHelper.getInstance(this);
              final Observable retVal = proxiedInstance.join(ys, func1, func2, func3);
              return retVal;
            } else {
              throw new RuntimeException("Cannot invoke public method on proxied interface before constructor completes.");
            }
          }
       
          @Override public Observable combineLatest(Observable ys, BiFunction func3) {
            if (proxyHelper != null) {
              final BehaviorSubject<List<ProjectDTO>> proxiedInstance = proxyHelper.getInstance(this);
              final Observable retVal = proxiedInstance.combineLatest(ys, func3);
              return retVal;
            } else {
              throw new RuntimeException("Cannot invoke public method on proxied interface before constructor completes.");
            }
          }
       
          @Override public Observable count() {
            if (proxyHelper != null) {
              final BehaviorSubject<List<ProjectDTO>> proxiedInstance = proxyHelper.getInstance(this);
              final Observable retVal = proxiedInstance.count();
              return retVal;
            } else {
              throw new RuntimeException("Cannot invoke public method on proxied interface before constructor completes.");
            }
          }
       
          @Override public Observable count(Predicate predicate) {
            if (proxyHelper != null) {
              final BehaviorSubject<List<ProjectDTO>> proxiedInstance = proxyHelper.getInstance(this);
              final Observable retVal = proxiedInstance.count(predicate);
              return retVal;
            } else {
              throw new RuntimeException("Cannot invoke public method on proxied interface before constructor completes.");
            }
          }
       
          @Override public Observable count(Predicate predicate, List arg) {
            if (proxyHelper != null) {
              final BehaviorSubject<List<ProjectDTO>> proxiedInstance = proxyHelper.getInstance(this);
              final Observable retVal = proxiedInstance.count(predicate, arg);
              return retVal;
            } else {
              throw new RuntimeException("Cannot invoke public method on proxied interface before constructor completes.");
            }
          }
       
          @Override public Observable includes(List searchElement) {
            if (proxyHelper != null) {
              final BehaviorSubject<List<ProjectDTO>> proxiedInstance = proxyHelper.getInstance(this);
              final Observable retVal = proxiedInstance.includes(searchElement);
              return retVal;
            } else {
              throw new RuntimeException("Cannot invoke public method on proxied interface before constructor completes.");
            }
          }
       
          @Override public Observable includes(List searchElement, int fromIndex) {
            if (proxyHelper != null) {
              final BehaviorSubject<List<ProjectDTO>> proxiedInstance = proxyHelper.getInstance(this);
              final Observable retVal = proxiedInstance.includes(searchElement, fromIndex);
              return retVal;
            } else {
              throw new RuntimeException("Cannot invoke public method on proxied interface before constructor completes.");
            }
          }
        }
        public Producer_factory__i_g_m_c_e_r_BehaviorSubject__quals__j_e_i_Any_j_e_i_Default() {
          handle.addAssignableType(BehaviorSubject.class);
          handle.addAssignableType(Object.class);
          handle.addAssignableType(Subject.class);
          handle.addAssignableType(Observer.class);
          handle.addAssignableType(Observable.class);
          handle.addQualifier(QualifierUtil.ANY_ANNOTATION);
          handle.addQualifier(QualifierUtil.DEFAULT_ANNOTATION);
        }
       
        public void init(final Context context) {
       
        }
       
        public BehaviorSubject createInstance(final ContextManager contextManager) {
          RxSubjects producerInstance = contextManager.getInstance("Type_factory__i_g_m_c_p_RxSubjects__quals__j_e_i_Any_j_e_i_Default");
          producerInstance = Factory.maybeUnwrapProxy(producerInstance);
          final BehaviorSubject<List<ProjectDTO>> instance = RxSubjects_projectsSubject(producerInstance);
          thisInstance.setReference(instance, "producerInstance", producerInstance);
          return instance;
        }
       
        public void generatedDestroyInstance(final Object instance, final ContextManager contextManager) {
          destroyInstanceHelper((BehaviorSubject<List<ProjectDTO>>) instance, contextManager);
        }
       
        public void destroyInstanceHelper(final BehaviorSubject<List<ProjectDTO>> instance, final ContextManager contextManager) {
       
        }
       
        public void invokePostConstructs(final BehaviorSubject<List<ProjectDTO>> instance) {
       
        }
       
        public Proxy createProxy(final Context context) {
          final Proxy<BehaviorSubject<List<ProjectDTO>>> proxyImpl = new Producer_factory__i_g_m_c_e_r_BehaviorSubject__quals__j_e_i_Any_j_e_i_DefaultProxyImpl();
          proxyImpl.setContext(context);
          return proxyImpl;
        }
       
        public FactoryHandle getHandle() {
          return handle;
        }
       
        public native static BehaviorSubject RxSubjects_projectsSubject(RxSubjects instance) /*-{
          return instance.@io.gulp.mockify.client.producers.RxSubjects::projectsSubject()();
        }-*/;
      }
      

      as result compilation would fail with "subscribe()' cannot both use the same JavaScript name 'subscribe'."

      Show
      create JsType class for native js, f.ex: @JsType (name = "BehaviorSubject" , namespace = "Rx" , isNative = true ) public interface BehaviorSubject<T> extends Subject<T> { public abstract T getValue(); } create bean with this class using @Singleton @Produces @Singleton public BehaviorSubject<List<ProjectDTO>> projectsSubject() { return Rx.BehaviorSubject( new ArrayList<>()); } ERRAI would generate Proxy class like this public class Producer_factory__i_g_m_c_e_r_BehaviorSubject__quals__j_e_i_Any_j_e_i_Default extends Factory<BehaviorSubject<List<ProjectDTO>>> { private FactoryHandleImpl handle = new FactoryHandleImpl(BehaviorSubject. class , "Producer_factory__i_g_m_c_e_r_BehaviorSubject__quals__j_e_i_Any_j_e_i_Default" , Singleton. class , false , null ); private class Producer_factory__i_g_m_c_e_r_BehaviorSubject__quals__j_e_i_Any_j_e_i_DefaultProxyImpl extends BehaviorSubject<List<ProjectDTO>> implements Proxy<BehaviorSubject<List<ProjectDTO>>> { private final ProxyHelper<BehaviorSubject<List<ProjectDTO>>> proxyHelper = new ProxyHelperImpl<BehaviorSubject<List<ProjectDTO>>>( "Producer_factory__i_g_m_c_e_r_BehaviorSubject__quals__j_e_i_Any_j_e_i_Default" ); public void initProxyProperties( final BehaviorSubject<List<ProjectDTO>> instance) {   }   public BehaviorSubject asBeanType() { return this ; }   public void setInstance( final BehaviorSubject<List<ProjectDTO>> instance) { proxyHelper.setInstance(instance); }   public void clearInstance() { proxyHelper.clearInstance(); }   public void setContext( final Context context) { proxyHelper.setContext(context); }   public Object unwrap() { return proxyHelper.getInstance( this ); }   public boolean equals(Object obj) { obj = Factory.maybeUnwrapProxy(obj); return proxyHelper.getInstance( this ).equals(obj); }   @Override public List getValue() { if (proxyHelper != null ) { final BehaviorSubject<List<ProjectDTO>> proxiedInstance = proxyHelper.getInstance( this ); final List retVal = proxiedInstance.getValue(); return retVal; } else { throw new RuntimeException( "Cannot invoke public method on proxied interface before constructor completes." ); } }   @Override public Observer notifyOn(Object scheduler) { if (proxyHelper != null ) { final BehaviorSubject<List<ProjectDTO>> proxiedInstance = proxyHelper.getInstance( this ); final Observer retVal = proxiedInstance.notifyOn(scheduler); return retVal; } else { throw new RuntimeException( "Cannot invoke public method on proxied interface before constructor completes." ); } }   @Override public void onCompleted() { if (proxyHelper != null ) { final BehaviorSubject<List<ProjectDTO>> proxiedInstance = proxyHelper.getInstance( this ); proxiedInstance.onCompleted(); } else { throw new RuntimeException( "Cannot invoke public method on proxied interface before constructor completes." ); } }   @Override public void onError(Object error) { if (proxyHelper != null ) { final BehaviorSubject<List<ProjectDTO>> proxiedInstance = proxyHelper.getInstance( this ); proxiedInstance.onError(error); } else { throw new RuntimeException( "Cannot invoke public method on proxied interface before constructor completes." ); } }   @Override public void onNext(List val) { if (proxyHelper != null ) { final BehaviorSubject<List<ProjectDTO>> proxiedInstance = proxyHelper.getInstance( this ); proxiedInstance.onNext(val); } else { throw new RuntimeException( "Cannot invoke public method on proxied interface before constructor completes." ); } }   @Override public int hashCode() { if (proxyHelper != null ) { final BehaviorSubject<List<ProjectDTO>> proxiedInstance = proxyHelper.getInstance( this ); final int retVal = proxiedInstance.hashCode(); return retVal; } else { return super .hashCode(); } }   @Override public Observable returnFunc() { if (proxyHelper != null ) { final BehaviorSubject<List<ProjectDTO>> proxiedInstance = proxyHelper.getInstance( this ); final Observable retVal = proxiedInstance.returnFunc(); return retVal; } else { throw new RuntimeException( "Cannot invoke public method on proxied interface before constructor completes." ); } }   @Override public Disposable subscribe() { if (proxyHelper != null ) { final BehaviorSubject<List<ProjectDTO>> proxiedInstance = proxyHelper.getInstance( this ); final Disposable retVal = proxiedInstance.subscribe(); return retVal; } else { throw new RuntimeException( "Cannot invoke public method on proxied interface before constructor completes." ); } }   @Override public Disposable subscribe(Observer observer) { if (proxyHelper != null ) { final BehaviorSubject<List<ProjectDTO>> proxiedInstance = proxyHelper.getInstance( this ); final Disposable retVal = proxiedInstance.subscribe(observer); return retVal; } else { throw new RuntimeException( "Cannot invoke public method on proxied interface before constructor completes." ); } }   @Override public Disposable subscribe(Consumer onNext) { if (proxyHelper != null ) { final BehaviorSubject<List<ProjectDTO>> proxiedInstance = proxyHelper.getInstance( this ); final Disposable retVal = proxiedInstance.subscribe(onNext); return retVal; } else { throw new RuntimeException( "Cannot invoke public method on proxied interface before constructor completes." ); } }   @Override public Disposable subscribe(Consumer onNext, Consumer onError) { if (proxyHelper != null ) { final BehaviorSubject<List<ProjectDTO>> proxiedInstance = proxyHelper.getInstance( this ); final Disposable retVal = proxiedInstance.subscribe(onNext, onError); return retVal; } else { throw new RuntimeException( "Cannot invoke public method on proxied interface before constructor completes." ); } }   @Override public Disposable subscribe(Consumer onNext, Consumer onError, Consumer onCompleted) { if (proxyHelper != null ) { final BehaviorSubject<List<ProjectDTO>> proxiedInstance = proxyHelper.getInstance( this ); final Disposable retVal = proxiedInstance.subscribe(onNext, onError, onCompleted); return retVal; } else { throw new RuntimeException( "Cannot invoke public method on proxied interface before constructor completes." ); } }   @Override public Observable timeInterval() { if (proxyHelper != null ) { final BehaviorSubject<List<ProjectDTO>> proxiedInstance = proxyHelper.getInstance( this ); final Observable retVal = proxiedInstance.timeInterval(); return retVal; } else { throw new RuntimeException( "Cannot invoke public method on proxied interface before constructor completes." ); } }   @Override public Observable take( int count) { if (proxyHelper != null ) { final BehaviorSubject<List<ProjectDTO>> proxiedInstance = proxyHelper.getInstance( this ); final Observable retVal = proxiedInstance.take(count); return retVal; } else { throw new RuntimeException( "Cannot invoke public method on proxied interface before constructor completes." ); } }   @Override public Observable filter(Predicate func) { if (proxyHelper != null ) { final BehaviorSubject<List<ProjectDTO>> proxiedInstance = proxyHelper.getInstance( this ); final Observable retVal = proxiedInstance.filter(func); return retVal; } else { throw new RuntimeException( "Cannot invoke public method on proxied interface before constructor completes." ); } }   @Override public Observable join(Observable ys, Supplier func1, Supplier func2, BiFunction func3) { if (proxyHelper != null ) { final BehaviorSubject<List<ProjectDTO>> proxiedInstance = proxyHelper.getInstance( this ); final Observable retVal = proxiedInstance.join(ys, func1, func2, func3); return retVal; } else { throw new RuntimeException( "Cannot invoke public method on proxied interface before constructor completes." ); } }   @Override public Observable combineLatest(Observable ys, BiFunction func3) { if (proxyHelper != null ) { final BehaviorSubject<List<ProjectDTO>> proxiedInstance = proxyHelper.getInstance( this ); final Observable retVal = proxiedInstance.combineLatest(ys, func3); return retVal; } else { throw new RuntimeException( "Cannot invoke public method on proxied interface before constructor completes." ); } }   @Override public Observable count() { if (proxyHelper != null ) { final BehaviorSubject<List<ProjectDTO>> proxiedInstance = proxyHelper.getInstance( this ); final Observable retVal = proxiedInstance.count(); return retVal; } else { throw new RuntimeException( "Cannot invoke public method on proxied interface before constructor completes." ); } }   @Override public Observable count(Predicate predicate) { if (proxyHelper != null ) { final BehaviorSubject<List<ProjectDTO>> proxiedInstance = proxyHelper.getInstance( this ); final Observable retVal = proxiedInstance.count(predicate); return retVal; } else { throw new RuntimeException( "Cannot invoke public method on proxied interface before constructor completes." ); } }   @Override public Observable count(Predicate predicate, List arg) { if (proxyHelper != null ) { final BehaviorSubject<List<ProjectDTO>> proxiedInstance = proxyHelper.getInstance( this ); final Observable retVal = proxiedInstance.count(predicate, arg); return retVal; } else { throw new RuntimeException( "Cannot invoke public method on proxied interface before constructor completes." ); } }   @Override public Observable includes(List searchElement) { if (proxyHelper != null ) { final BehaviorSubject<List<ProjectDTO>> proxiedInstance = proxyHelper.getInstance( this ); final Observable retVal = proxiedInstance.includes(searchElement); return retVal; } else { throw new RuntimeException( "Cannot invoke public method on proxied interface before constructor completes." ); } }   @Override public Observable includes(List searchElement, int fromIndex) { if (proxyHelper != null ) { final BehaviorSubject<List<ProjectDTO>> proxiedInstance = proxyHelper.getInstance( this ); final Observable retVal = proxiedInstance.includes(searchElement, fromIndex); return retVal; } else { throw new RuntimeException( "Cannot invoke public method on proxied interface before constructor completes." ); } } } public Producer_factory__i_g_m_c_e_r_BehaviorSubject__quals__j_e_i_Any_j_e_i_Default() { handle.addAssignableType(BehaviorSubject. class ); handle.addAssignableType(Object. class ); handle.addAssignableType(Subject. class ); handle.addAssignableType(Observer. class ); handle.addAssignableType(Observable. class ); handle.addQualifier(QualifierUtil.ANY_ANNOTATION); handle.addQualifier(QualifierUtil.DEFAULT_ANNOTATION); }   public void init( final Context context) {   }   public BehaviorSubject createInstance( final ContextManager contextManager) { RxSubjects producerInstance = contextManager.getInstance( "Type_factory__i_g_m_c_p_RxSubjects__quals__j_e_i_Any_j_e_i_Default" ); producerInstance = Factory.maybeUnwrapProxy(producerInstance); final BehaviorSubject<List<ProjectDTO>> instance = RxSubjects_projectsSubject(producerInstance); thisInstance.setReference(instance, "producerInstance" , producerInstance); return instance; }   public void generatedDestroyInstance( final Object instance, final ContextManager contextManager) { destroyInstanceHelper((BehaviorSubject<List<ProjectDTO>>) instance, contextManager); }   public void destroyInstanceHelper( final BehaviorSubject<List<ProjectDTO>> instance, final ContextManager contextManager) {   }   public void invokePostConstructs( final BehaviorSubject<List<ProjectDTO>> instance) {   }   public Proxy createProxy( final Context context) { final Proxy<BehaviorSubject<List<ProjectDTO>>> proxyImpl = new Producer_factory__i_g_m_c_e_r_BehaviorSubject__quals__j_e_i_Any_j_e_i_DefaultProxyImpl(); proxyImpl.setContext(context); return proxyImpl; }   public FactoryHandle getHandle() { return handle; }   public native static BehaviorSubject RxSubjects_projectsSubject(RxSubjects instance) /*-{ return instance.@io.gulp.mockify.client.producers.RxSubjects::projectsSubject()(); }-*/ ; } as result compilation would fail with " subscribe()' cannot both use the same JavaScript name 'subscribe'. "
    • Workaround:
      Workaround Exists
    • Workaround Description:
      Hide

      as a temporary workaround you could make your produce @Dependent scoped

      Show
      as a temporary workaround you could make your produce @Dependent scoped

      Description

      I have JsType

      @JsType(name = "BehaviorSubject", namespace = "Rx", isNative = true)  
      public interface BehaviorSubject<T> extends Subject<T>
      

      which is then used in @Producer @Singleton method. errai creates

      Producer_factory__i_g_m_c_e_r_BehaviorSubject__quals__j_e_i_Any_j_e_i_Default.Producer_factory__i_g_m_c_e_r_BehaviorSubject__quals__j_e_i_Any_j_e_i_DefaultProxyImpl extends BehaviorSubject implements Proxy<BehaviorSubject>
      

      which contains overloaded #subscribe methods.

      In JsInterop paper it is said there: "Note that Java classes that extend or implement a native @JsType is still Java type and will continue to follow Java semantics.". According to java semantics "every member name in the contract should be unique".

      ERRAI shouldn't be trying to proxy a native js type

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                mbarkley Max Barkley
                Reporter:
                gant Babur Duisenov
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: