Open
Conversation
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Updates exception handling across the framework to avoid catching Throwable (and therefore Errors), limiting wrapping/reporting to Exception cases.
Changes:
- Replaced multiple
catch (Throwable …)blocks withcatch (Exception …)in type/flow/stub components. - Kept existing error-reporting/wrapping behavior but restricted it to exceptions (e.g.,
BugInCF.addLocation, warnings). - Adjusted local variable names accordingly (
t→e, etc.).
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| framework/src/main/java/org/checkerframework/framework/type/TypeFromTree.java | Catch Exception instead of Throwable when wrapping with BugInCF.addLocation. |
| framework/src/main/java/org/checkerframework/framework/type/DefaultTypeHierarchy.java | Catch Exception instead of Throwable in bounds containment workaround path. |
| framework/src/main/java/org/checkerframework/framework/type/AnnotatedTypeFactory.java | Catch Exception instead of Throwable while parsing ajava files. |
| framework/src/main/java/org/checkerframework/framework/stub/ToIndexFileConverter.java | Main method now catches Exception instead of Throwable before exiting. |
| framework/src/main/java/org/checkerframework/framework/stub/AnnotationFileParser.java | Parser helper methods now catch Exception instead of Throwable and warn. |
| framework/src/main/java/org/checkerframework/framework/flow/CFAbstractTransfer.java | Catch Exception instead of Throwable when wrapping with BugInCF.addLocation. |
| framework/src/main/java/org/checkerframework/framework/flow/CFAbstractAnalysis.java | Catch Exception instead of Throwable when wrapping in BugInCF. |
| framework/src/main/java/org/checkerframework/common/basetype/BaseTypeVisitor.java | Catch Exception instead of Throwable when constructing the type factory and wrapping in BugInCF. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| } catch (Exception ex) { | ||
| // Work around: | ||
| // https://bugs.java.com/bugdatabase/view_bug.do?bug_id=JDK-8265255 | ||
| if (ex.getMessage().contains("AsSuperVisitor")) { |
| currentFileAjavaTypes.parseAjavaFileWithTree(ajavaPath, root); | ||
| } catch (Throwable e) { | ||
| } catch (Exception e) { | ||
| throw new Error( |
| } catch (Throwable e) { | ||
| } catch (Exception e) { | ||
| e.printStackTrace(); | ||
| System.exit(1); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
I reviewed all
catch (Throwableoccurrences and for these it seemed better to catch Exception.Catching Throwable also catches Errors -- OutOfMemoryError, StackOverflowError, LinkageError, AssertionError, ThreadDeath. Wrapping these seems confusing.
Note how SourceChecker already wraps Throwables and outputs a message.