Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    #16
    We have some reflection-related features coming in 4.0, but for now, you would need to use a third-party library (or your own implementation of reflection).

    GWTEnt isn't our product, but there's nothing special about DropCompleteEvent that should cause it to fail just with that class - it uses Java generics but so do all similar events (FolderDropEvent for example).

    Most likely, you have configured GWTEnt to provide reflection for specific classes and to ignore various classes, and you just need to update your configuration since new events have been added to SmartGWT.

    Comment


      #17
      What is the use of com.isomorphic.base.Reflection class, can i use it on client side. If yes then how?

      Thanks,
      Deepak

      Comment


        #18
        It's not documented and not supported yet. When it is, it will have appropriate documentation.

        Comment


          #19
          Please have look on below code snipet.

          Code:
          private DSResponse executeFetchMethod(Object object, String methodName, DSRequest req) 
          	throws Exception 
          	{
          		Object[] params = new Object[1];
          		params[0] = req;
          		Class[] paramTemplate = new Class[1];
          		paramTemplate[0] = req.getClass();
          		Method method = null;
          		try {
          			method = Reflection.findMethod(object.getClass(), methodName, paramTemplate);
          		} catch(NoSuchMethodException nsme) {}
          		if (method == null) {
          			throw new NoSuchMethodException(object.getClass().getName() + "::" + methodName);
          		}
          		Object result = method.invoke(object, params);
          		
          		// Just let this fail with a CCE if the target method doesn't return a DSResponse
          		return (DSResponse)result;
          	}
          It was working in 2.5 but when i am trying to use it in 3.1, i am getting below Error

          [ERROR] [gwt] - Line 192: No source code is available for type com.isomorphic.base.Reflection; did you forget to inherit a required module?

          Comment


            #20
            To clarify, you are now talking about server-side code, not client-side code, so doesn't involve GWTEnt.

            This code uses an undocumented, unsupported method and should probably be replaced with appropriate core Java usage.

            However, the "error message" you cite is not actually an error message, but a notification from your IDE that you don't have source code our server-side classes, which is expected. There's no indicate here that this code is failing at all.

            At the risk of giving offense, we have to say that it's clear that you have very little knowledge of the code involved here, so you are filing support requests for third-party libraries and reporting error messages that are not error messages - this is quite inappropriate, as what we support is our product, and these are not problems with our product.

            Please seek out help from someone on your team more familiar with this code, or simply investigate it yourself more deeply, before seeking help from our support team.

            Comment


              #21
              Same error with version 3.1-p20130406

              I’m getting the same error. It tried everything indicated in this thread:

              Code:
              --- gwt-maven-plugin:2.5.0:compile (default) @ MVP1 ---
              [INFO] auto discovered modules [com.cedarcone.MVP1.MVP1]
              [INFO] Compiling module com.cedarcone.MVP1.MVP1
              [INFO]    Adding '1' new generated units
              [INFO]       Validating units:
              [INFO]          Errors in 'P:\EclipseWorkSpaces\Scott-Tiger\MVP1\target\.generated\com\smartgwt\client\widgets\events\DropCompleteEvent___Reflection.java'
              [INFO]             See snapshot: C:\Users\Bruce\AppData\Local\Temp\com.smartgwt.client.widgets.events.DropCompleteEvent___Reflection4760285653646350295.java
              [INFO]          Ignored 1 unit with compilation errors in first pass.
              [INFO] Compile with -strict or with -logLevel set to TRACE or DEBUG to see all errors.
              [INFO]    [ERROR] Errors in 'P:\EclipseWorkSpaces\Scott-Tiger\MVP1\target\.generated\com\smartgwt\client\widgets\events\DropCompleteEvent___Reflection.java'
              [INFO]       [ERROR] Line 30: Bound mismatch: The generic method fire(S, JavaScriptObject) of type DropCompleteEvent is not applicable for the arguments (DropCompleteHandler, JavaScriptObject). The inferred type DropCompleteHandler is not a valid substitute for the bounded parameter <S extends DropCompleteHandler & HasHandlers>
              [INFO]       See snapshot: C:\Users\Bruce\AppData\Local\Temp\com.smartgwt.client.widgets.events.DropCompleteEvent___Reflection4311642332934310670.java
              [INFO]    [ERROR] Errors in 'gen/com/gwtent/reflection/client/TypeOracle_Visitor.java'
              [INFO]       [ERROR] Line 2115: Rebind result 'com.smartgwt.client.widgets.events.DropCompleteEvent___Reflection' could not be found
              [INFO] ------------------------------------------------------------------------
              [INFO] BUILD FAILURE
              • I have a project I’ve been working on with SmartGWT for about 45 days. I’ve never gotten this error before.
              • I made some code changes (too many to know which would be the offending code change).
              • I rebuilt the Eclipse project from scratch
              • I deleted the GWT unitcache (actually this is done every time I build because I’m using Maven. Maven automatically deletes the target folder which is where the unitcache is located in my project.
              • I upgraded SmartGWT to 3.1-p20130406 (today’s build)


              After doing all that the problem persists.

              Any help would be greatly appreciated.

              Comment


                #22
                DropCompleteEvent___Reflection.java gets GWT compile error

                I’m getting the same error. It tried everything indicated in this thread:

                Code:
                --- gwt-maven-plugin:2.5.0:compile (default) @ MVP1 ---
                [INFO] auto discovered modules [com.cedarcone.MVP1.MVP1]
                [INFO] Compiling module com.cedarcone.MVP1.MVP1
                [INFO]    Adding '1' new generated units
                [INFO]       Validating units:
                [INFO]          Errors in 'P:\EclipseWorkSpaces\Scott-Tiger\MVP1\target\.generated\com\smartgwt\client\widgets\events\DropCompleteEvent___Reflection.java'
                [INFO]             See snapshot: C:\Users\Bruce\AppData\Local\Temp\com.smartgwt.client.widgets.events.DropCompleteEvent___Reflection4760285653646350295.java
                [INFO]          Ignored 1 unit with compilation errors in first pass.
                [INFO] Compile with -strict or with -logLevel set to TRACE or DEBUG to see all errors.
                [INFO]    [ERROR] Errors in 'P:\EclipseWorkSpaces\Scott-Tiger\MVP1\target\.generated\com\smartgwt\client\widgets\events\DropCompleteEvent___Reflection.java'
                [INFO]       [ERROR] Line 30: Bound mismatch: The generic method fire(S, JavaScriptObject) of type DropCompleteEvent is not applicable for the arguments (DropCompleteHandler, JavaScriptObject). The inferred type DropCompleteHandler is not a valid substitute for the bounded parameter <S extends DropCompleteHandler & HasHandlers>
                [INFO]       See snapshot: C:\Users\Bruce\AppData\Local\Temp\com.smartgwt.client.widgets.events.DropCompleteEvent___Reflection4311642332934310670.java
                [INFO]    [ERROR] Errors in 'gen/com/gwtent/reflection/client/TypeOracle_Visitor.java'
                [INFO]       [ERROR] Line 2115: Rebind result 'com.smartgwt.client.widgets.events.DropCompleteEvent___Reflection' could not be found
                [INFO] ------------------------------------------------------------------------
                [INFO] BUILD FAILURE
                • I have a project I’ve been working on with SmartGWT for about 45 days. I’ve never gotten this error before.
                • I made some code changes (too many to know which would be the offending code change).
                • I rebuilt the Eclipse project from scratch
                • I deleted the GWT unitcache (actually this is done every time I build because I’m using Maven. Maven automatically deletes the target folder which is where the unitcache is located in my project.)
                • I upgraded SmartGWT to 3.1-p20130406 (today’s build)


                After doing all that the problem persists.

                Any help would be greatly appreciated.

                Comment


                  #23
                  Do you also use GWTEnt.jar? The previous poster isolated the problem to that library.

                  Comment


                    #24
                    Yes, using GWTEnt.jar

                    Originally posted by Isomorphic View Post
                    Do you also use GWTEnt.jar? The previous poster isolated the problem to that library.
                    Yes, I am using GWTEnt.jar. My apologies for not noticing that in the thread.

                    I haven't isolated it to a specific code change yet. I have been coding with it for three days without this error. I created an EventBus library based on GWTEnt.jar that was thoroughly unit tested. I applied that library to my larger SmartGWT library I was able to progressively and successfully to get it to work on my SmartGWT project until I made a series of code changes without doing GWT compiles between because the code changes were all related. So I don't know which particular code change cause the GWT compile to fail.

                    I'm going to go back to a check point in the code and make the changes more incrementally to see if I can isolate what code change exposed the GWT compile failure.

                    I'm guessing there is a combination of GWTEnt.jar and the SmartGWT code which hits a GWT compiler problem.

                    Do you have a recommendation for:
                    • A better library than GWTEnt that supports reflection. I just need to be able to find annotations, methods, and parameters.
                    • An Event Bus library. I found several of them but either they didn’t work in the GWT environment (one used threading) or they were overly complex for what I was trying to do.


                    I find the GWT events too complete to make readable code so I was tyring to do something simple with annotations.

                    Thanks for you help!

                    Comment


                      #25
                      GWT compiler can't compile ListGrid + GWTEnt's TypeOracle class

                      I isolated the GWT compiler failure to a single line of code. The offending line of code makes a call to my library which then makes multiple calls to the GWTEnt library. The line of code is in a subclass of SmartGWT’s ListGrid.

                      Here is the snippet of code that makes calls the to GWTEnt library:

                      Code:
                      	public static void subscribe(Subscriber subscriber) {
                      		@SuppressWarnings("rawtypes")
                      		ClassType classType = TypeOracle.Instance.getClassType(subscriber
                      				.getClass());
                      		Method[] methods = classType.getMethods();
                      		for (Method method : methods) {
                      			Annotation[] annotations = method.getAnnotations();
                      			annotationCount += annotations.length;
                      			for (Annotation annotation : annotations) {
                      				if (annotation.toString().indexOf(annotationName) == 0) {
                      					ListenerItem listenerItem = new ListenerItem(subscriber,
                      							method.getName());
                      					matchedAnnotations++;
                      					Parameter[] parameters = method.getParameters();
                      					parameterCount += parameters.length;
                      					assert (parameters.length == 1);
                      					String parameterType = parameters[0].getTypeName();
                      					parameterTypes = parameterTypes + " " + parameterType;
                      					ArrayList<ListenerItem> methodList = parameterMap
                      							.get(parameterType);
                      					if (methodList == null) {
                      						methodList = new ArrayList<ListenerItem>();
                      						parameterMap.put(parameterType, methodList);
                      					}
                      					methodList.add(listenerItem);
                      				}
                      			}
                      		}
                      		methodCount += methods.length;
                      	}
                      As you can see there are several method calls the GWTEnt’s reflection class, TypeOracle.

                      This has to all get code generated by the GWT compiler and it probably gets confused.

                      Comment


                        #26
                        People have had good luck with TIBCO EventBus.

                        We don't have another library we'd recommend for reflection. You might take this GWTEnt issue and see if you can get them to address it via posting to their forums / issue tracker.

                        Comment


                          #27
                          I would recommend using native GWT's EventBus API's instead of Tibco EventBus unless you need to do cross frame communication via an event bus. Tibco EventBus was useful prior to the introduction of EventBus in core GWT.

                          See this link on how to use GWT's EventBus.

                          Comment


                            #28
                            GWT Compiler + ListGrid + com.gwtent.reflection.client compile failure

                            GWT Compiler + ListGrid + com.gwtent.reflection.client compile failure

                            I have isolated the failure to a very simple test case. This is a GWT compile time failure.

                            For the test case to fail all of the following needs to be true.
                            • A class implements the interface com.gwtent.reflection.client.Reflection
                            • A private field of type ListGrid is declared (although never referenced).
                            • The method getClass() is called in the constructor.


                            If one or more of these three elements is not present the GWT compiler failure does not occur.

                            Here is the code that causes the failure:

                            Code:
                            public class GWTEntTest implements com.gwtent.reflection.client.Reflection {
                            
                            	private com.smartgwt.client.widgets.grid.ListGrid listGrid;
                            
                            	public GWTEntTest() {
                            		getClass();
                            	}
                            }
                            For a little more background I researched the source code of the interface com.gwtent.reflection.client.Reflection. This interface has no methods and only uses the annotation com.gwtent.reflection.client.Reflexible.

                            Here is the code for com.gwtent.reflection.client.Reflection (with comments removed)

                            Code:
                            @Reflectable(fieldAnnotations = true, relationTypes = true, superClasses = true, assignableClasses = true)
                            public interface Reflection {
                            
                            }
                            Here is the code for com.gwtent.reflection.client.Reflexible (with comments removed)

                            Code:
                            import java.lang.annotation.ElementType;
                            import java.lang.annotation.Retention;
                            import java.lang.annotation.RetentionPolicy;
                            import java.lang.annotation.Target;
                            
                            @Retention(RetentionPolicy.RUNTIME)
                            @Target(ElementType.TYPE)
                            public @interface Reflectable {
                            	public boolean classAnnotations() default true;
                            	public boolean fields() default true;
                            	public boolean methods() default true;
                            	public boolean constructors() default true;
                            	public boolean fieldAnnotations() default true;
                            	public boolean relationTypes() default false;
                            	public boolean superClasses() default false;
                            	public boolean assignableClasses() default false;
                            }
                            It’s not possible for me to determine the root cause from this. It could be in any combination of the GWT compiler, com.smartgwt.client.widgets.grid.ListGrid, and com.gwtent.reflection.client library.

                            Comment


                              #29
                              This is great info, but its info to be reported to the GWTEnt team, not to us. It's their compiler extension that is failing. ListGrid has no code that interacts specially with the GWT compiler.

                              Comment


                                #30
                                reporting bug to GWTEnt team

                                Originally posted by Isomorphic View Post
                                This is great info, but its info to be reported to the GWTEnt team, not to us. It's their compiler extension that is failing. ListGrid has no code that interacts specially with the GWT compiler.
                                Thanks for all your help participation. I will send the same report to the GWTEnt team.

                                Comment

                                Working...
                                X