GeezerVison is showing github.com — [swift] Add more swift 5.x support (#unavailable mainly) by kenji21 · Pull Request #4384 · pmd/pmd
Conversation
kenji21
commented
Feb 7, 2023
•
edited by adangel
Loading
Uh oh!
There was an error while loading. Please reload this page.
Describe the PR
Fix a crash occurring when parsing Swift 5.6 code with #unavailable, for example, analysing this swift 5.6 new feature:
// https://github.com/apple/swift-evolution/blob/main/proposals/0290-negative-availability.md
if #unavailable(iOS 15.0) {
// Old functionality
} else {
// iOS 15 functionality
}
lead to a crash with this stack trace :
Encountered: token recognition error at: '#u'
at net.sourceforge.pmd.cpd.AntlrTokenizer.tokenize(AntlrTokenizer.java:44)
at net.sourceforge.pmd.cpd.CPD.addAndThrowLexicalError(CPD.java:144)
at net.sourceforge.pmd.cpd.CPD.add(CPD.java:139)
at net.sourceforge.pmd.cpd.CPD.add(CPD.java:108)
at net.sourceforge.pmd.cpd.CPD.add(CPD.java:70)
at net.sourceforge.pmd.cpd.CPD.addDirectory(CPD.java:80)
at net.sourceforge.pmd.cpd.CPD.addRecursively(CPD.java:65)
at net.sourceforge.pmd.cpd.CPDCommandLineInterface.addSourcesFilesToCPD(CPDCommandLineInterface.java:166)
at net.sourceforge.pmd.cpd.CPDCommandLineInterface.addSourceFilesToCPD(CPDCommandLineInterface.java:146)
at net.sourceforge.pmd.cpd.CPDCommandLineInterface.main(CPDCommandLineInterface.java:100)
at net.sourceforge.pmd.cpd.CPD.main(CPD.java:178)
Caused by: LexerNoViableAltException('#')
at org.antlr.v4.runtime.atn.LexerATNSimulator.failOrAccept(LexerATNSimulator.java:312)
at org.antlr.v4.runtime.atn.LexerATNSimulator.execATN(LexerATNSimulator.java:233)
at org.antlr.v4.runtime.atn.LexerATNSimulator.match(LexerATNSimulator.java:117)
at org.antlr.v4.runtime.Lexer.nextToken(Lexer.java:141)
at net.sourceforge.pmd.lang.antlr.AntlrTokenManager.getNextTokenFromAnyChannel(AntlrTokenManager.java:47)
at net.sourceforge.pmd.lang.antlr.AntlrTokenManager.getNextToken(AntlrTokenManager.java:40)
at net.sourceforge.pmd.cpd.token.internal.BaseTokenFilter.getNextToken(BaseTokenFilter.java:45)
at net.sourceforge.pmd.cpd.AntlrTokenizer.tokenize(AntlrTokenizer.java:39)
... 10 more
Feb 07, 2023 5:04:38 PM net.sourceforge.pmd.cpd.CPDCommandLineInterface main
SEVERE: An error occurred while executing CPD.
Related issues
Ready?
- Added unit tests for fixed bug/feature
- Passing all unit tests
- Complete build
./mvnw clean verify passes (checked automatically by github actions)
- Added (in-code) documentation (if needed)
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
1 Message
|
| 📖 |
No regression tested rules have been changed. |
Generated by 🚫 Danger
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
adangel
changed the title
Add more swift 5.x support (#unavalaible mainly)
[swift] Add more swift 5.x support (#unavalaible mainly)
Feb 9, 2023
adangel
changed the title
[swift] Add more swift 5.x support (#unavalaible mainly)
[swift] Add more swift 5.x support (#unavailable mainly)
Feb 9, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
adangel
added a commit
to adangel/pmd
that referenced
this pull request
Feb 9, 2023
[swift] Add more swift 5.x support (#unavailable mainly) pmd#4384
Reviewers
adangel
adangel approved these changes
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Labels
an:enhancement
An improvement on existing features / rules
in:cpd
Affects the copy-paste detector
in:grammar
About the grammar of a lexer or parser, eg, a parse/lex exception
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.