mike-jumper commented on a change in pull request #546:
URL: https://github.com/apache/guacamole-client/pull/546#discussion_r512960190



##########
File path: guacamole-ext/src/main/java/org/apache/guacamole/net/auth/User.java
##########
@@ -103,7 +103,26 @@
      *     If an error occurs while reading the history of this user, or if
      *     permission is denied.
      */
+    @Deprecated

Review comment:
       > Okay, so I could either do that, or just write `default` 
implementations in `User` that return `List<ActivityRecord>` (`getHistory()`) 
and `ActivityRecordSet<ActivityRecord>` (`getUserHistory()`). Is there a 
situations where the default implementation returning empty sets would cause 
issues?
   
   For something like:
   
   ```java
   public interface User {
   
       ...
   
       @Deprecated
       default List<? extends ActivityRecord> getHistory() throws 
GuacamoleException {
           return Collections.emptyList();
       }
   
       ActivityRecordSet<ActivityRecord> getUserHistory() throws 
GuacamoleException {
            return new SimpleActivityRecordSet<>();
       }
   
       ...
   
   }
   ```
   
   We end up with:
   
   | Extension implements... | Result |
   | -------------- | ------ |
   | Only `getHistory()` (older extension) | Webapp invokes `getUserHistory()` 
which returns an empty set, despite `getHistory()` doing otherwise. |
   | Only `getUserHistory()` (newer extension) | Webapp invokes 
`getUserHistory()` which works as expected. If an older extension decorates 
`User` objects and attempts to do something with `getHistory()`, it will not 
have any effect and may behave as if history is unimplemented. |
   | Both (masochistic extension) | All calls to history-related functions work 
as expected. |
   | Neither | Calls to either `getUserHistory()` or `getHistory()` have the 
same result: empty set of records |
   
   That ends up not working well because older extensions would cease being 
compatible (they would function differently with 1.3.0 than the version of 
Guacamole they were written for).




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to