I tried using a JsType instead of JavaScriptObject and it is still undefined. I have logged a ticket with the details.
On Wednesday, March 16, 2016 at 12:05:30 PM UTC-4, Goktug Gokdogan wrote: > > > > On Wed, Mar 16, 2016 at 8:51 AM, Paul Stockley <[email protected] > <javascript:>> wrote: > >> I am running the latest snapshot build as of a couple of days ago and >> starting SD mode with >> >> Running CodeServer with parameters: [-noprecompile, -port, 9876, >> -sourceLevel, 1.8, -bindAddress, 127.0.0.1, -launcherDir, >> /Users/paul/Library/Caches/IntelliJIdea15/gwt/gwt_react.da4c73b3/gwt_react.284d7c82/run/www, >> >> -logLevel, INFO, -generateJsInteropExports, -style, OBFUSCATED, >> com.ocs.react.React] >> >> I changed the Class to the following as suggested but it still doesn't >> work >> >> public class JSFunction extends JavaScriptObject { >> protected JSFunction() {}; >> } >> >> >> @JsType(namespace = JsPackage.GLOBAL, name="CustomComponent") >> public class CustomComponent { >> >> // 1) Still Just returns undefined >> >> You declared JsFunction as JSO and it is never returned from JSNI so it > is always considered to be null (I guess). Use @JsType(namespace=GLOBAL) > interface JsFunction {} instead. > > >> @JsProperty(namespace = JsPackage.GLOBAL) >> public static native JSFunction getCustomComponent(); >> >> // 2) Still crashes compiler with internal error >> >> I think these are crashing the compiler because they are JsMethods > (public methods in JsType). Can you try changing their visibility or moving > to a different file that is not JsType? > > Also can you file bug with the stack trace? > > public static native JSFunction constructor() /*-{ >> return @com.ocs.react.client.CustomComponent::new(*); >> }-*/; >> >> // 3) Still crashes compiler with internal error >> public static native JSFunction constructor(String qualifiedJsTypeName) >> /*-{ >> var cur = $wnd; >> var parts = namespace.split('.'); >> for (var part; parts.length && (part = parts.shift());) { >> cur = cur[part]; >> } >> return cur; >> }-*/; >> } >> >> >> The exception is >> >> [ERROR] An internal compiler exception occurred >> com.google.gwt.dev.jjs.InternalCompilerException: Unexpected error during >> visit. >> at >> com.google.gwt.dev.jjs.ast.JVisitor.translateException(JVisitor.java:111) >> at com.google.gwt.dev.jjs.ast.JVisitor.accept(JVisitor.java:149) >> at com.google.gwt.dev.jjs.ast.JVisitor.acceptImmutable(JVisitor.java:154) >> at >> com.google.gwt.dev.jjs.ast.JMethodCall.visitChildren(JMethodCall.java:266) >> at com.google.gwt.dev.jjs.ast.JMethodCall.traverse(JMethodCall.java:257) >> at com.google.gwt.dev.jjs.ast.JVisitor.accept(JVisitor.java:146) >> at com.google.gwt.dev.jjs.ast.JVisitor.acceptImmutable(JVisitor.java:154) >> at >> com.google.gwt.dev.jjs.ast.JMethodCall.visitChildren(JMethodCall.java:266) >> at com.google.gwt.dev.jjs.ast.JMethodCall.traverse(JMethodCall.java:257) >> at com.google.gwt.dev.jjs.ast.JVisitor.accept(JVisitor.java:146) >> at com.google.gwt.dev.jjs.ast.JVisitor.acceptImmutable(JVisitor.java:154) >> at >> com.google.gwt.dev.jjs.ast.JMethodCall.visitChildren(JMethodCall.java:266) >> at com.google.gwt.dev.jjs.ast.JMethodCall.traverse(JMethodCall.java:257) >> at com.google.gwt.dev.jjs.ast.JVisitor.accept(JVisitor.java:127) >> at com.google.gwt.dev.jjs.ast.JVisitor.accept(JVisitor.java:122) >> at com.google.gwt.dev.jjs.ast.JVisitor.accept(JVisitor.java:118) >> at >> com.google.gwt.dev.jjs.ast.JDeclarationStatement.traverse(JDeclarationStatement.java:49) >> at com.google.gwt.dev.jjs.ast.JVisitor.accept(JVisitor.java:146) >> at >> com.google.gwt.dev.jjs.ast.JVisitor.acceptWithInsertRemove(JVisitor.java:168) >> at com.google.gwt.dev.jjs.ast.JBlock.traverse(JBlock.java:92) >> at com.google.gwt.dev.jjs.ast.JVisitor.accept(JVisitor.java:127) >> at com.google.gwt.dev.jjs.ast.JVisitor.accept(JVisitor.java:139) >> at com.google.gwt.dev.jjs.ast.JVisitor.accept(JVisitor.java:135) >> at com.google.gwt.dev.jjs.ast.JMethodBody.traverse(JMethodBody.java:83) >> at com.google.gwt.dev.jjs.ast.JVisitor.accept(JVisitor.java:127) >> at com.google.gwt.dev.jjs.ast.JVisitor.accept(JVisitor.java:122) >> at com.google.gwt.dev.jjs.ast.JMethod.visitChildren(JMethod.java:788) >> at com.google.gwt.dev.jjs.ast.JMethod.traverse(JMethod.java:780) >> at com.google.gwt.dev.jjs.ast.JVisitor.accept(JVisitor.java:146) >> at >> com.google.gwt.dev.jjs.ast.JVisitor.acceptWithInsertRemoveImmutable(JVisitor.java:172) >> at com.google.gwt.dev.jjs.ast.JClassType.traverse(JClassType.java:147) >> at com.google.gwt.dev.jjs.ast.JVisitor.accept(JVisitor.java:127) >> at com.google.gwt.dev.jjs.ast.JVisitor.accept(JVisitor.java:122) >> at >> com.google.gwt.dev.jjs.ast.JProgram.visitModuleTypes(JProgram.java:1284) >> at com.google.gwt.dev.jjs.ast.JProgram.traverse(JProgram.java:1249) >> at com.google.gwt.dev.jjs.ast.JVisitor.accept(JVisitor.java:127) >> at com.google.gwt.dev.jjs.ast.JVisitor.accept(JVisitor.java:122) >> at >> com.google.gwt.dev.jjs.impl.ControlFlowRecorder.execImpl(ControlFlowRecorder.java:162) >> at >> com.google.gwt.dev.jjs.impl.ControlFlowRecorder.exec(ControlFlowRecorder.java:49) >> at >> com.google.gwt.dev.jjs.JavaToJavaScriptCompiler.maybeRecordReferencesAndControlFlow(JavaToJavaScriptCompiler.java:474) >> at >> com.google.gwt.dev.jjs.JavaToJavaScriptCompiler.compilePermutation(JavaToJavaScriptCompiler.java:352) >> at >> com.google.gwt.dev.jjs.JavaToJavaScriptCompiler.compilePermutation(JavaToJavaScriptCompiler.java:272) >> at com.google.gwt.dev.CompilePerms.compile(CompilePerms.java:198) >> at >> com.google.gwt.dev.ThreadedPermutationWorkerFactory$ThreadedPermutationWorker.compile(ThreadedPermutationWorkerFactory.java:50) >> at >> com.google.gwt.dev.PermutationWorkerFactory$Manager$WorkerThread.run(PermutationWorkerFactory.java:74) >> at java.lang.Thread.run(Thread.java:745) >> Caused by: java.lang.NullPointerException >> at com.google.gwt.dev.jjs.ast.JMethod.getJsniSignature(JMethod.java:618) >> at >> com.google.gwt.dev.jjs.impl.ControlFlowRecorder.computeName(ControlFlowRecorder.java:53) >> at >> com.google.gwt.dev.jjs.impl.ControlFlowRecorder.processMethodCall(ControlFlowRecorder.java:212) >> at >> com.google.gwt.dev.jjs.impl.ControlFlowRecorder.visit(ControlFlowRecorder.java:157) >> at com.google.gwt.dev.jjs.ast.JMethodCall.traverse(JMethodCall.java:256) >> at com.google.gwt.dev.jjs.ast.JVisitor.accept(JVisitor.java:146) >> ... 44 more >> [ERROR] at ReactMain.java(38): >> CustomComponent.getCustomComponent() >> com.google.gwt.dev.jjs.ast.JMethodCall >> [ERROR] at ReactMain.java(38): >> React.createElement(CustomComponent.getCustomComponent(), null) >> com.google.gwt.dev.jjs.ast.JMethodCall >> [ERROR] at ReactMain.java(36): React.createElement("div", >> null, React.createElement(funcComp, fProps), >> React.createElement(CustomComponent.getCustomComponent(), null)) >> com.google.gwt.dev.jjs.ast.JMethodCall >> [ERROR] at ReactMain.java(35): React.createElement("div", >> (new HTMLProps())._defaultValue("ss")._accept("y"), >> React.createElement("div", null, React.createElement(funcComp, fProps), >> React.createElement(CustomComponent.getCustomComponent(), null)), >> React.createElement(customClassicComponent, null), >> React.createElement("div", null, "An example")) >> com.google.gwt.dev.jjs.ast.JMethodCall >> [ERROR] at ReactMain.java(34): DOMElement div = >> React.createElement("div", (new >> HTMLProps())._defaultValue("ss")._accept("y"), React.createElement("div", >> null, React.createElement(funcComp, fProps), >> React.createElement(CustomComponent.getCustomComponent(), null)), >> React.createElement(customClassicComponent, null), >> React.createElement("div", null, "An example")) >> com.google.gwt.dev.jjs.ast.JDeclarationStatement >> [ERROR] at ReactMain.java(24): { >> ClassicComponentClass customClassicComponent = >> React.createClass(CustomClassicComponent.makeSpec()); >> FunctionalComponent funcComp = new ReactMain$lambda$0$Type(); >> ReactMain$FuncProps fProps = new ReactMain$FuncProps(); >> fProps.aProp = "Its a prop"; >> DOMElement div = React.createElement("div", (new >> HTMLProps())._defaultValue("ss")._accept("y"), React.createElement("div", >> null, React.createElement(funcComp, fProps), >> React.createElement(CustomComponent.getCustomComponent(), null)), >> React.createElement(customClassicComponent, null), >> React.createElement("div", null, "An example")); >> ReactDOM.render(div, Document.get().getElementById("mainCont")); >> } >> com.google.gwt.dev.jjs.ast.JBlock >> [ERROR] at ReactMain.java(24): { >> ClassicComponentClass customClassicComponent = >> React.createClass(CustomClassicComponent.makeSpec()); >> FunctionalComponent funcComp = new ReactMain$lambda$0$Type(); >> ReactMain$FuncProps fProps = new ReactMain$FuncProps(); >> fProps.aProp = "Its a prop"; >> DOMElement div = React.createElement("div", (new >> HTMLProps())._defaultValue("ss")._accept("y"), React.createElement("div", >> null, React.createElement(funcComp, fProps), >> React.createElement(CustomComponent.getCustomComponent(), null)), >> React.createElement(customClassicComponent, null), >> React.createElement("div", null, "An example")); >> ReactDOM.render(div, Document.get().getElementById("mainCont")); >> } >> com.google.gwt.dev.jjs.ast.JMethodBody >> [ERROR] at ReactMain.java(24): >> com.ocs.react.client.ReactMain.onModuleLoad()V >> com.google.gwt.dev.jjs.ast.JMethod >> [ERROR] at ReactMain.java(16): >> com.ocs.react.client.ReactMain (extends Object implements EntryPoint) >> com.google.gwt.dev.jjs.ast.JClassType >> [ERROR] at Unknown(0): <JProgram> >> com.google.gwt.dev.jjs.ast.JProgram >> [ERROR] Unrecoverable exception, shutting down >> com.google.gwt.core.ext.UnableToCompleteException: (see previous log >> entries) >> at >> com.google.gwt.dev.javac.CompilationProblemReporter.logAndTranslateException(CompilationProblemReporter.java:106) >> >> >> >> >> >> -- >> You received this message because you are subscribed to the Google Groups >> "GWT Contributors" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected] >> <javascript:>. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/google-web-toolkit-contributors/9b869d0e-960e-48dc-b2d5-87abc587703f%40googlegroups.com >> >> <https://groups.google.com/d/msgid/google-web-toolkit-contributors/9b869d0e-960e-48dc-b2d5-87abc587703f%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> >> For more options, visit https://groups.google.com/d/optout. >> > > -- You received this message because you are subscribed to the Google Groups "GWT Contributors" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/google-web-toolkit-contributors/cb2d1d7e-b549-4c9b-96d4-e3f5232070e3%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
