lanky228 opened a new pull request, #5061:
URL: https://github.com/apache/calcite/pull/5061

   ## Summary
   
   This PR addresses two explicit TODO comments requesting replacement of 
`java.util.Stack` with `java.util.Deque`.
   
   ## Changes
   
   ### Files Modified
   - `core/src/main/java/org/apache/calcite/runtime/Pattern.java`
   - `core/src/main/java/org/apache/calcite/plan/volcano/TopDownRuleDriver.java`
   
   ### Details
   - Replaced `java.util.Stack` with `java.util.ArrayDeque` (via `Deque` 
interface)
   - Removed `@SuppressWarnings("JdkObsolete")` annotations that were 
suppressing the deprecation warnings
   - Removed the `// TODO: replace with Deque` comments
   - Fixed two instances where `tasks.add()` was used instead of `tasks.push()` 
to maintain consistent LIFO behavior after the migration
   
   ### Why This Change?
   
   `Stack` extends `Vector` and its operations are synchronized, which is 
unnecessary for single-threaded usage. `ArrayDeque` provides better performance 
and is the recommended replacement per Java documentation.
   
   The `tasks.add()` → `tasks.push()` fix ensures semantic consistency: 
`Stack.add()` and `Stack.push()` both append to the end (LIFO), but 
`ArrayDeque.add()` appends to tail while `ArrayDeque.push()` adds to head. 
Without this fix, the migration would have changed behavior.


-- 
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.

To unsubscribe, e-mail: [email protected]

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

Reply via email to