Skip to content

Commit

Permalink
remove unnecessary throws declarations from methods
Browse files Browse the repository at this point in the history
  • Loading branch information
JuditKnoll committed Dec 3, 2024
1 parent 5e08fc5 commit e87c97d
Show file tree
Hide file tree
Showing 17 changed files with 21 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ protected void doTestMultiQuickfixResolution(IProject project, List<QuickFixTest
checkJavaFiles(project.members());
}

private void checkJavaFiles(IResource[] iResources) throws CoreException, IOException, JavaModelException {
private void checkJavaFiles(IResource[] iResources) throws CoreException, IOException {
for (IResource resource : iResources) {
if (resource instanceof IFile) {
String fileName = resource.getName();
Expand Down
3 changes: 1 addition & 2 deletions eclipsePlugin/src/de/tobject/findbugs/FindbugsPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -738,11 +738,10 @@ private static void readBugCollectionAndProject(IProject project, IProgressMonit
* the bug collection
* @param monitor
* progress monitor
* @throws IOException
* @throws CoreException
*/
public static void storeBugCollection(IProject project, final SortedBugCollection bugCollection, IProgressMonitor monitor)
throws IOException, CoreException {
throws CoreException {

// Store the bug collection and findbugs project in the session
project.setSessionProperty(SESSION_PROPERTY_BUG_COLLECTION, bugCollection);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,8 @@ public ISchedulingRule getRule(int kind, Map<String, String> args) {
* @param kind
* kind the kind of build being requested, see
* IncrementalProjectBuilder
* @throws CoreException
*/
private void doBuild(final Map<?, ?> args, final IProgressMonitor monitor, int kind) throws CoreException {
private void doBuild(final Map<?, ?> args, final IProgressMonitor monitor, int kind) {
boolean incremental = (kind == IncrementalProjectBuilder.INCREMENTAL_BUILD
|| kind == IncrementalProjectBuilder.AUTO_BUILD);
IProject project = getProject();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -367,8 +367,6 @@ private void updateBugCollection(Project findBugsProject, Reporter bugReporter,
// props
st.newPoint("storeBugCollection");
FindbugsPlugin.storeBugCollection(project, resultCollection, monitor);
} catch (IOException e) {
FindbugsPlugin.getDefault().logException(e, "Error performing SpotBugs results update");
} catch (CoreException e) {
FindbugsPlugin.getDefault().logException(e, "Error performing SpotBugs results update");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ void testCloseTwice() {
}

@Test
void awaitTerminationWithoutShutdown() throws InterruptedException {
void awaitTerminationWithoutShutdown() {
ExecutorService executorService = new CurrentThreadExecutorService();
Assertions.assertThrows(IllegalStateException.class, () -> {
executorService.awaitTermination(1, TimeUnit.SECONDS);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ private File getFindbugsTestCasesFile(String path) {
}

@BeforeEach
void setUp() throws Exception {
void setUp() {
loadFindbugsPlugin();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ class Subtypes2Test extends FindBugsTestCase {
ObjectType typeParameterString;

@BeforeEach
void setUp() throws Exception {
void setUp() {
typeSerializable = ObjectTypeFactory.getInstance("java.io.Serializable");
typeClonable = ObjectTypeFactory.getInstance("java.lang.Cloneable");
typeObject = ObjectTypeFactory.getInstance(Values.DOTTED_JAVA_LANG_OBJECT);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ private Filter readFilterFromXML() throws IOException {
}

@Test
void testPerformAnalysis(SpotBugsRunner spotbugs) throws Exception {
void testPerformAnalysis(SpotBugsRunner spotbugs) {
BugCollection bugCollection = spotbugs.performAnalysis(
Paths.get("../spotbugsTestCases/build/classes/java/main/org/immutables/value/Generated.class"),
Paths.get("../spotbugsTestCases/build/classes/java/main/org/immutables/value/Value.class"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class NotMatcherTest {
private final BugInstance bug = new BugInstance("UUF_UNUSED_FIELD", 0);

@Test
void invertsResultsFromWrappedMatcher_doesntMatchWhenWrappedDoesMatch() throws Exception {
void invertsResultsFromWrappedMatcher_doesntMatchWhenWrappedDoesMatch() {
Matcher wrappedMatcher = new TestMatcher(true);
NotMatcher notMatcher = new NotMatcher();
notMatcher.addChild(wrappedMatcher);
Expand All @@ -51,7 +51,7 @@ void invertsResultsFromWrappedMatcher_doesntMatchWhenWrappedDoesMatch() throws E
}

@Test
void invertsResultsFromWrappedMatcher_doesMatchWhenWrappedDoesnt() throws Exception {
void invertsResultsFromWrappedMatcher_doesMatchWhenWrappedDoesnt() {
Matcher wrappedMatcher = new TestMatcher(false);
NotMatcher notMatcher = new NotMatcher();
notMatcher.addChild(wrappedMatcher);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ void readXML() throws Exception {


@Test
void match() throws Exception {
void match() {
SourceMatcher sm = new SourceMatcher(fileName);

// no source set: test incomplete data
Expand Down Expand Up @@ -131,7 +131,7 @@ void match() throws Exception {
}

@Test
void testRealPathMatchWithRegexpAndProject() throws Exception {
void testRealPathMatchWithRegexpAndProject() {
// add this test class as the bug target
bug.addClass("SourceMatcherTest", null);
ClassAnnotation primaryClass = bug.getPrimaryClass();
Expand All @@ -155,7 +155,7 @@ void testRealPathMatchWithRegexpAndProject() throws Exception {
}

@Test
void testRealPathMatchWithRegexpAndAnalysisContext() throws Exception {
void testRealPathMatchWithRegexpAndAnalysisContext() {
// add this test class as the bug target
bug.addClass("SourceMatcherTest", null);
ClassAnnotation primaryClass = bug.getPrimaryClass();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ void testHelpUriAndTags() {
}

@Test
void testExtensions() throws PluginException {
void testExtensions() {
PluginLoader pluginLoader = DetectorFactoryCollection.instance().getCorePlugin().getPluginLoader();
Plugin plugin = new Plugin("pluginId", "version", null, pluginLoader, true, false);
DetectorFactoryCollection dfc = new DetectorFactoryCollection(plugin);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1178,7 +1178,7 @@ private Plugin constructMinimalPlugin(Document pluginDescriptor, List<Document>
return constructedPlugin;
}

public Document getPluginDescriptor() throws PluginException, PluginDoesntContainMetadataException {
public Document getPluginDescriptor() throws PluginException {
Document pluginDescriptor;

// Read the plugin descriptor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ SourceRepository makeInMemorySourceRepository(final String url) {
return r;
}

SourceRepository makeJarURLConnectionSourceRepository(final String url) throws MalformedURLException, IOException {
SourceRepository makeJarURLConnectionSourceRepository(final String url) throws IOException {
final File file = File.createTempFile("jar_cache", null);
file.deleteOnExit();
final BlockingSourceRepository r = new BlockingSourceRepository();
Expand All @@ -288,7 +288,7 @@ SourceRepository makeJarURLConnectionSourceRepository(final String url) throws M
* @throws IOException
* @throws MalformedURLException
*/
private InputStream open(final String url) throws IOException, MalformedURLException {
private InputStream open(final String url) throws IOException {
InputStream in = null;
URLConnection connection = new URL(url).openConnection();
if (getProject().isGuiAvaliable()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ public ICodeBaseEntry lookupResource(String resourceName) {
return new DirectoryCodeBaseEntry(this, resourceName);
}

InputStream openFile(String resourceName) throws FileNotFoundException, IOException {
InputStream openFile(String resourceName) throws IOException {
File path = getFullPathOfResource(resourceName);
return new BufferedInputStream(new FileInputStream(path));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public void visitClassContext(ClassContext classContext) {
* @param classContext
* @param method
*/
private void analyzeMethod(ClassContext classContext, Method method) throws MethodUnprofitableException, CFGBuilderException,
private void analyzeMethod(ClassContext classContext, Method method) throws CFGBuilderException,
DataflowAnalysisException {
if (BCELUtil.isSynthetic(method) || (method.getAccessFlags() & Const.ACC_BRIDGE) == Const.ACC_BRIDGE) {
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ private void checkQualifier(XMethod xmethod, CFG cfg, TypeQualifierValue<?> type

private void checkDataflow(XMethod xmethod, CFG cfg, TypeQualifierValue<?> typeQualifierValue,
ValueNumberDataflow vnaDataflow, ForwardTypeQualifierDataflow forwardDataflow,
BackwardTypeQualifierDataflow backwardDataflow) throws DataflowAnalysisException, CheckedAnalysisException {
BackwardTypeQualifierDataflow backwardDataflow) throws CheckedAnalysisException {
for (Iterator<Location> i = cfg.locationIterator(); i.hasNext();) {
Location loc = i.next();

Expand Down Expand Up @@ -371,7 +371,7 @@ private void checkForEqualityTest(XMethod xmethod, CFG cfg, TypeQualifierValue<?

private void checkValueSources(XMethod xMethod, CFG cfg, TypeQualifierValue<?> typeQualifierValue,
ValueNumberDataflow vnaDataflow, ForwardTypeQualifierDataflow forwardDataflow,
BackwardTypeQualifierDataflow backwardDataflow) throws DataflowAnalysisException, CheckedAnalysisException {
BackwardTypeQualifierDataflow backwardDataflow) throws CheckedAnalysisException {

// Check to see if any backwards ALWAYS or NEVER values
// reach incompatible sources.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,7 @@ private void copyEntry(ZipFile zipInputFile, ZipEntry ze, boolean writeToAnalyze
zipIn.close();
}

private void advanceAuxiliaryOut() throws IOException, FileNotFoundException {
private void advanceAuxiliaryOut() throws IOException {
auxiliaryOut.close();
auxiliaryOut = createZipFile(getNextAuxiliaryFileOutput());
}
Expand Down

0 comments on commit e87c97d

Please sign in to comment.