[
https://issues.apache.org/jira/browse/GROOVY-11263?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17801570#comment-17801570
]
ASF GitHub Bot commented on GROOVY-11263:
-----------------------------------------
eric-milles commented on code in PR #2023:
URL: https://github.com/apache/groovy/pull/2023#discussion_r1439064503
##########
src/main/java/org/codehaus/groovy/classgen/Verifier.java:
##########
@@ -302,6 +310,12 @@ private void checkFinalVariables(final ClassNode node) {
visitor.visitClass(node);
}
+ private void checkDeadCode(final ClassNode node) {
+ if (null == sourceUnit) return;
+ GroovyClassVisitor visitor = new DeadCodeAnalyzer(sourceUnit);
+ visitor.visitClass(node);
Review Comment:
I think you can get to the `SourceUnit` through the `ClassNode` without
having to change `Verifier` all around.
> Analyze dead code
> -----------------
>
> Key: GROOVY-11263
> URL: https://issues.apache.org/jira/browse/GROOVY-11263
> Project: Groovy
> Issue Type: Improvement
> Reporter: Daniel Sun
> Priority: Major
> Labels: breaking_change
> Fix For: 5.x
>
>
> Groovy allows dead code after {{throw}}, {{return}}, {{break}} and
> {{continue}}, e.g.
> {code:java}
> def m() {
> return
> def a = 1
> }
> {code}
> It's better to avoid such dead code.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)