fix "JDBC resource opened but not safely closed" inspection in the presence of try-with-resources

This commit is contained in:
Bas Leijdekkers
2011-03-18 11:37:01 +01:00
parent 26d4fa27a0
commit e6d124b319
2 changed files with 4 additions and 3 deletions
@@ -1,5 +1,5 @@
/*
* Copyright 2003-2010 Dave Griffith, Bas Leijdekkers
* Copyright 2003-2011 Dave Griffith, Bas Leijdekkers
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
/*
* Copyright 2003-2010 Dave Griffith, Bas Leijdekkers
* Copyright 2003-2011 Dave Griffith, Bas Leijdekkers
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -112,7 +112,8 @@ public class JDBCResourceInspection extends ResourceInspection {
return;
}
final PsiElement parent = getExpressionParent(expression);
if (parent instanceof PsiReturnStatement) {
if (parent instanceof PsiReturnStatement ||
parent instanceof PsiResourceVariable) {
return;
}
final PsiVariable boundVariable = getVariable(parent);