Skip to content
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

Import wildcards and implicit java.lang.* #44

Merged
merged 1 commit into from
Feb 14, 2025
Merged

Conversation

Brofian
Copy link
Owner

@Brofian Brofian commented Feb 8, 2025

Changes

  • The grammar and parser now allow for import wildcards like import java.lang.*
  • If no discrete import matches a simplified class name, every wildcard is tested (from first to last) as the package name of this class. The first match will be used for the fully qualified name, or otherwise the current package is used
  • If not specified explicitly, the semantic check will add the java.lang.* as an implicit import. This removes the requirement of importing classes like java.lang.String or java.lang.Object
  • This fixed a bug, where an implicit java.lang.Object parent would be converted to <current-package>.Object

This will resolve #21

@Brofian Brofian self-assigned this Feb 8, 2025
Copy link
Collaborator

@JakubSchwenkbeck JakubSchwenkbeck left a comment

Choose a reason for hiding this comment

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

This looks really good! :)
I totally overlooked the wildcards for imports when starting the ASTBuilder, thanks for the fix:)

@Brofian Brofian merged commit f4e39ce into main Feb 14, 2025
1 check passed
@Brofian Brofian deleted the feature/wildcard-imports branch February 14, 2025 16:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implicit java.lang.* imports
2 participants