Uploaded image for project: 'RESTEasy'
  1. RESTEasy
  2. RESTEASY-1250

Issues with moving from deprecated RestEasy client code to new implementation

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 3.0.17.Final
    • 3.0.13.Final, 3.0.14.Final
    • jaxrs
    • None
    • Hide

      Maven build/test the attached testcases. Use Java 8.

      (the only issue not shown/included is the "as" method)

      Show
      Maven build/test the attached testcases. Use Java 8. (the only issue not shown/included is the "as" method)

      This is likely several different issues that could be split out but they are all under the umbrella of attempting to use the latest versions of RestEasy (and Java) as they should be. And the attached testcases demonstrate almost all of them.

      1. Java 8 generates bridge/default methods in some cases causing RE to throw an exception because those methods don't include the same annotations as the originals (mustUseExactlyOneHttpMethod).

      Suggested fix: skip isDefault() methods when iterating over interface methods (approx line 46 of ProxyBuilder).

      2. For casting purposes, we use as() and a patch was submitted that was included in the old way of building proxies....

      https://issues.jboss.org/browse/RESTEASY-610

      This doesn't seem to have made it into the new/refactored code.

      Suggested fix: Apply fix to new ProxyBuilder code. A start is to add something like THIS to ProxyBuilder around line 50 or so:

      				if (method.getName().equals("as"))
      				{
      					final WebTarget baseF = base;
      					invoker = new MethodInvoker()
      					{
      						@Override
      						public Object invoke(Object[] args)
      						{
      							return ProxyBuilder.proxy((Class)args[0], baseF, config);
      						}
      					};
      				}
      

      But I think other changes are required.

      3. I can't figure out a way to pass/return simple (non-JSON) Strings now. They seem to need extra quotes around them. We managed to work around that before with a JsonStringProvider but I can't get it working with the new code. The attached examples show the differences.

      Solution: ?

      4. Now we're no longer able to use generic types in interfaces as we were before. This exception is thrown:

      java.lang.IllegalArgumentException: Type parameter T not a class or parameterized type whose raw type is a class

      Suggested fix: Approx line 50 In BodyEntityExtractor could be changed to:

      if (method.getGenericReturnType() != null) // && !method.getGenericReturnType().getTypeName().equals("T"))

      But I don't think that's The Right Thing to do. (But it works for now.)

      Second (new) attachment testcase shows this issue.

              rsigal@redhat.com Ronald Sigal
              shanedav Shane D (Inactive)
              Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: