Uploaded image for project: 'Quarkus'
  1. Quarkus
  2. QUARKUS-1020

Added class files should trigger a full reload

    XMLWordPrintable

Details

    Description

      With instrumentation enabled, If there are updated classes AND new classes, instrumentation will occur, but the new "ADDED" classes won't be loaded.

      In fact, consider the case:

      changedClassResults.addedClasses.isEmpty() == false
      && changedClassResults.changedClasses.isEmpty() == false

      in `RuntimeUpdatesProcessor` the following `if` condition will be `true`, causing the body to execute, setting `instrumentationChange = true`

      ```
      if (changedClassResults.deletedClasses.isEmpty() && !changedClassResults.changedClasses.isEmpty()) {
      ```

      however, the check a few lines later:

      ```
      boolean restartNeeded = !instrumentationChange && (changedClassResults.isChanged()

      (IsolatedDevModeMain.deploymentProblem != null && userInitiated) configFileRestartNeeded);
      ```

      will always be false, skipping over `changedClassResults.isChanged()` which expands to:

      ```
      !changedClasses.isEmpty() || !deletedClasses.isEmpty() || !addedClasses.isEmpty();
      ```

      so either (1) instrumentation should be skipped over when there are ADDED class files, or (2) the check below should read something along the lines of:

      ```
      boolean restartNeeded = !changedClassResults.addedClasses.isEmpty() ||
      !instrumentationChange &&
      ((IsolatedDevModeMain.deploymentProblem != null && userInitiated) || configFileRestartNeeded);
      ```

      this patch is for (1).

      (This should be backported to 1.11)

      EDIT: This is draft as I am still verifying this works locally with both `main` and `1.11`
      related: https://github.com/kiegroup/kogito-runtimes/pull/1123

      Attachments

        Activity

          People

            Unassigned Unassigned
            probinso_jira Quarkus JIRA Bot
            Josef Smrcka Josef Smrcka (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: