Skip to content

Java: Add test for flexible constructor support #20136

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

IdrissRio
Copy link
Contributor

@IdrissRio IdrissRio commented Jul 29, 2025

This PR adds a library test to verify the Java extractor support for flexible constructor bodies, a feature introduced in JEP 513 and finalized in Java 25..

Please ignore any DCA linked.

@github-actions github-actions bot added the Java label Jul 29, 2025
@IdrissRio IdrissRio force-pushed the idrissrio/flexible-constructors branch from 357ed2f to 3667004 Compare July 29, 2025 13:40
@IdrissRio IdrissRio marked this pull request as ready for review July 30, 2025 06:47
@Copilot Copilot AI review requested due to automatic review settings July 30, 2025 06:47
@IdrissRio IdrissRio requested a review from a team as a code owner July 30, 2025 06:47
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds a library test to verify Java extractor support for flexible constructor bodies, a new language feature introduced in JEP 513 and finalized in Java 25. The test validates that the extractor correctly handles constructors where statements can precede super() or this() calls.

Key changes:

  • Creates a new test directory structure for flexible constructor testing
  • Adds Java source code demonstrating various flexible constructor scenarios
  • Configures the test to use Java 25 with preview features enabled

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
java/ql/test/library-tests/flexible-constructors/options Configures extractor to use Java 25 with preview features
java/ql/test/library-tests/flexible-constructors/PrintAst.qlref References the AST printing query for test execution
java/ql/test/library-tests/flexible-constructors/PrintAst.expected Expected AST output for validation
java/ql/test/library-tests/flexible-constructors/FlexibleConstructors.java Test cases demonstrating flexible constructor syntax
java/ql/test/library-tests/flexible-constructors/CONSISTENCY/diags.expected Expected diagnostic output
Comments suppressed due to low confidence (1)

java/ql/test/library-tests/flexible-constructors/options:2

  • Java 25 does not exist as of my knowledge cutoff in January 2025. The latest stable Java version is Java 21 LTS, with Java 22 and 23 being non-LTS releases. Consider using an existing Java version or verify if this is intended for future testing.
//semmle-extractor-options: --javac-args --release 25 --enable-preview

@aschackmull
Copy link
Contributor

The test ought to include field initialization (using both implicit and explicit this) in the early construction context aka prologue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy