Uploaded image for project: 'Arquillian Graphene'
  1. Arquillian Graphene
  2. ARQGRA-245

Returning a value from Function<T,V> in WebDriverwait cannot be compiled with JDK7

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Out of Date
    • Affects Version/s: 2.0.0.Alpha2
    • Fix Version/s: 2.0.0.Alpha3
    • Component/s: core
    • Labels:
      None
    • Sprint:
      Sprint 2

      Description

      When compiling with JDK7, following error happens:

          @FindBy(className = "failed")
          WebElement failedCasesCount;
      
          @FindBy(className = "passed")
          WebElement passedCasesCount;
      
          @FindBy(className = "total")
          WebElement totalCasesCount;
      
          @FindBy(id = "qunit-tests")
          QUnitResultsFragment results;
      
          private URL pageUrl;
      
          private long timeout = 60;
      
          private TimeUnit unit = TimeUnit.SECONDS;
      
      
          private int getExecutionResult(WebElement element) {
              if (waitModel().withTimeout(timeout, unit).until(element(element).isPresent())) {
                  return Integer.valueOf(element.getText());
              }
              throw new QUnitExecutionException(MessageFormat.format(
                      "Unable to execute QUnit tests at {0} within {1}{2}, timeouted.",
                      pageUrl, timeout, unit));
          }
      
      [WARNING] /home/kpiwko/devel/wfk/wfk-qa/build/drone-qunit-integration/src/main/java/org/jboss/arquillian/drone/qunit/QUnitPage.java:[80,65] [unchecked] unchecked call to <V>until(Function<? super T,V>) as a member of the raw type FluentWait
      [INFO] 1 warning
      [INFO] -------------------------------------------------------------
      [INFO] -------------------------------------------------------------
      [ERROR] COMPILATION ERROR :
      [INFO] -------------------------------------------------------------
      [ERROR]
          V extends Object declared in method <V>until(Function<? super T,V>)
          T extends Object declared in class FluentWait
      /home/kpiwko/devel/wfk/wfk-qa/build/drone-qunit-integration/src/main/java/org/jboss/arquillian/drone/qunit/QUnitPage.java:[80,65] error: incompatible types
      

      Further investigation shows that:

      until() methods comes from Graphene
      withTimeout() comes from WebDriver
      withMessage() comes form WebDriver

      until(String) comes from Graphene and seems to be leftover from Graphene1 migration.

      The problematic part is about setting FLUENT generics to null as this cause ambiguity on JDK7.

      I'd prefer to decouple direct WebDriverWait of Graphene from WebDriverWait of WebDriver and rather use a delegate.

      That way we can create until(long,TimeUnit) or even withMessage(String), withTimeout(long,TimeUnit) methods which will be able to interfere types even on jdk7.

      Marking this issues a critical. There is no workaround how to set dynamically set wait while using Graphene on JDK7.

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                jpapouse Jan Papousek
                Reporter:
                kpiwko Karel Piwko
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: